From be17fbbec2ec1f10d2eb7102a923eb01f8a0d905 Mon Sep 17 00:00:00 2001 From: Perchouli Date: Wed, 26 Mar 2014 18:55:39 +0800 Subject: [PATCH 1/2] Fix path to wappalyzer.js; use requests instead of urllib --- drivers/python/wappalyzer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/python/wappalyzer.py b/drivers/python/wappalyzer.py index 15d048be8..4364b4530 100755 --- a/drivers/python/wappalyzer.py +++ b/drivers/python/wappalyzer.py @@ -4,7 +4,7 @@ import os import sys import PyV8 -import urllib +import requests from urlparse import urlparse try: @@ -30,7 +30,7 @@ class Wappalyzer(object): ctxt = PyV8.JSContext() ctxt.enter() - f1 = open(os.path.join(self.file_dir, '../php/js/wappalyzer.js')) + f1 = open(os.path.join(self.file_dir, '../../share/js/wappalyzer.js')) f2 = open(os.path.join(self.file_dir, '../php/js/driver.js')) ctxt.eval(f1.read()) ctxt.eval(f2.read()) @@ -38,7 +38,7 @@ class Wappalyzer(object): f2.close() host = urlparse(self.url).hostname - html = urllib.urlopen(self.url).read() + html = requests.get(self.url).text data = {'host': host, 'url': self.url, 'html': html, 'headers': {}} apps = json.dumps(self.apps) From dfafb030404c25345b0878305e4afc1b238793bc Mon Sep 17 00:00:00 2001 From: Perchouli Date: Thu, 27 Mar 2014 09:23:04 +0800 Subject: [PATCH 2/2] Use link.sh; Add header analysis; #477 --- drivers/python/wappalyzer.py | 10 ++++++---- links.sh | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/python/wappalyzer.py b/drivers/python/wappalyzer.py index 4364b4530..a6f1f6c42 100755 --- a/drivers/python/wappalyzer.py +++ b/drivers/python/wappalyzer.py @@ -18,7 +18,7 @@ class Wappalyzer(object): def __init__(self, url): self.file_dir = os.path.dirname(__file__) - f = open(os.path.join(self.file_dir, '../../share/apps.json')) + f = open(os.path.join(self.file_dir, 'apps.json')) data = json.loads(f.read()) f.close() @@ -30,7 +30,7 @@ class Wappalyzer(object): ctxt = PyV8.JSContext() ctxt.enter() - f1 = open(os.path.join(self.file_dir, '../../share/js/wappalyzer.js')) + f1 = open(os.path.join(self.file_dir, 'js/wappalyzer.js')) f2 = open(os.path.join(self.file_dir, '../php/js/driver.js')) ctxt.eval(f1.read()) ctxt.eval(f2.read()) @@ -38,9 +38,11 @@ class Wappalyzer(object): f2.close() host = urlparse(self.url).hostname - html = requests.get(self.url).text + response = requests.get(self.url) + html = response.text + headers = dict(response.headers) - data = {'host': host, 'url': self.url, 'html': html, 'headers': {}} + data = {'host': host, 'url': self.url, 'html': html, 'headers': headers} apps = json.dumps(self.apps) categories = json.dumps(self.categories) return ctxt.eval("w.apps = %s; w.categories = %s; w.driver.data = %s; w.driver.init();" % (apps, categories, json.dumps(data))) diff --git a/links.sh b/links.sh index 33b05ae01..37b941b60 100755 --- a/links.sh +++ b/links.sh @@ -22,3 +22,9 @@ ln -f share/js/wappalyzer.js drivers/html/js ln -f share/apps.json drivers/php ln -f share/js/wappalyzer.js drivers/php/js + +ln -f share/apps.json drivers/python +if [ ! -d "drivers/python/js" ];then + mkdir drivers/python/js/ +fi +ln -f share/js/wappalyzer.js drivers/python/js \ No newline at end of file