@@ -28,8 +28,7 @@ def initialize(info={})
28
28
directories, files, time stamps, etc.
29
29
30
30
By default, a netshareenum request is done in order to retrieve share information,
31
- but if this fails, you may also fall back to SRVSVC. When SRVSVC is used, please
32
- note the module will not attempt to enumerate more info like netshareenum.
31
+ but if this fails, you may also fall back to SRVSVC.
33
32
} ,
34
33
'Author' =>
35
34
[
@@ -47,7 +46,7 @@ def initialize(info={})
47
46
register_options (
48
47
[
49
48
OptBool . new ( 'DIR_SHARE' , [ true , 'Show all the folders and files' , false ] ) ,
50
- OptBool . new ( 'USE_SRVSVC_ONLY' , [ true , 'List shares only with SRVSVC' , false ] )
49
+ OptBool . new ( 'USE_SRVSVC_ONLY' , [ true , 'List shares with SRVSVC' , false ] )
51
50
] , self . class )
52
51
53
52
deregister_options ( 'RPORT' , 'RHOST' )
@@ -79,13 +78,18 @@ def to_unix_time(thi, tlo)
79
78
80
79
def eval_host ( ip , share )
81
80
read = write = false
81
+
82
+ # srvsvc adds a null byte that needs to be removed
83
+ if datastore [ 'USE_SRVSVC_ONLY' ]
84
+ share = share [ 0 ..-2 ]
85
+ end
86
+
82
87
return false , false , nil , nil if share == 'IPC$'
83
88
84
89
self . simple . connect ( "\\ \\ #{ ip } \\ #{ share } " )
85
90
86
91
begin
87
92
device_type = self . simple . client . queryfs_fs_device [ 'device_type' ]
88
-
89
93
unless device_type
90
94
vprint_error ( "\\ \\ #{ ip } \\ #{ share } : Error querying filesystem device type" )
91
95
return false , false , nil , nil
@@ -373,7 +377,7 @@ def run_host(ip)
373
377
:update => :unique_data
374
378
)
375
379
376
- if datastore [ 'DIR_SHARE' ] and not datastore [ 'USE_SRVSVC_ONLY' ]
380
+ if datastore [ 'DIR_SHARE' ]
377
381
get_files_info ( ip , rport , shares , info )
378
382
end
379
383
0 commit comments