Uh oh!
There was an error while loading. Please reload this page.
forked from tennc/webshell
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.py
More file actions
Latest commit
60 lines (51 loc) · 1.74 KB
/
Copy pathproxy.py
File metadata and controls
60 lines (51 loc) · 1.74 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
# -*- coding:utf-8 -*-
importtime
importrandom
importrequests
importssl
fromurllib.parseimportunquote
#忽略证书校验
requests.packages.urllib3.disable_warnings()
try:
_create_unverified_https_context=ssl._create_unverified_context
exceptAttributeError:
pass
else:
ssl._create_default_https_context=_create_unverified_https_context
user_agent= ['Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0']
defrequests_headers():
UA=random.choice(user_agent)
headers= {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'User-Agent': UA,
'X-Forwarded-For': '10.10.{}.{}'.format(str(random.randint(0, 255)), str(random.randint(0, 255))),
}
returnheaders
defmain_handler(event, context):
#url = unquote(event['queryString']['url'])
url=event['queryString']['url']
agrs=event['queryString']
forkeyinagrs.keys():
ifkey!="url":
url+="&"+key+"="+agrs[key]
method=event['httpMethod']
headers=requests_headers()
#headers = event['headers']
timeout=60
try:
data=event['body']
except:
data=None
ifmethod=="POST":
headers.update({'Content-Type': 'application/x-www-form-urlencoded'})
html=requests.post(url=url, headers=headers, timeout=timeout, verify=False, data=data)
elifmethod=="GET":
html=requests.get(url=url, headers=headers, timeout=timeout, verify=False, data=data)
print(len(html.text))
return {
"isBase64Encoded": False,
"statusCode": html.status_code,
"headers": {'Content-Type': 'text/html; charset=utf-8'},
"body": html.text
}