updates file read to close file more quickly

bug/bundler_fix
Joshua Smith 2014-03-21 14:53:15 -04:00
parent aa26405c23
commit 312f117262
1 changed files with 10 additions and 12 deletions

View File

@ -20,7 +20,7 @@ class Metasploit3 < Msf::Auxiliary
is sent to enumerate a a type 2 message from the target server. The type
2 message is then parsed for information such as the Active Directory
domain and NetBIOS name. A single URI can be specified with TARGET_URI
or a file or URIs can be specified with TARGET_URIS_FILE (default).
and/or a file of URIs can be specified with TARGET_URIS_FILE (default).
},
'Author' => 'Brandon Knight',
'License' => MSF_LICENSE
@ -28,7 +28,8 @@ class Metasploit3 < Msf::Auxiliary
register_options(
[
OptString.new('TARGET_URI', [ false, "Single target URI", nil]),
OptPath.new('TARGET_URIS_FILE', [ false, "Path to list of URIs to request", File.join(Msf::Config.data_directory, "wordlists", "http_owa_common.txt")]),
OptPath.new('TARGET_URIS_FILE', [ false, "Path to list of URIs to request",
File.join(Msf::Config.data_directory, "wordlists", "http_owa_common.txt")]),
], self.class)
end
@ -36,23 +37,20 @@ class Metasploit3 < Msf::Auxiliary
if datastore['TARGET_URI']
test_path = normalize_uri(datastore['TARGET_URI'])
result = check_url(test_path)
if result
handle_result(test_path, result)
return
end
handle_result(test_path, result) if result
end
if (datastore['TARGET_URIS_FILE'] && !datastore['TARGET_URIS_FILE'].blank?)
File.open(datastore['TARGET_URIS_FILE'], 'rb').each_line do |line|
test_uri = line.chomp
test_uris = []
File.open(datastore['TARGET_URIS_FILE'], 'rb') { |f| test_uris = f.lines }
test_uris.each do |test_uri|
test_uri.chomp!
test_path = normalize_uri(test_uri)
result = check_url(test_path)
if result
handle_result(test_path, result)
return
end
handle_result(test_path, result) if result
end
elsif not datastore['TARGET_URI']
print_error("Either TARGET_URI or TARGET_URIS_FILE must be specified.")
false # could return something more meaningful if we had a constant like
end
end