forked from pagekite/PySocksipyChain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·29 lines (23 loc) · 766 Bytes
/
test.py
File metadata and controls
executable file
·29 lines (23 loc) · 766 Bytes
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
#!/usr/bin/python
from __future__ import print_function
from six.moves.urllib.request import urlopen
import ftplib
import telnetlib
try:
import urllib.request as urllib_request # Python 3
except ImportError:
import urllib2 as urllib_request # Python 2
# Import SocksiPy
import sockschain as socks
def DEBUG(msg): print(msg)
socks.DEBUG = DEBUG
# Set the proxy information
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, 'localhost', 9050)
# Route an HTTP request through the SOCKS proxy
socks.wrapmodule(urllib_request)
print('\n%s\n' % urlopen('http://bot.whatismyipaddress.com/').read())
# Route a telnet connection through the SOCKS proxy
socks.wrapmodule(telnetlib)
tn = telnetlib.Telnet('india.colorado.edu', 13)
print(tn.read_all())
tn.close()