From 8c359f5f7fbd1c8177cd2b2e812d65a81d5a07d7 Mon Sep 17 00:00:00 2001 From: mb Date: Mon, 14 Jan 2019 01:59:41 +0100 Subject: [PATCH] Py-collaborator bugfixes and improvements. --- web/py-collaborator/py-collaborator-mitmproxy-addon.py | 5 +++-- web/py-collaborator/py-collaborator-server.py | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web/py-collaborator/py-collaborator-mitmproxy-addon.py b/web/py-collaborator/py-collaborator-mitmproxy-addon.py index c400018..189cbf3 100644 --- a/web/py-collaborator/py-collaborator-mitmproxy-addon.py +++ b/web/py-collaborator/py-collaborator-mitmproxy-addon.py @@ -22,7 +22,8 @@ VERSION = '0.1' # Must point to JSON file containing configuration mentioned in `config` dictionary below. # One can either supply that configuration file, or let the below variable empty and fill the `config` # dictionary instead. -CONFIGURATION_FILE = 'config.json' +CONFIGURATION_FILE = '..\\py-collaborator\\config.json' +CONFIGURATION_FILE = '/mnt/d/dev2/py-collaborator/config.json' config = { 'debug' : False, @@ -230,7 +231,7 @@ class PyCollaboratorMitmproxyAddon: requestData+= 'Accept: */*\r\n' requestData+= 'Connection: close\r\n' - self.saveRequestForCorrelation(self.request, pingback, uuid, 'Overridden Host header ({} -> GET /{} )'.format(self.request.headers['Host'], pingback)) + self.saveRequestForCorrelation(self.request, pingback, uuid, 'Overridden Host header ({} -> GET {} )'.format(self.request.headers['Host'], pingback)) PyCollaboratorMitmproxyAddon.sendRawRequest(self.request, requestData) ctx.log.info('(2) Re-sent host overriding request ({} -> {})'.format(self.request.path, pingback)) diff --git a/web/py-collaborator/py-collaborator-server.py b/web/py-collaborator/py-collaborator-server.py index b113afa..a3fa4a4 100644 --- a/web/py-collaborator/py-collaborator-server.py +++ b/web/py-collaborator/py-collaborator-server.py @@ -65,8 +65,8 @@ class PingbackServer(BaseHTTPRequestHandler): Logger.dbg('Failure along __init__ of BaseHTTPRequestHandler: {}'.format(str(e))) raise - Logger.info('Previously catched pingbacks:\n--------------------------\n') - self.presentAtStart() + #Logger.info('Previously catched pingbacks:\n--------------------------\n') + #self.presentAtStart() def presentAtStart(self): rows = databaseInstance.query(f'SELECT * FROM calledbacks') @@ -178,12 +178,14 @@ The payload was sent at ({record['sent']}) and received on ({now}). def do_GET(self): if not (self.client_address[0] in config['exclude-pingbacks-from-clients']): if config['debug']: - Logger.dbg('Incoming HTTP request from {}: {} {}'.format( + Logger.dbg('--------------------------\nIncoming HTTP request from {}: {} {}'.format( self.client_address[0], self.method, self.path[:25] )) + Logger.dbg(PingbackServer.requestToString(self) + '\n') + (where, uuid) = PingbackServer.extractUuid(self) if uuid: self.checkUuid(where, uuid)