Sam - September 23, 2016
If you’ve recently found some public proxies or even paid proxies you may want to test to see if they’re working correctly.
The quickest and easiest way to do this is with using the cURL cli binary on OSX (or any linux distro).
With this we can easily test HTTP, HTTPS, SOCKS4, SOCKS4a & SOCKS5 proxy protocols using just a few commands.
In this tutorial I will assume you have access to a linux terminal or OSX terminal.
Copy all of your proxies into a file, in this case we will paste them all into a file called “usa.txt”
22.214.171.124:2000 126.96.36.199:2001 188.8.131.52:2002 184.108.40.206:2003 220.127.116.11:2004 18.104.22.168:2005 22.214.171.124:2006 126.96.36.199:2007 188.8.131.52:2008 184.108.40.206:2009 220.127.116.11:2010 18.104.22.168:2011 22.214.171.124:2012 126.96.36.199:2013 188.8.131.52:2014 184.108.40.206:2015 220.127.116.11:2016 18.104.22.168:2017 22.214.171.124:2018 126.96.36.199:2019
Using your favourite text editor (vim/nano/etc) create your shell script file in this case we will call it test_usa.sh
Here are the seperate scripts for each protocol
for proxy in `cat usa.txt` do (curl -s --max-time 10 -x $proxy -U YOURUSER:YOURPASS ip-api.com/json;echo) & done | grep country | wc -l
for proxy in `cat usa.txt` do (curl -s --max-time 10 -x https://$proxy -U YOURUSER:YOURPASS ip-api.com/json;echo) & done | grep country | wc -l
for proxy in `cat usa.txt` do (curl -s --max-time 10 --socks4 $proxy ip-api.com/json;echo) & done | grep country | wc -l
for proxy in `cat usa.txt` do (curl -s --max-time 10 --socks4a $proxy -U YOURUSER:YOURPASS ip-api.com/json;echo) & done | grep country | wc -l
for proxy in `cat usa.txt` do (curl -s --max-time 10 --socks5 $proxy -U YOURUSER:YOURPASS ip-api.com/json;echo) & done | grep country | wc -l
There is a max execution time of 10 seconds to prevent the proxy from never timing out.
Once it is completed it will output a number into your console and this is the number of successful requests it was able to complete
sbook:~$ bash test_usa.sh 19
That was pretty easy, right?
It wouldn’t be hard to create a much more advanced script that takes parameters and all that jazz but this is a simple, easy solution that most people can understand more importantly simply copy + paste to get going.
How it works (if you’re new to bash shell scripting)
This is a for loop and every new line it reads it stores it in the variable $proxy
cat? This command reads a file and outputs it into your terminal
for proxy in `cat usa.txt`
This is the syntax we need to create the for loop (bash is really quite like reading english)
This executes the cURL command line with our $proxy (the line we just read)
-s Parameter is setting silent mode otherwise we get a bunch of ambigious text on our screen from the multi-threaded approach
-U YOURUSER:YOURPASS is the authentication process
--max-time 10 This sets the max time for our request to load the page ip-api.com/json
& symbol sends our command into the background and moves onto the next part of the loop, thus creating our async / multi-threaded approach
(curl -s --max-time 10 -x $proxy -U YOURUSER:YOURPASS ip-api.com/json;echo) &
Now we finish the loop with
done just like we started with
grep country then echos/prints only if we find the text string “country” from the page we loaded (only successful page loads would be counted)
wc -l This command counts how many of these instances we find of the above
This is probably not the most in depth explanation you’ll find on these single commands but hopefully it gives you a better understanding. If you genuinely want a further explanation of these commands or want to ask me a question just write below in the comments and I’ll see how I can assist 🙂
Proxyrack - December 2, 2022
Cost of a Data Breach
Proxyrack - October 8, 2022
Social Media Security Report
Daniel - May 9, 2022
How To Create A Custom SEO Tool
Daniel - May 9, 2022
Best Proxies For Enterprises
Get Started by signing up for a Proxy ProductView Plans