@@ -988,10 +988,14 @@ def wappalyzer_script(self, response_headers, cookies):
988
988
with open (os .path .join (self .support_path , 'Wappalyzer' , 'wappalyzer.js' )) as f_in :
989
989
wappalyzer = f_in .read ()
990
990
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 :
995
999
# Format the headers as a dictionary of lists
996
1000
headers = {}
997
1001
if response_headers is not None :
@@ -1017,9 +1021,10 @@ def wappalyzer_script(self, response_headers, cookies):
1017
1021
headers [key ] = []
1018
1022
headers [key ].append (value )
1019
1023
script = script .replace ('%WAPPALYZER%' , wappalyzer )
1020
- script = script .replace ('%JSON%' , json_data )
1021
1024
script = script .replace ('%COOKIES%' , json .dumps (cookies ))
1022
1025
script = script .replace ('%RESPONSE_HEADERS%' , json .dumps (headers ))
1026
+ script = script .replace ('%CATEGORIES%' , json .dumps (categories ))
1027
+ script = script .replace ('%TECHNOLOGIES%' , json .dumps (technologies ))
1023
1028
except Exception :
1024
1029
logging .exception ('Error building wappalyzer script' )
1025
1030
return script
0 commit comments