Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b137e7

Browse files
authored
Add usage example for Proxy() class
1 parent dff847c commit 3b137e7

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ ac = hacklib.AuthClient()
2424
# Logging into a gmail account
2525
htmldata = ac.login('https://gmail.com', 'email', 'password')
2626

27-
# Returns HTML whether login works or not.
28-
try:
29-
if 'Inbox' in htmldata: print 'Login Success.'
30-
else: print 'Login Failed.'
31-
except: print 'Couldn\'t even connect. :('
27+
# Check for a string in the resulting page
28+
if 'Inbox' in htmldata: print 'Login Success.'
29+
else: print 'Login Failed.'
3230

3331
# For logins using HTTP Basic Auth:
3432
try:
@@ -106,19 +104,17 @@ Socks4/5 proxy scraping and tunneling
106104
```python
107105
>>> import hacklib
108106
>>> import urllib2
109-
# Scrape recently added Socks proxies from the internet
110-
>>> proxylist = hacklib.getProxies()
107+
>>> proxylist = hacklib.getProxies() # scrape recently added socks proxies from the internet
111108
>>> proxy = hacklib.Proxy()
112-
# Automatically find and connect to a working proxy in proxylist
113-
>>> proxy.connect(proxylist)
109+
>>> proxy.connect(proxylist) # automatically find and connect to a working proxy in proxylist
114110
>>> proxy.IP
115111
u'41.203.214.58'
116112
>>> proxy.port
117113
65000
118114
>>> proxy.country
119115
u'KE'
120-
# All Python network activity across all modules are routed through the proxy
121-
>>> urllib2.urlopen('http://icanhazip.com/').read()
116+
# All Python network activity across all modules are routed through the proxy:
117+
>>> urllib2.urlopen('http://icanhazip.com/').read()
122118
'41.203.214.58\n'
123119
# Notes: Only network activity via Python are masked by the proxy.
124120
# Network activity on other programs such as your webbrowser remain unmasked.

0 commit comments

Comments
 (0)