From 9361cf4b0055835b1e70800a68ea417ada837257 Mon Sep 17 00:00:00 2001 From: erwanlr Date: Thu, 22 Jan 2015 21:04:20 +0100 Subject: [PATCH] Adds a global requests counter - Fixes #746 --- lib/wpscan/wpscan_helper.rb | 7 ++++++- wpscan.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/wpscan/wpscan_helper.rb b/lib/wpscan/wpscan_helper.rb index 71ef20a9..709733c8 100644 --- a/lib/wpscan/wpscan_helper.rb +++ b/lib/wpscan/wpscan_helper.rb @@ -112,9 +112,14 @@ def help end # Hook to check if the target if down during the scan +# And have the number of requests performed to display at the end of the scan # The target is considered down after 10 requests with status = 0 -down = 0 +down = 0 +@total_requests_done = 0 + Typhoeus.on_complete do |response| down += 1 if response.code == 0 + @total_requests_done += 1 + fail 'The target seems to be down' if down >= 10 end diff --git a/wpscan.rb b/wpscan.rb index 3b310e2c..a9b461ff 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -388,6 +388,7 @@ def main puts puts info("[+] Finished: #{stop_time.asctime}") + puts info("[+] Requests Done: #{@total_requests_done}") puts info("[+] Memory used: #{used_memory.bytes_to_human}") puts info("[+] Elapsed time: #{Time.at(elapsed).utc.strftime('%H:%M:%S')}") exit(0) # must exit!