@@ -281,45 +281,41 @@ def srvsvc_netshareenum(ip)
281
281
shares
282
282
end
283
283
284
- def profile_options ( ip , share )
284
+ def get_user_dirs ( ip , share , base , sub_dirs )
285
+ dirs = [ ]
285
286
usernames = [ ]
286
- old_dirs = [ 'My Documents' , 'Desktop' ]
287
- new_dirs = [ 'Desktop' , 'Documents' , 'Downloads' , 'Music' , 'Pictures' , 'Videos' ]
288
- subdirs = [ ]
287
+
289
288
begin
290
- read , write , type , files = eval_host ( ip , share , "Documents and Settings" )
289
+ read , write , type , files = eval_host ( ip , share , base )
291
290
files . each do |f |
292
291
if f [ 0 ] != "." and f [ 0 ] != ".."
293
292
usernames . push ( f [ 0 ] )
294
293
end
295
294
end
296
-
297
- # Return usernames along with their profile directories.
298
295
usernames . each do |username |
299
- old_dirs . each do |dir |
300
- subdirs . push ( "Documents and Settings \\ #{ username } \\ #{ dir } " )
296
+ sub_dirs . each do |sub_dir |
297
+ dirs . push ( "#{ base } \\ #{ username } \\ #{ sub_dir } " )
301
298
end
302
299
end
300
+ return dirs
303
301
rescue
304
- read , write , type , files = eval_host ( ip , share , "Users" )
305
- files . each do |f |
306
- if f [ 0 ] != "." and f [ 0 ] != ".."
307
- usernames . push ( f [ 0 ] )
308
- end
309
- end
302
+ dirs = nil
303
+ return dirs
304
+ end
305
+ end
310
306
311
- # Return usernames along with their profile directories.
312
- usernames . each do |username |
313
- new_dirs . each do |dir |
314
- subdirs . push ( "Users\\ #{ username } \\ #{ dir } " )
315
- end
316
- end
307
+ def profile_options ( ip , share )
308
+ old_dirs = [ 'My Documents' , 'Desktop' ]
309
+ new_dirs = [ 'Desktop' , 'Documents' , 'Downloads' , 'Music' , 'Pictures' , 'Videos' ]
310
+
311
+ dirs = get_user_dirs ( ip , share , "Documents and Settings" , old_dirs )
312
+ if dirs == nil
313
+ dirs = get_user_dirs ( ip , share , "Users" , new_dirs )
317
314
end
318
- return subdirs
315
+ return dirs
319
316
end
320
317
321
318
def get_files_info ( ip , rport , shares , info )
322
-
323
319
read = false
324
320
write = false
325
321
@@ -334,7 +330,8 @@ def get_files_info(ip, rport, shares, info)
334
330
335
331
list = shares . collect { |e | e [ 0 ] }
336
332
list . each do |x |
337
- if x . strip == "ADMIN$"
333
+ x = x . strip
334
+ if x == "ADMIN$" or x == "IPC$"
338
335
next
339
336
end
340
337
if not datastore [ 'VERBOSE' ]
@@ -344,7 +341,6 @@ def get_files_info(ip, rport, shares, info)
344
341
if x . strip ( ) == "C$" and datastore [ 'SpiderProfiles' ]
345
342
subdirs = profile_options ( ip , x )
346
343
end
347
-
348
344
while subdirs . length > 0
349
345
depth = subdirs [ 0 ] . count ( "\\ " )
350
346
if datastore [ 'SpiderProfiles' ] and x == "C$"
@@ -370,9 +366,6 @@ def get_files_info(ip, rport, shares, info)
370
366
end
371
367
header << "\\ #{ x . sub ( "C$" , "C$\\ " ) } " if simple . client . default_name
372
368
header << subdirs [ 0 ]
373
- header << " (#{ type } )" if type
374
- header << " - Readable" if read
375
- header << " - Writable" if write
376
369
377
370
pretty_tbl = Rex ::Ui ::Text ::Table . new (
378
371
'Header' => header ,
0 commit comments