From 2dc1dd4f1260c34d168d25c0b387980ca3a2b247 Mon Sep 17 00:00:00 2001 From: byt3bl33d3r Date: Wed, 8 Jun 2016 23:39:58 -0600 Subject: [PATCH] Hold on to your butts cause here we go. This should resolve: * Issue #307 * Issue #309 * Issue #302 * Issue #294 Apperently, Twisted made some fairly heavy API changes in their 16.x release which kinda fucked all the plugins up. --- plugins/filepwn.py | 10 +++++----- plugins/imagerandomizer.py | 2 +- plugins/inject.py | 6 +++--- plugins/replace.py | 2 +- plugins/smbtrap.py | 4 ++-- plugins/upsidedownternet.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/filepwn.py b/plugins/filepwn.py index 83d947c..571d5ed 100644 --- a/plugins/filepwn.py +++ b/plugins/filepwn.py @@ -611,14 +611,14 @@ class FilePwn(Plugin): def response(self, response, request, data): - content_header = response.headers['content-type'] + content_header = response.responseHeaders.getRawHeaders('Content-Type')[0] client_ip = request.client.getClientIP() host = request.headers['host'] - try: - content_length = int(response.headers['content-length']) - except KeyError: - content_length = None + if not response.responseHeaders.hasHeader('content-length'): + content_length = None + else: + content_length = int(response.responseHeaders.getRawHeaders('content-length')[0]) for target in self.user_config['targets'].keys(): if target == 'ALL': diff --git a/plugins/imagerandomizer.py b/plugins/imagerandomizer.py index 4060720..268123a 100644 --- a/plugins/imagerandomizer.py +++ b/plugins/imagerandomizer.py @@ -35,7 +35,7 @@ class ImageRandomizer(Plugin): if request.isImageRequest: request.isImageRequest = False request.isImage = True - self.imageType = response.headers['content-type'].split('/')[1].upper() + self.imageType = response.responseHeaders.getRawHeaders('content-type')[0].split('/')[1].upper() def response(self, response, request, data): try: diff --git a/plugins/inject.py b/plugins/inject.py index bc7ca9c..b71218c 100644 --- a/plugins/inject.py +++ b/plugins/inject.py @@ -61,11 +61,11 @@ class Inject(Plugin): ip = response.getClientIP() hn = response.getRequestHostname() - try: - mime = response.headers['Content-Type'] - except KeyError: + if not response.responseHeaders.hasHeader('Content-Type'): return {'response': response, 'request':request, 'data': data} + mime = response.responseHeaders.getRawHeaders('Content-Type')[0] + if "text/html" not in mime: return {'response': response, 'request':request, 'data': data} diff --git a/plugins/replace.py b/plugins/replace.py index 47e5f9f..d5339b2 100644 --- a/plugins/replace.py +++ b/plugins/replace.py @@ -35,7 +35,7 @@ class Replace(Plugin): self.options = options def response(self, response, request, data): - mime = response.headers['Content-Type'] + mime = response.responseHeaders.getRawHeaders('Content-Type')[0] hn = response.getRequestHostname() if "text/html" in mime: diff --git a/plugins/smbtrap.py b/plugins/smbtrap.py index ceec87f..8e8ca03 100644 --- a/plugins/smbtrap.py +++ b/plugins/smbtrap.py @@ -33,6 +33,6 @@ class SMBTrap(Plugin): return {"request": request, "version": version, "code": 302, "message": "Found"} def responseheaders(self, response, request): - self.clientlog.info("Trapping request to {}".format(request.headers['host'])) + self.clientlog.info("Trapping request to {}".format(request.headers['host']), extra=request.clientInfo) rand_path = ''.join(random.sample(string.ascii_uppercase + string.digits, 8)) - response.headers["Location"] = "file://{}/{}".format(self.ip, rand_path) + response.responseHeaders.setRawHeaders('Location', ["file://{}/{}".format(self.ip, rand_path)]) diff --git a/plugins/upsidedownternet.py b/plugins/upsidedownternet.py index 71579b9..a293dd1 100644 --- a/plugins/upsidedownternet.py +++ b/plugins/upsidedownternet.py @@ -34,7 +34,7 @@ class Upsidedownternet(Plugin): if request.isImageRequest: request.isImageRequest = False request.isImage = True - self.imageType = response.headers['content-type'].split('/')[1].upper() + self.imageType = response.responseHeaders.getRawHeaders('content-type')[0].split('/')[1].upper() def response(self, response, request, data): try: