-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrap.py
28 lines (28 loc) · 1.13 KB
/
scrap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
import base64
from Wappalyzer import Wappalyzer, WebPage
import warnings
warnings.filterwarnings("ignore", message="""Caught 'unbalanced parenthesis at position 119' compiling regex""", category=UserWarning )
import requests.structures as struc
import json
class scrap():
def __init__(self,httpResponse,httpResponseHeaders,url):
self.httpResponse=httpResponse
self.httpResponseHeader=json.loads(httpResponseHeaders)
self.httpResponseHeaderNoCaseSens=struc.CaseInsensitiveDict([])
self.httpResponseHeaderNoCaseSens.update(self.httpResponseHeader)
self.url=url
#webpage = WebPage.new_from_url('https://www.facebook.com')
def getTech(self):
httpResponse=WebPage(self.url,self.httpResponse,self.httpResponseHeaderNoCaseSens)
tech=Wappalyzer.latest().analyze(httpResponse)
return tech
def main():
message_bytes = base64.b64decode(sys.argv[1])
headers_bytes=sys.argv[2]
url=base64.b64decode(sys.argv[3])
stream = scrap(message_bytes.decode('ascii'),headers_bytes,url)
output = stream.getTech()
print(output)
if __name__ == "__main__":
main()