Skip to content

Commit 1e29bef

Browse files
committed
Fix msftidy warnings
1 parent 04bf0b4 commit 1e29bef

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

modules/auxiliary/admin/smb/check_dir_file.rb

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def initialize
3434
'Author' =>
3535
[
3636
'patrick',
37-
'j0hn__f'
37+
'j0hn__f'
3838
],
3939
'References' =>
4040
[
@@ -50,26 +50,24 @@ def initialize
5050
end
5151

5252
def run_host(ip)
53-
5453
vprint_status("Connecting to the server...")
5554

5655
begin
57-
connect()
58-
smb_login()
56+
connect
57+
smb_login
5958

6059
vprint_status("Mounting the remote share \\\\#{datastore['RHOST']}\\#{datastore['SMBSHARE']}'...")
6160
self.simple.connect("\\\\#{rhost}\\#{datastore['SMBSHARE']}")
6261
vprint_status("Checking for file/folder #{datastore['RPATH']}...")
6362

6463
datastore['RPATH'].each_line do |path|
64+
path.chomp!
6565

6666
begin
67-
6867
if (fd = simple.open("\\#{path.chomp}", 'o')) # mode is open only - do not create/append/write etc
6968
print_good("File FOUND: \\\\#{rhost}\\#{datastore['SMBSHARE']}\\#{path}")
7069
fd.close
7170
end
72-
7371
rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e
7472
case e.get_error(e.error_code)
7573
when "STATUS_FILE_IS_A_DIRECTORY"
@@ -91,14 +89,12 @@ def run_host(ip)
9189
end
9290
end
9391
end #end do
94-
95-
rescue ::Rex::HostUnreachable
96-
vprint_error("Host #{rhost} offline.")
97-
rescue ::Rex::Proto::SMB::Exceptions::LoginError
98-
print_error("Host #{rhost} login error.")
99-
rescue ::Rex::ConnectionRefused
100-
print_error "Host #{rhost} unable to connect - connection refused"
101-
92+
rescue ::Rex::HostUnreachable
93+
vprint_error("Host #{rhost} offline.")
94+
rescue ::Rex::Proto::SMB::Exceptions::LoginError
95+
print_error("Host #{rhost} login error.")
96+
rescue ::Rex::ConnectionRefused
97+
print_error "Host #{rhost} unable to connect - connection refused"
10298
end # end begin
10399
end # end def
104100
end

0 commit comments

Comments
 (0)