Refactor check_path
parent
1e29bef51b
commit
85b5c5a691
|
@ -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.")
|
||||
|
|
Loading…
Reference in New Issue