Skip to content

Commit 4b10331

Browse files
committed
style fixups
1 parent f735a90 commit 4b10331

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

lib/rex/proto/http/client.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,26 +275,26 @@ def send_auth(res, opts, t, persist)
275275
# if several providers are available, the client may want one in particular
276276
preferred_auth = opts['preferred_auth']
277277

278-
if supported_auths.include? 'Basic' and (preferred_auth.nil? or preferred_auth == 'Basic')
278+
if supported_auths.include?('Basic') && (preferred_auth.nil? || preferred_auth == 'Basic')
279279
opts['headers'] ||= {}
280280
opts['headers']['Authorization'] = basic_auth_header(opts['username'],opts['password'] )
281281
req = request_cgi(opts)
282282
res = _send_recv(req,t,persist)
283283
return res
284-
elsif supported_auths.include? "Digest" and (preferred_auth.nil? or preferred_auth == 'Digest')
284+
elsif supported_auths.include?('Digest') && (preferred_auth.nil? || preferred_auth == 'Digest')
285285
temp_response = digest_auth(opts)
286286
if temp_response.kind_of? Rex::Proto::Http::Response
287287
res = temp_response
288288
end
289289
return res
290-
elsif supported_auths.include? "NTLM" and (preferred_auth.nil? or preferred_auth == 'NTLM')
290+
elsif supported_auths.include?('NTLM') && (preferred_auth.nil? || preferred_auth == 'NTLM')
291291
opts['provider'] = 'NTLM'
292292
temp_response = negotiate_auth(opts)
293293
if temp_response.kind_of? Rex::Proto::Http::Response
294294
res = temp_response
295295
end
296296
return res
297-
elsif supported_auths.include? "Negotiate" and (preferred_auth.nil? or preferred_auth == 'Negotiate')
297+
elsif supported_auths.include?('Negotiate') && (preferred_auth.nil? || preferred_auth == 'Negotiate')
298298
opts['provider'] = 'Negotiate'
299299
temp_response = negotiate_auth(opts)
300300
if temp_response.kind_of? Rex::Proto::Http::Response

modules/auxiliary/scanner/http/owa_ews_login.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def initialize
3131
[
3232
OptBool.new('AUTODISCOVER', [ false, "Automatically discover domain URI", true ]),
3333
OptString.new('AD_DOMAIN', [ false, "The Active Directory domain name", nil ]),
34-
OptString.new('TARGET_URI', [ false, "The location of the NTLM service", nil ]),
35-
OptInt.new('RPORT', [ true, "The target port", 443 ]),
34+
OptString.new('TARGETURI', [ false, "The location of the NTLM service", nil ]),
35+
OptInt.new('RPORT', [ true, "The target port", 443 ])
3636
], self.class)
3737
end
3838

@@ -46,18 +46,18 @@ def run_host(ip)
4646

4747
if datastore['AUTODISCOVER']
4848
domain, uri = autodiscover(cli)
49-
if domain and uri
49+
if domain && uri
5050
print_good("Found NTLM service at #{uri} for domain #{domain}.")
5151
else
5252
print_error("Failed to autodiscover - try manually")
5353
return
5454
end
55-
elsif datastore['AD_DOMAIN'] and datastore['TARGET_URI']
55+
elsif datastore['AD_DOMAIN'] && datastore['TARGETURI']
5656
domain = datastore['AD_DOMAIN']
57-
uri = datastore['TARGET_URI']
57+
uri = datastore['TARGETURI']
5858
uri << "/" unless uri.chars.last == "/"
5959
else
60-
print_error("You must set AD_DOMAIN and TARGET_URI if not using autodiscover.")
60+
print_error("You must set AD_DOMAIN and TARGETURI if not using autodiscover.")
6161
return
6262
end
6363

@@ -107,11 +107,11 @@ def run_host(ip)
107107

108108
def autodiscover(cli)
109109
uris = %w[ /ews/ /rpc/ /public/ ]
110-
uris.each do |u|
110+
uris.each do |uri|
111111
begin
112112
req = cli.request_raw({
113113
'encode' => true,
114-
'uri' => u,
114+
'uri' => uri,
115115
'method' => 'GET',
116116
'headers' => {'Authorization' => 'NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw=='}
117117
})
@@ -122,15 +122,15 @@ def autodiscover(cli)
122122
next
123123
end
124124

125-
if not res
125+
unless res
126126
print_error("HTTP Connection Timeout")
127127
next
128128
end
129129

130130
if res && res.code == 401 && res.headers.has_key?('WWW-Authenticate') && res.headers['WWW-Authenticate'].match(/^NTLM/i)
131131
hash = res['WWW-Authenticate'].split('NTLM ')[1]
132132
domain = Rex::Proto::NTLM::Message.parse(Rex::Text.decode_base64(hash))[:target_name].value().gsub(/\0/,'')
133-
return domain, u
133+
return domain, uri
134134
end
135135
end
136136

0 commit comments

Comments
 (0)