How To: Add Proxies to Your ProxyChains Config File the Lazy Way ;)

Add Proxies to Your ProxyChains Config File the Lazy Way ;)

Hello fellow gray hat hackers, I wrote a program in python that helps me to fill up my proxychains.conf file, so I don't have to manually enter in the proxies. I figured I will give a little how-to of how I did it and maybe I could help some of you(hackers) out there to stay anonymous.

What Is Proxychains?

According to this post on github;

ProxyChains is a UNIX program, that hooks network-related libc functions in dynamically linked programs via a preloaded DLL and redirects the connections through SOCKS4a/5 or HTTP proxies.

It is very useful if you want to combine two or more proxies to increase your level of anonymity.

It can also be used with almost any application, to route all that application's traffic through the defined proxies in the configuration file.

Unfortunately, I am not here to teach you how to set it up. You can click this link to know how to do that. It's really simple actually. So now the main part....

Whole Idea

Okay, so basically, what we are going to do is:

  1. Open a webiste that provides free proxies
  2. Parse the contents of that website.
  3. Locate the proxies in the parsed content
  4. Add the proxy IPs and port numbers along with the protocol to our proxychains configuration file.

Simple right....well let's get started..

Step 1: Importing Modules and Setting the Options Right

Image via tinypic.com

We are going to use the following modules:
bs4(i.e. BeautifulSoup) - to parse the webpage
urllib2 - to open the webpage
base64 - to decode the parsed IP addresses and port numbers(you will see why soon)
os - to check for root permission
sys - to exit the program

Line 5-7 - defining arrays to place our information in it
Line 9-11- check if the program is running with root privileges so that we can edit the configuration file.
Line 14-16 - check to make sure all arguments have been provided.

Step 2: Opening the WebPage and Parsing Our Data

Image via tinypic.com

So we just going to use http proxies, but you can feel free to modify the code for yourself.

Anyway, our lucky proxy site winner is https://proxy-list.org/. We add a user-agent so we look legit, and not some proxy-stealing bot(they don't need to know that...lol). So well, we open our webpage and we use BeautifulSoup to parse the html, this way we can easily select which tags we want to be particular about, and get our proxies.

Step 3: Getting Our Information and Filling Up the Variables

Image via tinypic.com

Okay, so for this part, if you take a look at the html source code for proxy-list, you will see that, they put their proxies in a list form. So we can easily get that from our soup(the parsed data...lol).

They also make it easy for us by adding an attribute so that we can easily get our proxies. Also, previously, the proxies used to be in plain text, but they recently began to encode them with base64, but that's not a problem for us, right?! That's what the base64 module is there for.

So we decode the proxies and put them in a our list....and then we iterate through the whole list and separate the IPs from the port numbers so we can easily add it to our configuration file.

Step 4: Finally, We Update Our Config File

Image via tinypic.com

Final Step, is just to open up our file and add the proxies to it.

Noticed, I used 'a' as the mode to open the file so that, I don't overwrite what's already in it. And also, if you don't have root privileges you won't be able to write to the file(that's how mine was I don't know about you tho...)

After that you just close the file, and you are done.

Conclusion

Thank you guys for taking the time to read this. I hope you compeletely understand what's going on. If you don't just leave a comment below. And if you have any questions, I will try and answer them as soon as I can.

EDIT: Hi guys, so I have made some improvements to the old program, so let's call this v2.0. I want to especially thank Defalt and Jeremiah Payne for pointing out the fact that, the proxies from the old one, weren't really helping in reducing anonymity. And of course, OTW's post for supplying better sources for the anonymity.

Since I can't rewrite a whole how-to again, the concept is the same, so you can just check out the code here on pastebin.

God bless you.

Wuzi out!!

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

9 Comments

You may want to find another website to parse. The one you've specified may have free proxies, but it seems that most of them are transparent, so they won't increase your anonymity.

-Defalt

Okay, thanks a lot. I have edited the code and pasted a link to it.

As he said you should filter the transparent ones out but the concept is still the same and I am actually going to do this because I never thought of it. Thanks!

Thank you. you welcome too!!

I don't really use proxies, but can you suggest any websites with better proxies so that I can work on that, and update the code when I'm less busy

There are tons of sites that do show lists of public proxies, I use the sites OTW mentioned in this post mainly because he has experience and knowledge about this.

Thanks, I will check 'em out. I have edited the article and improved the code and put a link up. You can check it out

Am I the only one that is MORE lazy to type this small script

Hi! if webmaster see it as a spam just delete it... My intention is not to spam your website but i make a proxy list updated every day to cut ans past in proxychains.conf file. more than 1000 proxy so i think is a good tool. it's under proxy list thanks whatismyip.pro

Share Your Thoughts

  • Hot
  • Latest