@@ -34,7 +34,7 @@ def initialize
34
34
'Author' =>
35
35
[
36
36
'patrick' ,
37
- 'j0hn__f'
37
+ 'j0hn__f'
38
38
] ,
39
39
'References' =>
40
40
[
@@ -50,26 +50,24 @@ def initialize
50
50
end
51
51
52
52
def run_host ( ip )
53
-
54
53
vprint_status ( "Connecting to the server..." )
55
54
56
55
begin
57
- connect ( )
58
- smb_login ( )
56
+ connect
57
+ smb_login
59
58
60
59
vprint_status ( "Mounting the remote share \\ \\ #{ datastore [ 'RHOST' ] } \\ #{ datastore [ 'SMBSHARE' ] } '..." )
61
60
self . simple . connect ( "\\ \\ #{ rhost } \\ #{ datastore [ 'SMBSHARE' ] } " )
62
61
vprint_status ( "Checking for file/folder #{ datastore [ 'RPATH' ] } ..." )
63
62
64
63
datastore [ 'RPATH' ] . each_line do |path |
64
+ path . chomp!
65
65
66
66
begin
67
-
68
67
if ( fd = simple . open ( "\\ #{ path . chomp } " , 'o' ) ) # mode is open only - do not create/append/write etc
69
68
print_good ( "File FOUND: \\ \\ #{ rhost } \\ #{ datastore [ 'SMBSHARE' ] } \\ #{ path } " )
70
69
fd . close
71
70
end
72
-
73
71
rescue ::Rex ::Proto ::SMB ::Exceptions ::ErrorCode => e
74
72
case e . get_error ( e . error_code )
75
73
when "STATUS_FILE_IS_A_DIRECTORY"
@@ -91,14 +89,12 @@ def run_host(ip)
91
89
end
92
90
end
93
91
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"
102
98
end # end begin
103
99
end # end def
104
100
end
0 commit comments