File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
modules/auxiliary/admin/smb Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -138,10 +138,11 @@ def get_output(file)
138
138
def exclusive_access ( *files )
139
139
begin
140
140
simple . connect ( "\\ \\ #{ @ip } \\ #{ @smbshare } " )
141
- rescue
141
+ rescue Rex ::Proto ::SMB ::Exceptions ::ErrorCode => accesserror
142
+ print_status ( "Unable to get handle: #{ accesserror } " )
142
143
return false
143
144
end
144
- files . each do |file |
145
+ files . each do |file |
145
146
begin
146
147
print_status ( "checking if the file is unlocked" )
147
148
fd = smb_open ( file , 'rwo' )
@@ -154,14 +155,14 @@ def exclusive_access(*files)
154
155
end
155
156
return true
156
157
end
157
-
158
-
158
+
159
+
159
160
# Removes files created during execution.
160
161
def cleanup_after ( *files )
161
162
begin
162
163
simple . connect ( "\\ \\ #{ @ip } \\ #{ @smbshare } " )
163
- rescue
164
- print_error ( "Unable to connect for cleanup. Maybe you'll need to manually remove #{ left . join ( ", " ) } from the target." )
164
+ rescue Rex :: Proto :: SMB :: Exceptions :: ErrorCode => accesserror
165
+ print_error ( "Unable to connect for cleanup: #{ accesserror } . Maybe you'll need to manually remove #{ left . join ( ", " ) } from the target." )
165
166
return
166
167
end
167
168
print_status ( "Executing cleanup..." )
You can’t perform that action at this time.
0 commit comments