Clean up failure messaging when bad CHOST
parent
6b4eb9a8e2
commit
b05198c05a
|
@ -96,13 +96,13 @@ def run
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
# Stop scanning if we hit a fatal error
|
# Stop scanning if we hit a fatal error
|
||||||
break if @scan_errors.length > 0
|
break if has_fatal_errors?
|
||||||
|
|
||||||
# Spawn threads for each host
|
# Spawn threads for each host
|
||||||
while (@tl.length < threads_max)
|
while (@tl.length < threads_max)
|
||||||
|
|
||||||
# Stop scanning if we hit a fatal error
|
# Stop scanning if we hit a fatal error
|
||||||
break if @scan_errors.length > 0
|
break if has_fatal_errors?
|
||||||
|
|
||||||
ip = ar.next_ip
|
ip = ar.next_ip
|
||||||
break if not ip
|
break if not ip
|
||||||
|
@ -131,7 +131,7 @@ def run
|
||||||
end
|
end
|
||||||
|
|
||||||
# Stop scanning if we hit a fatal error
|
# Stop scanning if we hit a fatal error
|
||||||
break if @scan_errors.length > 0
|
break if has_fatal_errors?
|
||||||
|
|
||||||
# Exit once we run out of hosts
|
# Exit once we run out of hosts
|
||||||
if(@tl.length == 0)
|
if(@tl.length == 0)
|
||||||
|
@ -152,7 +152,7 @@ def run
|
||||||
scanner_show_progress() if @show_progress
|
scanner_show_progress() if @show_progress
|
||||||
end
|
end
|
||||||
|
|
||||||
scanner_report_fatal_errors
|
scanner_handle_fatal_errors
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ def run
|
||||||
nohosts = false
|
nohosts = false
|
||||||
|
|
||||||
# Stop scanning if we hit a fatal error
|
# Stop scanning if we hit a fatal error
|
||||||
break if @scan_errors.length > 0
|
break if has_fatal_errors?
|
||||||
|
|
||||||
while (@tl.length < threads_max)
|
while (@tl.length < threads_max)
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ def run
|
||||||
end
|
end
|
||||||
|
|
||||||
# Stop scanning if we hit a fatal error
|
# Stop scanning if we hit a fatal error
|
||||||
break if @scan_errors.length > 0
|
break if has_fatal_errors?
|
||||||
|
|
||||||
# Exit if there are no more pending threads
|
# Exit if there are no more pending threads
|
||||||
if (@tl.length == 0)
|
if (@tl.length == 0)
|
||||||
|
@ -241,7 +241,7 @@ def run
|
||||||
scanner_show_progress() if @show_progress
|
scanner_show_progress() if @show_progress
|
||||||
end
|
end
|
||||||
|
|
||||||
scanner_report_fatal_errors
|
scanner_handle_fatal_errors
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -264,8 +264,12 @@ def seppuko!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def scanner_report_fatal_errors
|
def has_fatal_errors?
|
||||||
return unless @scan_errors && @scan_errors.length > 0
|
@scan_errors && !@scan_errors.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
def scanner_handle_fatal_errors
|
||||||
|
return unless has_fatal_errors?
|
||||||
return unless @tl
|
return unless @tl
|
||||||
|
|
||||||
# First kill any running threads
|
# First kill any running threads
|
||||||
|
@ -275,7 +279,7 @@ def scanner_report_fatal_errors
|
||||||
@scan_errors.uniq.each do |emsg|
|
@scan_errors.uniq.each do |emsg|
|
||||||
print_error("Fatal: #{emsg}")
|
print_error("Fatal: #{emsg}")
|
||||||
end
|
end
|
||||||
print_status("Scan terminated due to one or more fatal errors")
|
print_error("Scan terminated due to one or more fatal errors")
|
||||||
end
|
end
|
||||||
|
|
||||||
def scanner_progress
|
def scanner_progress
|
||||||
|
@ -284,6 +288,8 @@ def scanner_progress
|
||||||
end
|
end
|
||||||
|
|
||||||
def scanner_show_progress
|
def scanner_show_progress
|
||||||
|
# it should already be in the process of shutting down if there are fatal errors
|
||||||
|
return if has_fatal_errors?
|
||||||
pct = scanner_progress
|
pct = scanner_progress
|
||||||
if pct >= (@range_percent + @show_percent)
|
if pct >= (@range_percent + @show_percent)
|
||||||
@range_percent = @range_percent + @show_percent
|
@range_percent = @range_percent + @show_percent
|
||||||
|
|
Loading…
Reference in New Issue