@@ -164,7 +164,6 @@ def build_account_map
164
164
end
165
165
end
166
166
167
- #found_dbs_map.delete_if { |account, browser_map paths.empty? }
168
167
found_dbs_map
169
168
end
170
169
@@ -220,23 +219,25 @@ def user_profiles
220
219
def file_paths ( path , browser , account )
221
220
found_dbs_paths = [ ]
222
221
222
+ files = [ ]
223
223
if directory? ( path )
224
+ sep = session . platform =~ /win/ ? '\\' : '/'
224
225
if session . type == "meterpreter"
225
226
files = client . fs . dir . entries ( path )
226
- files . each do |file_path |
227
- found_dbs_paths . push ( File . join ( path , file_path ) ) if file_path != '.' && file_path != '..'
228
- end
229
227
elsif session . type == "shell"
230
228
files = session . shell_command ( "ls \" #{ path } \" " ) . split
231
- files . each do |file_path |
232
- found_dbs_paths . push ( File . join ( path , file_path ) ) if file_path != 'Shared'
233
- end
234
229
else
235
230
print_error "Session type not recognized: #{ session . type } "
236
231
return found_dbs_paths
237
232
end
238
233
end
239
234
235
+ files . each do |file_path |
236
+ unless %w( . .. Shared ) . include? ( file_path )
237
+ found_dbs_paths . push ( [ path , file_path ] . join ( sep ) )
238
+ end
239
+ end
240
+
240
241
found_dbs_paths
241
242
end
242
243
@@ -245,6 +246,7 @@ def firefox_profile_files(path, browser)
245
246
found_dbs_paths = [ ]
246
247
247
248
if directory? ( path )
249
+ sep = session . platform =~ /win/ ? '\\' : '/'
248
250
if session . type == "meterpreter"
249
251
files = client . fs . dir . entries ( path )
250
252
elsif session . type == "shell"
@@ -256,7 +258,7 @@ def firefox_profile_files(path, browser)
256
258
257
259
files . reject! { |file | %w( . .. ) . include? ( file ) }
258
260
files . each do |file_path |
259
- found_dbs_paths . push ( File . join ( path , file_path , 'prefs.js' ) ) if file_path . match ( /.*\. default/ )
261
+ found_dbs_paths . push ( [ path , file_path , 'prefs.js' ] . join ( sep ) ) if file_path . match ( /.*\. default/ )
260
262
end
261
263
end
262
264
0 commit comments