Skip to content

Commit 7e0b26e

Browse files
committed
Minor fixes to syntax and error handling
1 parent cdcfa88 commit 7e0b26e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/auxiliary/scanner/http/owa_login.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,26 @@ def run
9696
domain = nil
9797

9898
begin
99-
urls.each { |url|
99+
urls.each do |url|
100100
res = send_request_cgi({
101101
'encode' => true,
102102
'uri' => "/#{url}",
103103
'method' => 'GET',
104104
'headers' => {"Authorization" => "NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw=="}
105105
}, 25)
106106

107-
if res.code == 401 and res['WWW-Authenticate'].match(/^NTLM/i)
107+
if not res
108+
print_error("#{msg} HTTP Connection Error, Aborting")
109+
return :abort
110+
end
111+
112+
if res and res.code == 401 and res['WWW-Authenticate'].match(/^NTLM/i)
108113
hash = res['WWW-Authenticate'].split('NTLM ')[1]
109114
domain = Rex::Proto::NTLM::Message.parse(Rex::Text.decode_base64(hash))[:target_name].value().gsub(/\0/,'')
110115
print_good("Found target domain: " + domain)
111116
break
112117
end
113-
}
118+
end
114119

115120
rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
116121
print_error("#{msg} HTTP Connection Failed, Aborting")

0 commit comments

Comments
 (0)