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
| import os import requests import requesocks import time url = 'https://api.ipify.org?format=json' def getip_requests(url): print "(+) Sending request with plain requests..." r = requests.get(url) print "(+) IP is: " + r.text.replace("\n", "") def getip_requesocks(url): print "(+) Sending request with requesocks..." session = requesocks.session() session.proxies = {'http': 'socks5://127.0.0.1:9050', 'https': 'socks5://127.0.0.1:9050'} r = session.get(url) print "(+) IP is: " + r.text.replace("\n", "") def main(): print "Running tests..." getip_requests(url) while True: getip_requesocks(url) time.sleep(10); if __name__ == "__main__": main()
|