Skip to content

Commit 51237a2

Browse files
author
Patrick Meenan
authored
Merge pull request #444 from pmeenan/wappalyzer-2021-10-19
Update Wappalyzer
2 parents 31e64fb + ccb502a commit 51237a2

35 files changed

+32674
-27861
lines changed

internal/devtools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,13 +879,15 @@ def send_command(self, method, params, wait=False, timeout=10, target_id=None):
879879
if wait:
880880
self.pending_commands.append(command_id)
881881
end_time = monotonic() + timeout
882-
self.send_command('Target.sendMessageToTarget',
882+
target_response = self.send_command('Target.sendMessageToTarget',
883883
{'targetId': target_id, 'message': json.dumps(msg)},
884884
wait=wait, timeout=timeout)
885885
if wait:
886886
if command_id in self.command_responses:
887887
ret = self.command_responses[command_id]
888888
del self.command_responses[command_id]
889+
elif target_response is None or 'error' in target_response:
890+
ret = target_response
889891
else:
890892
while ret is None and monotonic() < end_time:
891893
try:

internal/devtools_browser.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -988,10 +988,14 @@ def wappalyzer_script(self, response_headers, cookies):
988988
with open(os.path.join(self.support_path, 'Wappalyzer', 'wappalyzer.js')) as f_in:
989989
wappalyzer = f_in.read()
990990
if wappalyzer is not None:
991-
json_data = None
992-
with open(os.path.join(self.support_path, 'Wappalyzer', 'technologies.json')) as f_in:
993-
json_data = f_in.read()
994-
if json is not None:
991+
technologies = {}
992+
categories = {}
993+
with io.open(os.path.join(self.support_path, 'Wappalyzer', 'categories.json'), 'r', encoding='utf-8') as f_in:
994+
categories = json.load(f_in)
995+
for filename in sorted(glob.glob(os.path.join(self.support_path, 'Wappalyzer', 'technologies', '*.json'))):
996+
with io.open(filename, 'r', encoding='utf-8') as f_in:
997+
technologies.update(json.load(f_in))
998+
if technologies and categories:
995999
# Format the headers as a dictionary of lists
9961000
headers = {}
9971001
if response_headers is not None:
@@ -1017,9 +1021,10 @@ def wappalyzer_script(self, response_headers, cookies):
10171021
headers[key] = []
10181022
headers[key].append(value)
10191023
script = script.replace('%WAPPALYZER%', wappalyzer)
1020-
script = script.replace('%JSON%', json_data)
10211024
script = script.replace('%COOKIES%', json.dumps(cookies))
10221025
script = script.replace('%RESPONSE_HEADERS%', json.dumps(headers))
1026+
script = script.replace('%CATEGORIES%', json.dumps(categories))
1027+
script = script.replace('%TECHNOLOGIES%', json.dumps(technologies))
10231028
except Exception:
10241029
logging.exception('Error building wappalyzer script')
10251030
return script

0 commit comments

Comments
 (0)