Refactor pgpass_creds creds
parent
2c007846e4
commit
512395395b
|
@ -99,19 +99,30 @@ class Metasploit3 < Msf::Post
|
||||||
pass = p
|
pass = p
|
||||||
cred_table << [ip, port, db, user, pass]
|
cred_table << [ip, port, db, user, pass]
|
||||||
|
|
||||||
cred_hash = {
|
service_data = {
|
||||||
:host => session.session_host,
|
address: Rex::Socket.getaddress(session.session_host),
|
||||||
:port => port,
|
port: port,
|
||||||
:user => user,
|
protocol: "tcp",
|
||||||
:pass => pass,
|
service_name: "postgres",
|
||||||
:ptype => "password",
|
workspace_id: myworkspace_id
|
||||||
:sname => "postgres",
|
|
||||||
:source_type => "Cred",
|
|
||||||
:duplicate_ok => true,
|
|
||||||
:active => true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
report_auth_info(cred_hash)
|
credential_data = {
|
||||||
|
origin_type: :session,
|
||||||
|
session_id: session_db_id,
|
||||||
|
post_reference_name: self.refname,
|
||||||
|
username: user,
|
||||||
|
private_data: pass,
|
||||||
|
private_type: :password
|
||||||
|
}
|
||||||
|
|
||||||
|
credential_core = create_credential(credential_data.merge(service_data))
|
||||||
|
|
||||||
|
login_data = {
|
||||||
|
core: credential_core,
|
||||||
|
access_level: "User",
|
||||||
|
status: Metasploit::Credential::Login::Status::UNTRIED
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if not cred_table.rows.empty?
|
if not cred_table.rows.empty?
|
||||||
|
|
Loading…
Reference in New Issue