Skip to content

Commit a6ce629

Browse files
committed
Capture a 0xC00000BB condition, plus some other fixes
1 parent 3e229fe commit a6ce629

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

modules/auxiliary/scanner/smb/smb_enumshares.rb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,20 @@ def get_os_info(ip, rport)
170170
def lanman_netshareenum(ip, rport, info)
171171
shares = []
172172

173-
res = self.simple.client.trans(
174-
"\\PIPE\\LANMAN",
175-
(
176-
[0x00].pack('v') +
177-
"WrLeh\x00" +
178-
"B13BWz\x00" +
179-
[0x01, 65406].pack("vv")
180-
))
173+
begin
174+
res = self.simple.client.trans(
175+
"\\PIPE\\LANMAN",
176+
(
177+
[0x00].pack('v') +
178+
"WrLeh\x00" +
179+
"B13BWz\x00" +
180+
[0x01, 65406].pack("vv")
181+
))
182+
rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e
183+
if e.error_code == 0xC00000BB
184+
return srvsvc_netshareenum(ip)
185+
end
186+
end
181187

182188
lerror, lconv, lentries, lcount = res['Payload'].to_s[
183189
res['Payload'].v['ParamOffset'],
@@ -325,13 +331,13 @@ def cleanup
325331
datastore['SMBDirect'] = @smb_redirect
326332
end
327333

334+
328335
def run_host(ip)
329336
@rport = datastore['RPORT']
330337
@smb_redirect = datastore['SMBDirect']
331338
shares = []
332339

333340
[[139, false], [445, true]].each do |info|
334-
print_warning("Options modified: RPORT=#{info[0]}, SMBDirect=#{info[1]}")
335341
datastore['RPORT'] = info[0]
336342
datastore['SMBDirect'] = info[1]
337343

0 commit comments

Comments
 (0)