Refactor check_path

bug/bundler_fix
jvazquez-r7 2014-08-04 11:48:13 -05:00
parent 1e29bef51b
commit 85b5c5a691
1 changed files with 29 additions and 27 deletions

View File

@ -49,22 +49,9 @@ class Metasploit3 < Msf::Auxiliary
end
def run_host(ip)
vprint_status("Connecting to the server...")
def check_path(path)
begin
connect
smb_login
vprint_status("Mounting the remote share \\\\#{datastore['RHOST']}\\#{datastore['SMBSHARE']}'...")
self.simple.connect("\\\\#{rhost}\\#{datastore['SMBSHARE']}")
vprint_status("Checking for file/folder #{datastore['RPATH']}...")
datastore['RPATH'].each_line do |path|
path.chomp!
begin
if (fd = simple.open("\\#{path.chomp}", 'o')) # mode is open only - do not create/append/write etc
if (fd = simple.open("\\#{path}", 'o')) # mode is open only - do not create/append/write etc
print_good("File FOUND: \\\\#{rhost}\\#{datastore['SMBSHARE']}\\#{path}")
fd.close
end
@ -88,6 +75,21 @@ class Metasploit3 < Msf::Auxiliary
raise e
end
end
end
def run_host(ip)
vprint_status("Connecting to the server...")
begin
connect
smb_login
vprint_status("Mounting the remote share \\\\#{datastore['RHOST']}\\#{datastore['SMBSHARE']}'...")
self.simple.connect("\\\\#{rhost}\\#{datastore['SMBSHARE']}")
vprint_status("Checking for file/folder #{datastore['RPATH']}...")
datastore['RPATH'].each_line do |path|
check_path(path.chomp)
end #end do
rescue ::Rex::HostUnreachable
vprint_error("Host #{rhost} offline.")