Skip to content

Commit 8f4a44a

Browse files
committed
Land rapid7#5474, @wchen-r7 Updates pptpd_chap_secrets to use the new cred API
2 parents ae21b0c + 39d38f1 commit 8f4a44a

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

modules/post/linux/gather/pptpd_chap_secrets.rb

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,34 @@ def load_file(fname)
5353
end
5454

5555

56+
def report_cred(opts)
57+
service_data = {
58+
address: opts[:ip],
59+
port: opts[:port],
60+
service_name: opts[:service_name],
61+
protocol: 'tcp',
62+
workspace_id: myworkspace_id
63+
}
64+
65+
credential_data = {
66+
module_fullname: fullname,
67+
post_reference_name: self.refname,
68+
session_id: session_db_id,
69+
origin_type: :session,
70+
private_data: opts[:password],
71+
private_type: :password,
72+
username: opts[:user]
73+
}.merge(service_data)
74+
75+
login_data = {
76+
core: create_credential(credential_data),
77+
status: Metasploit::Model::Login::Status::UNTRIED,
78+
}.merge(service_data)
79+
80+
create_credential_login(login_data)
81+
end
82+
83+
5684
#
5785
# Extracts client, server, secret, and IP addresses
5886
#
@@ -77,15 +105,14 @@ def extract_secrets(data)
77105
secret = (found[2] || '').strip
78106
ip = (found[3,found.length] * ", " || '').strip
79107

80-
report_auth_info({
81-
:host => session.session_host,
82-
:port => 1723, #PPTP port
83-
:sname => 'pptp',
84-
:user => client,
85-
:pass => secret,
86-
:type => 'password',
87-
:active => true
88-
})
108+
report_cred(
109+
ip: session.session_host,
110+
port: 1723, # PPTP port
111+
service_name: 'pptp',
112+
user: client,
113+
password: secret,
114+
115+
)
89116

90117
tbl << [client, server, secret, ip]
91118
end

0 commit comments

Comments
 (0)