Skip to content

Paranoid wrapper around requests and grequests to automatically impersonate users and use randomized proxies

License

Notifications You must be signed in to change notification settings

S4lt5/paranoid-requests

Repository files navigation

Tests Public Lists Online and Updated

paranoid-requests

Paranoid wrapper around requests and aiohttp to automatically impersonate users and use randomized proxies.

This project is designed to help those performing web-based pen testing, analytics, scraping, or other potentially risky activities a degree of both safety and scalability.

It provides wrappers around requests and aiohttp that can be used interchangably with the original modules, so that the 'paranoid' version may be dropped in without otherwise altering the source tool or script.

Public http(s) proxy list provided by https://github.com/monosans/proxy-list/ and served through jsdeliver.

User Agents provided by https://github.com/Kikobeats/top-user-agents and served through jsdeliver.

Do no harm

I ask that anyone reading this to take a moment to digest the following statement:

This is released to enable pen testers do their jobs in good faith. Please try to make today's world 1% better than yesterday's.

Please don't use this tool for unauthorized or illegal acts.

Note on dangers (and horriffic performance) of using public proxies

Please assume any of the public proxies queried by the PublicProxyList class have malicious intent. These are completely free and anonymous services that will try to sniff your SSL traffic, trick you, or otherwise compromise you.

  • Don't pass credentials or information that is not public
  • Don't put anything through these you don't want released to the world

For improved safety, you can use the ProxyList class and pass in your own list of proxy strings.

Usage

Most Basic Usage:

import paranoid_requests.requests_wrapper as requests
for x in range(20):
    #each session automatically get's its own identity
    #and in lieu of any configuration, it will try to pull public user agent lists and proxy lists
    requests.Session().get("http://ifconfig.co")

With a little more explanation:

import paranoid_requests.requests_wrapper as noided_requests
import requests

# First, get my IP from ifconfig.co
host_addr = "http://ifconfig.co"

# contrived small list of hard coded proxies 
http_proxies = ["http://95.216.136.105:8888","http://135.181.254.248:8888"]
https_proxies = ["https://95.216.136.105:8888","https://135.181.254.248:8888"]

resp = requests.get(host_addr,headers={"Accept": "application/json"})
print("Default:\n\t",resp.json()['ip'])

#By default, paranoid proxy/user agents are only set when creating a new session, so this uses the normal pass-through requests behavior here
resp = noided_requests.get(host_addr,headers={"Accept": "application/json"})
print("Paranoid without session:\n\t",resp.json()['ip'])

#We configure our desired proxy, and use the default one-identity-per-session configuration
noided_requests.configure(new_identity_per_request=False,http_proxy_list=http_proxies,https_proxy_list=https_proxies)
sess = noided_requests.Session()
resp = sess.get(host_addr,headers={"Accept": "application/json"})
print("Paranoid WITH session:\n\t",resp.json()['ip'])

#We now setup new-identity-per-session configuration, and each request get's its own IP and identity
noided_requests.configure(new_identity_per_request=True,http_proxy_list=http_proxies,https_proxy_list=https_proxies)
print("Paranoid Auto Session:\n")
for x in range(2):
    resp = noided_requests.get(host_addr,headers={"Accept": "application/json"})    
    print("\t",resp.json()['ip'])

#We can try completely automatic setup and try our luck against the public proxy list
noided_requests.configure(new_identity_per_request=True)
print("Paranoid Auto Session with public proxy list:\n")
for x in range(2):
    resp = noided_requests.get(host_addr,headers={"Accept": "application/json"})    
    print("\t",resp.json()['ip'])

Will produce output something like (arbitrary proxy addresses are used below):

 ❯ python simple_requests_example.py
Default:
     YOUR-IP
Paranoid without session:
     YOUR-IP
Paranoid WITH session:
     207.204.229.66
Paranoid Auto Session:
     209.107.196.142
     216.131.75.35
Paranoid Auto Session with public proxy list:
     207.204.229.66
     209.107.196.142

Installation

pip install flit
flit install

About

Paranoid wrapper around requests and grequests to automatically impersonate users and use randomized proxies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published