#!/usr/bin/env python2.7 # Copyright (c) 2014-2016 Marcello Salvati # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA # from plugins.plugin import Plugin from plugins.Inject import Inject from pprint import pformat import logging mitmf_logger = logging.getLogger('mitmf') class BrowserProfiler(Inject, Plugin): name = "Browser Profiler" optname = "browserprofiler" desc = "Attempts to enumerate all browser plugins of connected clients" implements = ["handleResponse", "handleHeader", "connectionMade", "sendPostData"] depends = ["Inject"] version = "0.2" has_opts = False def initialize(self, options): Inject.initialize(self, options) self.html_payload = self.get_payload() self.dic_output = {} # so other plugins can access the results def post2dict(self, post): #converts the ajax post to a dic dict = {} for line in post.split('&'): t = line.split('=') dict[t[0]] = t[1] return dict def sendPostData(self, request): #Handle the plugin output if 'clientprfl' in request.uri: self.dic_output = self.post2dict(request.postData) self.dic_output['ip'] = str(request.client.getClientIP()) # add the IP of the client if self.dic_output['plugin_list'] > 0: self.dic_output['plugin_list'] = self.dic_output['plugin_list'].split(',') pretty_output = pformat(self.dic_output) mitmf_logger.info("%s >> Browser Profiler data:\n%s" % (request.client.getClientIP(), pretty_output)) def get_payload(self): payload = """""" return payload