Skip to content

Commit be2739d

Browse files
author
Erik Lenoir
committed
Transform loots into creds
1 parent cde319a commit be2739d

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

documentation/modules/post/multi/gather/maven_creds.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ msf post(maven_creds) > run
3232
[*] Id: server-nexus
3333
[*] Username: deploynexus
3434
[*] Password: password
35-
[+] Saved credentials to /home/user/.msf4/loot/20170814145812_default_127.0.0.1_maven.credential_351922.txt
3635
37-
msf post(maven_creds) > loot
36+
msf post(maven_creds) > creds
3837
39-
Loot
40-
====
41-
42-
host service type name content info path
43-
---- ------- ---- ---- ------- ---- ----
44-
127.0.0.1 maven.credentials settings.xml text/plain Maven credentials from /home/user/settings.xml and id server-nexus /home/user/.msf4/loot/20170814145812_default_127.0.0.1_maven.credential_351922.txt
38+
Credentials
39+
===========
4540
41+
host origin service public private realm private_type
42+
---- ------ ------- ------ ------- ----- ------------
43+
deploynexus password server-nexus Password

modules/post/multi/gather/maven_creds.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def initialize(info={})
1919
},
2020
'License' => MSF_LICENSE,
2121
'Author' => ['elenoir'],
22-
'Platform' => %w{ bsd linux osx unix },
22+
'Platform' => %w{ bsd linux osx unix win },
2323
'SessionTypes' => ['shell','meterpreter']
2424
))
2525
end
@@ -93,10 +93,21 @@ def parse_settings(target, data)
9393
print_status(" Id: %s" % id)
9494
print_status(" Username: %s" % username)
9595
print_status(" Password: %s" % password)
96-
loot_path = store_loot("maven.credentials", "text/plain", session, "#{username} #{password}",
97-
"settings.xml", "Maven credentials from #{target} and id #{id}")
98-
print_good("Saved credentials to #{loot_path}")
9996
print_line("")
97+
98+
credential_data = {
99+
origin_type: :import,
100+
module_fullname: self.fullname,
101+
filename: target,
102+
service_name: 'maven',
103+
realm_value: id,
104+
realm_key: Metasploit::Model::Realm::Key::WILDCARD,
105+
private_type: :password,
106+
private_data: password,
107+
username: username,
108+
workspace_id: myworkspace_id
109+
}
110+
create_credential(credential_data)
100111
end
101112
end
102113

0 commit comments

Comments
 (0)