Skip to content

Commit 29b6198

Browse files
committed
Update to use correctly joined path
1 parent a7dc0b9 commit 29b6198

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

modules/post/multi/gather/lastpass_creds.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def build_account_map
164164
end
165165
end
166166

167-
#found_dbs_map.delete_if { |account, browser_map paths.empty? }
168167
found_dbs_map
169168
end
170169

@@ -220,23 +219,25 @@ def user_profiles
220219
def file_paths(path, browser, account)
221220
found_dbs_paths = []
222221

222+
files = []
223223
if directory?(path)
224+
sep = session.platform =~ /win/ ? '\\' : '/'
224225
if session.type == "meterpreter"
225226
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
229227
elsif session.type == "shell"
230228
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
234229
else
235230
print_error "Session type not recognized: #{session.type}"
236231
return found_dbs_paths
237232
end
238233
end
239234

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+
240241
found_dbs_paths
241242
end
242243

@@ -245,6 +246,7 @@ def firefox_profile_files(path, browser)
245246
found_dbs_paths = []
246247

247248
if directory?(path)
249+
sep = session.platform =~ /win/ ? '\\' : '/'
248250
if session.type == "meterpreter"
249251
files = client.fs.dir.entries(path)
250252
elsif session.type == "shell"
@@ -256,7 +258,7 @@ def firefox_profile_files(path, browser)
256258

257259
files.reject! { |file| %w(. ..).include?(file) }
258260
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/)
260262
end
261263
end
262264

0 commit comments

Comments
 (0)