Skip to content

Instantly share code, notes, and snippets.

@neerajvashistha
Created January 10, 2019 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neerajvashistha/e67fef39923ccdd0fd63f9b54eb050f5 to your computer and use it in GitHub Desktop.
Save neerajvashistha/e67fef39923ccdd0fd63f9b54eb050f5 to your computer and use it in GitHub Desktop.
# Requirements
# certifi==2018.11.29
# chardet==3.0.4
# datefinder==0.6.1
# EasyProcess==0.2.5
# emoji==0.5.1
# idna==2.8
# nltk==3.4
# pendulum==2.0.4
# PySocks==1.6.8
# python-dateutil==2.7.5
# pytz==2018.7
# pytzdata==2018.7
# PyVirtualDisplay==0.2.1
# regex==2016.1.10
# requests==2.21.0
# selenium==3.141.0
# singledispatch==3.4.0.3
# six==1.12.0
# splinter==0.10.0
# stem==1.7.1
# torrequest==0.1.0
# urllib3==1.24.1
from torrequest import TorRequest
tr=TorRequest(password='#GUj}6a(wnkbmvbL')
import requests
response= requests.get('http://ipecho.net/plain')
print ("My Original IP Address:",response.text)
tr.reset_identity() #Reset Tor
response= tr.get('http://ipecho.net/plain')
print ("New Ip Address",response.text)
import stem.process
from stem import Signal
from stem.control import Controller
from splinter import Browser
from torrequest import TorRequest
proxyIP = "127.0.0.1"
proxyPort = 9050
proxy_settings = {"network.proxy.type":1,
"network.proxy.ssl": proxyIP,
"network.proxy.ssl_port": proxyPort,
"network.proxy.socks": proxyIP,
"network.proxy.socks_port": proxyPort,
"network.proxy.socks_remote_dns": True,
"network.proxy.ftp": proxyIP,
"network.proxy.ftp_port": proxyPort
}
browser = Browser('firefox', profile_preferences=proxy_settings)
browser.visit("http://www.icanhazip.com")
tr=TorRequest(password='#GUj}6a(wnkbmvbL')
tr.reset_identity() #Reset Tor
browser.visit("http://www.icanhazip.com")
browser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment