Fix #439 - Detect if the target goes down during the scan
This commit is contained in:
@@ -64,6 +64,14 @@ end
|
|||||||
|
|
||||||
require_files_from_directory(COMMON_LIB_DIR, '**/*.rb')
|
require_files_from_directory(COMMON_LIB_DIR, '**/*.rb')
|
||||||
|
|
||||||
|
# Hook to check if the target if down during the scan
|
||||||
|
# The target is considered down after 10 request with status = 0
|
||||||
|
down = 0
|
||||||
|
Typhoeus.on_complete do |response|
|
||||||
|
down += 1 if response.code == 0
|
||||||
|
fail 'The target seems to be down' if down >= 10
|
||||||
|
end
|
||||||
|
|
||||||
# Add protocol
|
# Add protocol
|
||||||
def add_http_protocol(url)
|
def add_http_protocol(url)
|
||||||
url =~ /^https?:/ ? url : "http://#{url}"
|
url =~ /^https?:/ ? url : "http://#{url}"
|
||||||
|
|||||||
Reference in New Issue
Block a user