Skip to content

Commit ebce415

Browse files
committed
Land rapid7#5507, Update nessus_xmlrpc_logic to use the new creds API
2 parents 17b8ddc + c20cf15 commit ebce415

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

modules/auxiliary/scanner/nessus/nessus_xmlrpc_login.rb

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,45 @@ def do_login(user='nessus', pass='nessus')
9999

100100
if res.code == 200
101101
if res.body =~ /<status>OK<\/status>/
102-
print_good("SUCCESSFUL LOGIN. '#{user}' : '#{pass}'")
103-
104-
report_hash = {
105-
:host => datastore['RHOST'],
106-
:port => datastore['RPORT'],
107-
:sname => 'nessus-xmlrpc',
108-
:user => user,
109-
:pass => pass,
110-
:active => true,
111-
:type => 'password'}
112-
113-
report_auth_info(report_hash)
102+
print_good("SUCCESSFUL LOGIN. '#{user}':'#{pass}'")
103+
report_cred(
104+
ip: datastore['RHOST'],
105+
port: datastore['RPORT'],
106+
service_name: 'nessus-xmlrpc',
107+
user: user,
108+
password: pass
109+
)
114110
return :next_user
115111
end
116112
end
117-
vprint_error("FAILED LOGIN. '#{user}' : '#{pass}'")
113+
vprint_error("FAILED LOGIN. '#{user}':'#{pass}'")
118114
return :skip_pass
119115
end
116+
117+
def report_cred(opts)
118+
service_data = {
119+
address: opts[:ip],
120+
port: opts[:port],
121+
service_name: opts[:service_name],
122+
protocol: 'tcp',
123+
workspace_id: myworkspace_id
124+
}
125+
126+
credential_data = {
127+
origin_type: :service,
128+
module_fullname: fullname,
129+
username: opts[:user],
130+
private_data: opts[:password],
131+
private_type: :password
132+
}.merge(service_data)
133+
134+
login_data = {
135+
last_attempted_at: DateTime.now,
136+
core: create_credential(credential_data),
137+
status: Metasploit::Model::Login::Status::SUCCESSFUL,
138+
}.merge(service_data)
139+
140+
create_credential_login(login_data)
141+
end
142+
120143
end

0 commit comments

Comments
 (0)