add files
This commit is contained in:
parent
4f82321e97
commit
ef236975a0
13
readTorUrl.py
Normal file
13
readTorUrl.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import StringIO, socket, urllib, stem.process, socks # SocksiPy module #from stem.util import term
|
||||||
|
def readUrl(url):
|
||||||
|
try: return urllib.urlopen(url).read()
|
||||||
|
except: return "Unable to reach %s" % url
|
||||||
|
if __name__ == "__main__":
|
||||||
|
SOCKS_PORT = 7000
|
||||||
|
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', SOCKS_PORT)
|
||||||
|
socket.socket = socks.socksocket # Set socks proxy and wrap the urllib module
|
||||||
|
socket.getaddrinfo = lambda *args: [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))] # Perform DNS resolution through the socket
|
||||||
|
tor_process = stem.process.launch_tor_with_config( config = { 'SocksPort': str(SOCKS_PORT) })
|
||||||
|
print( readUrl("http://www.hloko3spojxt2inn.onion/") )
|
||||||
|
tor_process.kill()
|
19
tor-curl.py
Normal file
19
tor-curl.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import sys, StringIO, socket, urllib, stem.process, socks # SocksiPy module #from stem.util import term
|
||||||
|
def readUrl(url):
|
||||||
|
try: return urllib.urlopen(url).read()
|
||||||
|
except: return "Unable to reach %s" % url
|
||||||
|
SOCKS_PORT = 7000
|
||||||
|
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', SOCKS_PORT)
|
||||||
|
socket.socket = socks.socksocket # Set socks proxy and wrap the urllib module
|
||||||
|
socket.getaddrinfo = lambda *args: [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))] # Perform DNS resolution through the socket
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) == 2:
|
||||||
|
tor_process = stem.process.launch_tor_with_config( config = { 'SocksPort': str(SOCKS_PORT) })
|
||||||
|
#print( readUrl("http://www.hloko3spojxt2inn.onion/") )
|
||||||
|
print( readUrl(sys.argv[1]) )
|
||||||
|
tor_process.kill()
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
Loading…
x
Reference in New Issue
Block a user