Skip to content

Commit 8c7f4b3

Browse files
committed
Avoid using inline rescue
1 parent 89753a6 commit 8c7f4b3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/auxiliary/scanner/http/web_vulndb.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,15 @@ def run_host(ip)
136136
'ctype' => 'text/plain'
137137
}, 20)
138138

139+
if res.nil?
140+
print_error("Connection timed out")
141+
return
142+
end
139143

140144
if testmesg.empty? or usecode
141-
if(not res or ((res.code.to_i == ecode) or (emesg and res.body.index(emesg))))
145+
if (res.code.to_i == ecode) or (emesg and res.body.index(emesg))
142146
if dm == false
143-
print_status("NOT Found #{wmap_base_url}#{tpath}#{testfvuln} #{res.code.to_i rescue ''}")
147+
print_status("NOT Found #{wmap_base_url}#{tpath}#{testfvuln} #{res.code.to_i}")
144148
end
145149
else
146150
if res.code.to_i == 400 and ecode != 400
@@ -172,7 +176,7 @@ def run_host(ip)
172176
)
173177
else
174178
if dm == false
175-
print_status("NOT Found #{wmap_base_url}#{tpath}#{testfvuln} #{res.code.to_i rescue ''}")
179+
print_status("NOT Found #{wmap_base_url}#{tpath}#{testfvuln} #{res.code.to_i}")
176180
end
177181
end
178182
end

0 commit comments

Comments
 (0)