1- HTTP Request Randomizer |Build Status | |Coverage Status | |Dependency Status | |PyPI version |
2- ===========================================================================================
1+ HTTP Request Randomizer |Build Status | |codecov | |Requirements Status | |PyPI version |
2+ =====================================================================================
33
44`Vietnamese version <README-vi.md >`__
55
6- A convenient way to implement HTTP requests is using Pythons'
6+ A convenient way to implement HTTP requests is using Pythons’
77**requests ** library. One of requests’ most popular features is simple
88proxying support. HTTP as a protocol has very well-defined semantics for
99dealing with proxies, and this contributed to the widespread deployment
@@ -22,34 +22,33 @@ Proxies
2222
2323Proxies provide a way to use server P (the middleman) to contact server
2424A and then route the response back to you. In more nefarious circles,
25- it' s a prime way to make your presence unknown and pose as many clients
25+ it’ s a prime way to make your presence unknown and pose as many clients
2626to a website instead of just one client. Often times websites will block
2727IPs that make too many requests, and proxies is a way to get around
28- this. But even for simulating an attack, you should know how it' s done.
28+ this. But even for simulating an attack, you should know how it’ s done.
2929
3030User Agent
3131----------
3232
3333Surprisingly, the only thing that tells a server the application
3434triggered the request (like browser type or from a script) is a header
35- called a " user agent" which is included in the HTTP request.
35+ called a “ user agent” which is included in the HTTP request.
3636
3737The source code
3838---------------
3939
4040The project code in this repository is crawling **five ** different
4141public proxy websites: \* http://proxyfor.eu/geo.php \*
4242http://free-proxy-list.net \* http://rebro.weebly.com/proxy-list.html \*
43- http://www.samair.ru/proxy/time-01.htm \*
44- https://www.sslproxies.org
43+ http://www.samair.ru/proxy/time-01.htm \* https://www.sslproxies.org
4544
4645After collecting the proxy data and filtering the slowest ones it is
4746randomly selecting one of them to query the target url. The request
4847timeout is configured at 30 seconds and if the proxy fails to return a
4948response it is deleted from the application proxy list. I have to
5049mention that for each request a different agent header is used. The
51- different headers are stored in the **/data/user \_ agents .txt ** file
52- which contains around 900 different agents.
50+ different headers are stored in the **/data/user_agents .txt ** file which
51+ contains around 900 different agents.
5352
5453Installation
5554------------
@@ -59,13 +58,23 @@ tool <#command-line-interface>`__, install it globally via pip:
5958
6059::
6160
62- pip install http-request-randomizer
61+ pip install http-request-randomizer
6362
6463Otherwise, you can clone the repository and use setup tools:
6564
6665::
6766
68- python setup.py install
67+ python setup.py install
68+
69+ Dev testing
70+ -----------
71+
72+ Clone repo, install requirements, develop and run tests:
73+
74+ ::
75+
76+ pip install -r requirements.txt
77+ tox -e pyDevVerbose
6978
7079How to use
7180----------
@@ -83,37 +92,37 @@ show help message:
8392
8493::
8594
86- proxyList -h, --help
95+ proxyList -h, --help
8796
8897specify proxy provider(s) (required):
8998
9099::
91100
92- -s {proxyforeu,rebro,samair,freeproxy,all}
101+ -s {proxyforeu,rebro,samair,freeproxy,all}
93102
94103Specify output stream (default: sys.stdout), could also be a file:
95104
96105::
97106
98- -o, --outfile
107+ -o, --outfile
99108
100109specify provider timeout threshold in seconds:
101110
102111::
103112
104- -t, --timeout
113+ -t, --timeout
105114
106115specify proxy bandwidth threshold in KBs:
107116
108117::
109118
110- -bw, --bandwidth
119+ -bw, --bandwidth
111120
112- show program' s version number:
121+ show program’ s version number:
113122
114123::
115124
116- -v, --version
125+ -v, --version
117126
118127API
119128---
@@ -124,29 +133,29 @@ using a method call:
124133
125134.. code :: python
126135
127- import time
128- from http_request_randomizer.requests.proxy.requestProxy import RequestProxy
136+ import time
137+ from http_request_randomizer.requests.proxy.requestProxy import RequestProxy
129138
130- if __name__ == ' __main__' :
139+ if __name__ == ' __main__' :
131140
132- start = time.time()
133- req_proxy = RequestProxy()
134- print (" Initialization took: {0} sec" .format((time.time() - start)))
135- print (" Size: {0} " .format(len (req_proxy.get_proxy_list())))
136- print (" ALL = {0} " .format(list (map (lambda x : x.get_address(), req_proxy.get_proxy_list()))))
141+ start = time.time()
142+ req_proxy = RequestProxy()
143+ print (" Initialization took: {0} sec" .format((time.time() - start)))
144+ print (" Size: {0} " .format(len (req_proxy.get_proxy_list())))
145+ print (" ALL = {0} " .format(list (map (lambda x : x.get_address(), req_proxy.get_proxy_list()))))
137146
138- test_url = ' http://ipv4.icanhazip.com'
147+ test_url = ' http://ipv4.icanhazip.com'
139148
140- while True :
141- start = time.time()
142- request = req_proxy.generate_proxied_request(test_url)
143- print (" Proxied Request Took: {0} sec => Status: {1} " .format((time.time() - start), request.__str__ ()))
144- if request is not None :
145- print (" \t Response: ip={0} " .format(u ' ' .join(request.text).encode(' utf-8' )))
146- print (" Proxy List Size: {0} " .format(len (req_proxy.get_proxy_list())))
149+ while True :
150+ start = time.time()
151+ request = req_proxy.generate_proxied_request(test_url)
152+ print (" Proxied Request Took: {0} sec => Status: {1} " .format((time.time() - start), request.__str__ ()))
153+ if request is not None :
154+ print (" \t Response: ip={0} " .format(u ' ' .join(request.text).encode(' utf-8' )))
155+ print (" Proxy List Size: {0} " .format(len (req_proxy.get_proxy_list())))
147156
148- print (" -> Going to sleep.." )
149- time.sleep(10 )
157+ print (" -> Going to sleep.." )
158+ time.sleep(10 )
150159
151160 Documentation
152161-------------
@@ -178,11 +187,11 @@ License
178187
179188This project is licensed under the terms of the MIT license.
180189
181- .. |Build Status | image :: https://travis-ci.org /pgaref/HTTP_Request_Randomizer .svg?branch=master
182- :target: https://travis-ci.org /pgaref/HTTP_Request_Randomizer
183- .. |Coverage Status | image :: https://coveralls .io/repos/github/ pgaref/HTTP_Request_Randomizer/badge.svg?branch=master
184- :target: https://coveralls.io/github/pgaref/HTTP_Request_Randomizer?branch=master
185- .. |Dependency Status | image :: https://requires.io/github/pgaref/HTTP_Request_Randomizer/requirements.svg?branch=master
190+ .. |Build Status | image :: https://github.com /pgaref/http_request_randomizer/workflows/CI/badge .svg
191+ :target: https://github.com /pgaref/http_request_randomizer/actions
192+ .. |codecov | image :: https://codecov .io/gh/ pgaref/HTTP_Request_Randomizer/branch/master/graph/ badge.svg?token=FjHh47wdYV
193+ :target: undefined
194+ .. |Requirements Status | image :: https://requires.io/github/pgaref/HTTP_Request_Randomizer/requirements.svg?branch=master
186195 :target: https://requires.io/github/pgaref/HTTP_Request_Randomizer/requirements/?branch=master
187196.. |PyPI version | image :: https://badge.fury.io/py/http-request-randomizer.svg
188197 :target: https://badge.fury.io/py/http-request-randomizer
0 commit comments