Adds a global requests counter - Fixes #746
This commit is contained in:
@@ -112,9 +112,14 @@ def help
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Hook to check if the target if down during the scan
|
# 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
|
# The target is considered down after 10 requests with status = 0
|
||||||
down = 0
|
down = 0
|
||||||
|
@total_requests_done = 0
|
||||||
|
|
||||||
Typhoeus.on_complete do |response|
|
Typhoeus.on_complete do |response|
|
||||||
down += 1 if response.code == 0
|
down += 1 if response.code == 0
|
||||||
|
@total_requests_done += 1
|
||||||
|
|
||||||
fail 'The target seems to be down' if down >= 10
|
fail 'The target seems to be down' if down >= 10
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ def main
|
|||||||
|
|
||||||
puts
|
puts
|
||||||
puts info("[+] Finished: #{stop_time.asctime}")
|
puts info("[+] Finished: #{stop_time.asctime}")
|
||||||
|
puts info("[+] Requests Done: #{@total_requests_done}")
|
||||||
puts info("[+] Memory used: #{used_memory.bytes_to_human}")
|
puts info("[+] Memory used: #{used_memory.bytes_to_human}")
|
||||||
puts info("[+] Elapsed time: #{Time.at(elapsed).utc.strftime('%H:%M:%S')}")
|
puts info("[+] Elapsed time: #{Time.at(elapsed).utc.strftime('%H:%M:%S')}")
|
||||||
exit(0) # must exit!
|
exit(0) # must exit!
|
||||||
|
|||||||
Reference in New Issue
Block a user