forked from NCDiesel/WhatsAppTunneler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSendDataToProxy
34 lines (28 loc) · 1.34 KB
/
SendDataToProxy
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
import requests
#Function to send data through get requests to the proxy. Runs on startup
#swap 'test' function out for commented out getrequest while in use.
def sendData():
# URL, headers = getRequest()
InputURL, inputheader = test()
Inputproxy = {'http': 'http//127.0.0.1:8080'}
getdata = requests.get(InputURL,headers=inputheader, proxies=Inputproxy) #returns a response object, takes URL, the header library, and input proxy
write(getdata)
print(getdata.content)
return getdata
#helper to enble users to manually enter get request info
def getRequest():
URL = input("Please enter URL as a string:\n")
headers = input("Please enter desired Headers as a string:\n")
return URL, headers
#helper to test a get request
def test():
header = {'Host': 'info.cern.c','User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language':'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'nConnection': 'keep-alive', 'Upgrade-Insecure-Requests': '1' }
URL = 'http://info.cern.ch/'
return URL, headers
#helper to dertermin sucess
def write(httpresponse):
if "html" in httpresponse:
return "Success"
if "HTML" in httpresponse:
return "Success"
return "Failed, not html"