ToKeiChun

FB Maker

Aug 31st, 2020 (edited)
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.39 KB | None | 0 0
  1. # source : https://github.com/zevtyardt/fb-maker
  2.  
  3. import mechanize
  4. import requests
  5. import re
  6. import logging
  7. import argparse
  8. import sys
  9.  
  10. reload(sys)
  11. sys.setdefaultencoding('utf8')
  12.  
  13. class create:
  14.     def __init__(self):
  15.         logging.basicConfig(
  16.             level={
  17.                 True: logging.DEBUG,
  18.                 False: logging.INFO
  19.             }[arg.level],
  20.             format='\r%(levelname)s:%(name)s: %(message)s'
  21.         )
  22.         self.create_total = 0
  23.         self.blacklist_email = [] #'@datasoma', '@geroev', '@cliptik', '@khtyler', '@parcel4']
  24.         self.temp_email_url = 'https://tempmail.net'
  25.  
  26.         self.__main__()
  27.  
  28.     def _browser_options(self):
  29.         br = mechanize.Browser()
  30.         br.set_handle_robots(False)
  31.         br.set_handle_equiv(True)
  32.         br.set_handle_referer(True)
  33.         br.set_handle_redirect(True)
  34.         if arg.proxy:
  35.             br.set_proxies({"http": arg.proxy,
  36.                             "https": arg.proxy,
  37.                             })
  38.         br.set_handle_refresh(
  39.             mechanize._http.HTTPRefreshProcessor(),
  40.             max_time = 5
  41.         )
  42.         br.addheaders = [('User-agent', "Mozilla/5.0 (Linux; Android 5.0; ASUS_T00G Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36")]
  43.  
  44.         return br
  45.  
  46.     # info account
  47.     def _get_info_account(self):
  48.         logging.info('looking for account information')
  49.         res = requests.get('https://randomuser.me/api').json()
  50.  
  51.         pwd = res['results'][0]['login']['password']
  52.         return {
  53.             'username':  res['results'][0]['login']['username'],
  54.             'password':  pwd + '-zvtyrdt.id' if len(pwd) < 6 else pwd,
  55.             'firstname': res['results'][0]['name']['first'],
  56.             'lastname':  res['results'][0]['name']['last'],
  57.             'gender':    '1' if res['results'][0]['gender'] == 'female' else '2',
  58.             'date':      res['results'][0]['dob']['date'].split('T')[0].split('-')
  59.         }
  60.  
  61.     # facebook
  62.     def _create_account_facebook(self, email):
  63.         data = self._get_info_account()
  64.  
  65.         self._password = data['password']
  66.         logging.info('name: %s', data['firstname'] + ' ' + data['lastname'])
  67.         logging.info('create a facebook account')
  68.         self.br.open('https://mbasic.facebook.com/reg/?cid=102&refid=8')
  69.  
  70.         self.br.select_form(nr=0)
  71.         self.br.form['firstname'] = data['firstname'] + ' ' + data['lastname']
  72.         try:
  73.             self.br.form['reg_email__'] = email
  74.         except mechanize._form_controls.ControlNotFoundError as ex:
  75.             logging.warning(str(ex))
  76.             return False
  77.  
  78.         self.br.form['sex'] = [data['gender']]
  79.         self.br.form['birthday_day'] = [data['date'][2][1:] if data['date'][2][0] == '0' else data['date'][2]]
  80.         self.br.form['birthday_month'] = [data['date'][1][1:] if data['date'][1][0] == '0' else data['date'][1]]
  81.         self.br.form['birthday_year'] = [data['date'][0]]
  82.         self.br.form['reg_passwd__'] = data['password']
  83.         self.br.submit()
  84.  
  85.         if "captcha" in self.br.response().read().lower():
  86.             sys.exit(logging.error("You are caught making fake accounts and spamming users. sorry, try tomorrow again ... ok bye bye\n"))
  87.         for i in range(3):
  88.             self.br.select_form(nr=0)
  89.             self.br.submit()
  90.  
  91.         gagal = re.findall(r'id="registration-error"><div class="bl">(.+?)<', self.br.response().read())
  92.         if gagal:
  93.             logging.error(gagal[0])
  94.             return False
  95.         return True
  96.  
  97.     def _check_email_fb(self, email):
  98.         self.br.open('https://mbasic.facebook.com/login/identify')
  99.         self.br._factory.is_html = True
  100.         self.br.select_form(nr=0)
  101.         self.br.form['email'] = email
  102.         self.br.submit()
  103.  
  104.         if "recover_method" in self.br.response().read():
  105.             logging.info("take overing account")
  106.             self.br._factory.is_html = True
  107.             self.br.select_form(nr=0)
  108.             self.br.form['recover_method'] = ['send_email']
  109.             self.br.submit()
  110.             return False
  111.  
  112.         return True
  113.  
  114.     def _submit_code(self, code):
  115.         self.br._factory.is_html = True
  116.         self.br.select_form(nr=0)
  117.         self.br.form['n'] = code
  118.         self.br.submit()
  119.  
  120.     def _change_password(self):
  121.         data = self._get_info_account()
  122.         self._password = data['password']
  123.  
  124.         self.br._factory.is_html = True
  125.         self.br.select_form(nr=0)
  126.         self.br.form['password_new'] = self._password
  127.         self.br.submit()
  128.  
  129.     # mail
  130.     def _open_temp_mail(self):
  131.         return self.br.open(self.temp_email_url).read()
  132.  
  133.     def _find_email(self, text):
  134.         return re.findall(r'value="(.+@.+)"', text)[0]
  135.  
  136.     def _read_message(self, text):
  137.         x = re.findall(r'baslik">(\d+)\s', text)
  138.         if x:
  139.             logging.info("your code: %s" % x[0])
  140.             return True
  141.  
  142.     def _save_to_file(self, email, password):
  143.         with open('akun.txt', 'a') as f:
  144.             f.write('%s|%s\n' % (email, password))
  145.  
  146.     def __main__(self):
  147.         while True:
  148.             self.br = self._browser_options()
  149.             logging.info('searching new emails')
  150.  
  151.             email_found, check, max_ = False, True, 0
  152.             while True:
  153.                 res_em = self._open_temp_mail()
  154.                 self._mail = self._find_email(res_em)
  155.  
  156.                 if '@' + self._mail.split('@')[1].split('.')[0] in self.blacklist_email:
  157.                     logging.error('blacklist email: %s', self._mail)
  158.                     break
  159.  
  160.                 if not email_found:
  161.                     logging.info('obtained email: %s', self._mail)
  162.                     if self._check_email_fb(self._mail):
  163.                         if self._create_account_facebook(self._mail):
  164.                             email_found = True
  165.                     else:
  166.                         logging.info('waiting for incoming email')
  167.                         code = self._read_message(res_em)
  168.                         if code:
  169.                             self._submit_code(code)
  170.  
  171.                 if max_ == 10:
  172.                     logging.error('no response !')
  173.                     break
  174.                 if check and email_found:
  175.                     self.create_total += 1
  176.                     logging.info('account created:\n\t   email: %s\n\t   password: %s', self._mail, self._password)
  177.                     self._save_to_file(self._mail, self._password)
  178.                     check = False
  179.                     max_ += 1
  180.                 else: break
  181.  
  182.             if self.create_total == arg.count:
  183.                 logging.info('finished\n')
  184.                 break
  185.  
  186. if __name__ == '__main__':
  187.     parse = argparse.ArgumentParser()
  188.     parse.add_argument( '-c', metavar='<COUNT>', type=int, dest='count',
  189.         help='number of accounts you want to make')
  190.     parse.add_argument( '-p', metavar='<IP:PORT>', dest='proxy',
  191.         help='set proxy')
  192.     parse.add_argument('--debug', action='store_true', dest='level',
  193.         help='set logging level to debug')
  194.     arg = parse.parse_args()
  195.  
  196.     if arg.count:
  197.         try:
  198.             print ('') # new line
  199.             create()
  200.         except KeyboardInterrupt:
  201.             logging.error('user interrupt..\n')
  202. #        except Exception as exc:
  203.  #           logging.critical(str(exc) + '\n')
  204.     else:
  205.         parse.print_help()
  206.  
Add Comment
Please, Sign In to add comment