Skip to content

Commit 2335c58

Browse files
David MaloneyDavid Maloney
authored andcommitted
Null response handling
1 parent 04fd990 commit 2335c58

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/auxiliary/scanner/winrm/winrm_auth_methods.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def initialize
4141

4242
def run_host(ip)
4343
resp = winrm_poke
44-
if resp.code == 401 and resp.headers['Server'].include? "Microsoft-HTTPAPI"
44+
return nil if resp.nil?
45+
if resp.code == 401 and resp.headers['Server'].include? "Microsoft-HTTPAPI"
4546
methods = parse_auth_methods(resp)
4647
desc = resp.headers['Server'] + " Authentication Methods: " + methods.to_s
4748
report_service(
@@ -53,8 +54,8 @@ def run_host(ip)
5354
)
5455
print_good "Negotiate protocol supported" if methods.include? "Negotiate"
5556
print_good "Kerberos protocol supported" if methods.include? "Kerberos"
56-
print_good "Basic protocol supported" if methods.include? "Basic"
57-
else
57+
print_good "Basic protocol supported" if methods.include? "Basic"
58+
else
5859
print_error "#{ip}:#{rport} Does not appear to be a WinRM server"
5960
end
6061
end

0 commit comments

Comments
 (0)