Git Product home page Git Product logo

rotatingproxybot's Introduction

RotatingProxyBot RotatingProxyBot version

A Bot that uses a Rotating Proxy to simulate many clients making a request to a single server

Author

Daniel Gisolfi - All current work - dgisolfi

Usage

#!/usr/bin/python3
from RotatingProxyBot import ProxyBot

# Create new custom bot
bot = ProxyBot(
    address='IP OR URL',
    method='POST'
    desired_reqs=10,
    reqs_per_int=2,
    wait_time=60 # 1min
)
# Start Submiting and rotating proxies
bot.enable()

Building a list of Proxies

The bot will need a list of proxies to use for making requests, it can use either an API to retrieve proxies or a file to import them from.

Proxies from an API

By default, the bot will retrieve a few thousand proxies from an API. To use a custom API tell the bot what address to reach the API at by passing in the following argument when creating a new instance proxy_api='http://api.com'.

Proxies from a File

To use a custom file of proxies rather than the default API, pass in the following argument to the bot constructor proxy_file=filename.txt For the bot to be able to import the list of proxies, the file should have the following structure:

0.0.0.0:80
1.1.1.1:90
2.2.2.2:20

Methods

The following are some useful methods that are a part of the package

ProxyBot

  • getRequest(proxy) - if passed a specific proxy, this method will perform aGET request using the specified proxy to the address set in the creation of the bot. EX: getRequest('0.0.0.0:80')
  • postRequest(proxy) - if passed a specific proxy, this method will perform a POST request using the specified proxy to the address set in the creation of the bot. EX: postRequest('0.0.0.0:80')
  • preformRotate() - if called the bot will request a new proxy from the RotatingProxy class and perform the specified request to the specified address, returning the response element
  • enable() - if called will initiate the main loop of the bot, making the specified requests to the address using the set number of intervals and wait time
  • disable() - if called will shut down the main loop of the program and delete the bot

RotatingProxy

  • buildProxyList() - when called will contact the set API(or default one) to retrieve a list of up to date proxies in which it can pull from to make requests
  • importProxyList() - will attempt to build a list of proxies from the file name provided.
  • rotate() - will return the 0th proxy in the list and add it to the used proxy list.

Additional Arguments for the Constructor

The following are keyword arguments that can be passed into the constructor of the ProxyBot Class.

  • id - Assigns the instance of the ProxyBot with the given numeric ID

    Example: RotatingProxyBot(id=1)

  • address - the IP or URL for the bot to contact, will default to a tester API

    Example: RotatingProxyBot(address='0.0.0.0')

  • method - The request method to be used. Only GET and POST supported. The default is GET Example: RotatingProxyBot(method='POST')

  • params - Parameters to be passed with the request, works with all request methods Example: RotatingProxyBot(params={'example':'test'})

  • desired_reqs - Desired number of requests to be completed

    Example: RotatingProxyBot(desired_reqs=10)

  • keep_alive - A boolean allow the bot to continue to make requests forever

    if set to True dont set desired_reqs Example: RotatingProxyBot(keep_alive=True)

  • reqs_per_int - Requests Per Interval, number of requests to be completed before waiting. This will prevent the server from being DOSed Example: RotatingProxyBot(reqs_per_int=2)

  • wait_time - Amount of time in Seconds to wait until the next interval of requests Example: RotatingProxyBot(wait_time=600)

rotatingproxybot's People

Contributors

dgisolfi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

nasimahadad

rotatingproxybot's Issues

Catch exceptions for bad proxies

If a proxy is unreachable the program shuts down, setup exceptions to catch these issues and move to the next proxy available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.