Py-collaborator bugfixes and improvements.

This commit is contained in:
mb 2019-01-14 01:59:41 +01:00
parent dc64fdd6b2
commit 8c359f5f7f
2 changed files with 8 additions and 5 deletions

View File

@ -22,7 +22,8 @@ VERSION = '0.1'
# Must point to JSON file containing configuration mentioned in `config` dictionary below. # 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` # One can either supply that configuration file, or let the below variable empty and fill the `config`
# dictionary instead. # dictionary instead.
CONFIGURATION_FILE = 'config.json' CONFIGURATION_FILE = '..\\py-collaborator\\config.json'
CONFIGURATION_FILE = '/mnt/d/dev2/py-collaborator/config.json'
config = { config = {
'debug' : False, 'debug' : False,
@ -230,7 +231,7 @@ class PyCollaboratorMitmproxyAddon:
requestData+= 'Accept: */*\r\n' requestData+= 'Accept: */*\r\n'
requestData+= 'Connection: close\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) PyCollaboratorMitmproxyAddon.sendRawRequest(self.request, requestData)
ctx.log.info('(2) Re-sent host overriding request ({} -> {})'.format(self.request.path, pingback)) ctx.log.info('(2) Re-sent host overriding request ({} -> {})'.format(self.request.path, pingback))

View File

@ -65,8 +65,8 @@ class PingbackServer(BaseHTTPRequestHandler):
Logger.dbg('Failure along __init__ of BaseHTTPRequestHandler: {}'.format(str(e))) Logger.dbg('Failure along __init__ of BaseHTTPRequestHandler: {}'.format(str(e)))
raise raise
Logger.info('Previously catched pingbacks:\n--------------------------\n') #Logger.info('Previously catched pingbacks:\n--------------------------\n')
self.presentAtStart() #self.presentAtStart()
def presentAtStart(self): def presentAtStart(self):
rows = databaseInstance.query(f'SELECT * FROM calledbacks') 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): def do_GET(self):
if not (self.client_address[0] in config['exclude-pingbacks-from-clients']): if not (self.client_address[0] in config['exclude-pingbacks-from-clients']):
if config['debug']: if config['debug']:
Logger.dbg('Incoming HTTP request from {}: {} {}'.format( Logger.dbg('--------------------------\nIncoming HTTP request from {}: {} {}'.format(
self.client_address[0], self.client_address[0],
self.method, self.method,
self.path[:25] self.path[:25]
)) ))
Logger.dbg(PingbackServer.requestToString(self) + '\n')
(where, uuid) = PingbackServer.extractUuid(self) (where, uuid) = PingbackServer.extractUuid(self)
if uuid: if uuid:
self.checkUuid(where, uuid) self.checkUuid(where, uuid)