@@ -46,7 +46,7 @@ def initialize(info={})
46
46
47
47
register_options (
48
48
[
49
- OptBool . new ( 'SHOW_SHARE ' , [ true , 'Show all the folders and files' , false ] ) ,
49
+ OptBool . new ( 'DIR_SHARE ' , [ true , 'Show all the folders and files' , false ] ) ,
50
50
OptBool . new ( 'USE_SRVSVC_ONLY' , [ true , 'List shares only with SRVSVC' , false ] )
51
51
] , self . class )
52
52
@@ -181,6 +181,8 @@ def lanman_netshareenum(ip, rport, info)
181
181
) )
182
182
rescue ::Rex ::Proto ::SMB ::Exceptions ::ErrorCode => e
183
183
if e . error_code == 0xC00000BB
184
+ vprint_error ( "Got 0xC00000BB while enumerating shares, switching to srvsvc..." )
185
+ datastore [ 'USE_SRVSVC_ONLY' ] = true # Make sure the module is aware of this state
184
186
return srvsvc_netshareenum ( ip )
185
187
end
186
188
end
@@ -327,14 +329,16 @@ def get_files_info(ip, rport, shares, info)
327
329
end
328
330
329
331
def cleanup
330
- datastore [ 'RPORT' ] = @rport
331
- datastore [ 'SMBDirect' ] = @smb_redirect
332
+ datastore [ 'RPORT' ] = @rport
333
+ datastore [ 'SMBDirect' ] = @smb_redirect
334
+ datastore [ 'USE_SRVSVC_ONLY' ] = @srvsvc
332
335
end
333
336
334
337
335
338
def run_host ( ip )
336
339
@rport = datastore [ 'RPORT' ]
337
340
@smb_redirect = datastore [ 'SMBDirect' ]
341
+ @srvsvc = datastore [ 'USE_SRVSVC_ONLY' ]
338
342
shares = [ ]
339
343
340
344
[ [ 139 , false ] , [ 445 , true ] ] . each do |info |
@@ -366,7 +370,7 @@ def run_host(ip)
366
370
:update => :unique_data
367
371
)
368
372
369
- if datastore [ 'SHOW_SHARE ' ] and not datastore [ 'USE_SRVSVC_ONLY' ]
373
+ if datastore [ 'DIR_SHARE ' ] and not datastore [ 'USE_SRVSVC_ONLY' ]
370
374
get_files_info ( ip , rport , shares , info )
371
375
end
372
376
0 commit comments