-
proxy.py - retrieves and checks HTTP, HTTPS, SOCKS4, and SOCKS5 proxies.
-
scan.py - performs port scanning with a SOCKS4 socket using found proxies.
-
checker.py - checks all types of proxies from scan_results or custom API '-url'
-
start.py - runs proxy delivery and checking, starts local hosted (http://127.0.0.1:8000) API service. runs local http proxy server (http://127.0.0.1:3333) that listens on a local port and redirects all incoming requests through HTTP proxies handled by local API
The availability of all proxies is checked using a GET request to https://httpbin.org/ip.
Only those proxies that do not reveal the current external address of the system where the proxy checker is running are marked as available and alive.
Every script can be run from the command line with several optional arguments to specify the required ping of the proxy server, the timeout of the checker, the number of worker threads to use when checking proxies, the type of proxies to retrieve and check, and the URL of the API to retrieve proxies from
With venv environment (python3-full and python3-pip required):
sudo apt update && sudo apt install git python3-full python3-pip -y
git clone https://github.com/imhassla/proxy-machine.git
cd proxy-machine
python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install -r requirements.txtWith docker:
git clone https://github.com/imhassla/proxy-machine.git
cd proxy-machine
docker build -t proxy_machine .
docker run -it --rm -v "$(pwd)":/app -p 8000:8000 -p 3333:3333 proxy_machineTo start the Machine just run container or:
python3 start.pyTo start proxy checks of all types and run uvicorn server for local Proxy-Machine API service.

Let's go with web-browser to http://127.0.0.1:8000, which is provided to us by uvicorn to see the API doc:

Curl usage of API:
curl 'http://127.0.0.1:8000/proxy/http?time=2&minutes=2&format=text'Curl usage of local proxy relay server:
curl --proxy 127.0.0.1:3333 http://httpbin.org/ippython3 proxy.py -type httpThe script will continue to run until interrupted by the user (e.g., by pressing Ctrl-C).
While running, it will periodically retrieve, check, and track proxies, updating the data.db
python3 scan.py -range 1.1.1.0/24 1.2.3.0/24 -port 53 80 8080runs proxy.py in the background to retrieve SOCKS4 proxies and perform port scans over found proxies for all IP ranges with every selected port
python3 checker.py -listor:
docker run -it --rm -v "$(pwd)":/app -p 8000:8000 -p 3333:3333 proxy_machine checker.py -listcheck all HTTP, HTTPS, SOCKS4, and SOCKS5 proxies from open sources, print results, and store proxies in data.db.
python3 checker.py -ping -url 'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=all&timeout=300'check API source list as all types of proxies, print results and store in DB.
If you encounter any issues while running this script, try checking the following:
- Make sure that all dependencies are installed and up-to-date.
- Check that you have specified valid values for any command-line arguments.
- If you are using a custom API URL to retrieve proxies, make sure that it is correctly formatted and returns a valid list of proxies.
The accuracy of the proxy availability checks may vary depending on network conditions and other factors. Proxies that are reported as available may not always be accessible or reliable.
This script is distributed under the MIT license.




