DocWiki
DocWiki

Reputation: 3584

How to use Python with different SOCKS 5 Proxies?

The following is what a hacker always does.

I have a list of SOCKS5 proxies and a list of username/password combos. I want to test the username/password list with different SOCKS5 proxies for a website www.example.com/login.html.

I am using Python 2.5 on CentOS 5.5.

How can I use socksipy or other modules? Could you please give me a code snippet? Thanks a lot!

Upvotes: 2

Views: 3686

Answers (1)

Uku Loskit
Uku Loskit

Reputation: 42050

you can trying using pycurl

import pycurl
c = pycurl.Curl()
c.setopt(pycurl.URL, 'www.example.com/login.php')
pycurlConnect.setopt(pycurl.POSTFIELDS, POST_DATA)
c.setopt(pycurl.PROXY, 'yourproxy')
c.setopt(pycurl.PROXYPORT, 8080)
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
c.perform()

The POST_DATA variable should look something like this depending exact arguments required by the login form:

POST_DATA = 'username=meatsafe&password=murderer'

Upvotes: 4

Related Questions