Skip to content

Commit 2972220

Browse files
author
Tod Beardsley
committed
Land rapid7#3047 for real.
Merge branch 'land-3047-really' into upstream-master
2 parents ec7bb6d + 7c8f79d commit 2972220

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

modules/auxiliary/scanner/http/ntlm_info_enumeration.rb

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,40 @@ def initialize
2020
is sent to enumerate a a type 2 message from the target server. The type
2121
2 message is then parsed for information such as the Active Directory
2222
domain and NetBIOS name. A single URI can be specified with TARGET_URI
23-
or a file or URIs can be specified with TARGET_URIS_FILE (default).
23+
and/or a file of URIs can be specified with TARGET_URIS_FILE (default).
2424
},
2525
'Author' => 'Brandon Knight',
2626
'License' => MSF_LICENSE
2727
)
2828
register_options(
2929
[
3030
OptString.new('TARGET_URI', [ false, "Single target URI", nil]),
31-
OptPath.new('TARGET_URIS_FILE', [ false, "Path to list of URIs to request", File.join(Msf::Config.data_directory, "wordlists", "http_owa_common.txt")]),
31+
OptPath.new('TARGET_URIS_FILE', [ false, "Path to list of URIs to request",
32+
File.join(Msf::Config.data_directory, "wordlists", "http_owa_common.txt")]),
3233
], self.class)
3334
end
3435

3536
def run_host(ip)
36-
if datastore['TARGET_URI']
37-
test_path = normalize_uri(datastore['TARGET_URI'])
38-
result = check_url(test_path)
39-
if result
40-
handle_result(test_path, result)
41-
return
42-
end
37+
test_uris = []
38+
turi = datastore['TARGET_URI']
39+
turis_file = datastore['TARGET_URIS_FILE']
40+
if (!turi && !turis_file)
41+
# can't simply return here as we'll print an error for each host
42+
fail_with "Either TARGET_URI or TARGET_URIS_FILE must be specified"
43+
end
44+
if (turi and !turi.blank?)
45+
test_uris << normalize_uri(turi)
4346
end
44-
if (datastore['TARGET_URIS_FILE'] && !datastore['TARGET_URIS_FILE'].blank?)
45-
File.open(datastore['TARGET_URIS_FILE'], 'rb').each_line do |line|
46-
test_uri = line.chomp
47-
test_path = normalize_uri(test_uri)
48-
result = check_url(test_path)
49-
if result
50-
handle_result(test_path, result)
51-
return
52-
end
47+
if (turis_file && !turis_file.blank?)
48+
File.open(turis_file, 'rb') { |f| test_uris += f.readlines }
49+
test_uris.collect! do |test_uri|
50+
normalize_uri(test_uri.chomp)
5351
end
54-
elsif not datastore['TARGET_URI']
55-
print_error("Either TARGET_URI or TARGET_URIS_FILE must be specified.")
52+
end
53+
test_uris.each do |test_path|
54+
result = check_url(test_path)
55+
# no need to try the other uris if one of them works.
56+
return handle_result(test_path, result) if result
5657
end
5758
end
5859

0 commit comments

Comments
 (0)