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

Jan 18, 2016 11:04 PM
Jan 21, 2016 07:27 PM
635887246821078518.jpg

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

635887246821078518.jpg

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

635887252922641038.jpg

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

635887256097799319.jpg

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

635887260544672159.jpg

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 Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Comments

No Comments Exist

Be the first, drop a comment!