from plugins.plugin import Plugin from plugins.Inject import Inject from pprint import pformat import logging 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"] has_opts = False req_root = 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) logging.info("%s >> Browser Profiler data:\n%s" % (request.client.getClientIP(), pretty_output)) def get_payload(self): payload = """""" return payload