Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.24 KB | None | 0 0
  1. from time import sleep
  2. import requests
  3. import random
  4. import string
  5.  
  6.  
  7. class AccCreator:
  8.     def __init__(self, service_key, google_site_key):
  9.         self.service_key = service_key
  10.         self.google_site_key = google_site_key
  11.         pass
  12.  
  13.     def register_account(self):
  14.         # Register variables
  15.         email = self.random_email(length=12)
  16.         password = self.random_password(length=10)
  17.         day_of_birth = self.random_birth()[0]
  18.         month_of_birth = self.random_birth()[1]
  19.         year_of_birth = self.random_birth()[2]
  20.         solved_captcha = self.get_solved_captcha()
  21.  
  22.         print(solved_captcha)
  23.  
  24.         # Headers
  25.         headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'}
  26.         register_url = "https://secure.runescape.com/m=account-creation/create_account"
  27.  
  28.         # Post data
  29.         register_payload = {"email1": f"{email}", "onlyOneEmail": 1, "password1": f"{password}",
  30.                             "onlyOnePassword": 1, "day": day_of_birth, "month": month_of_birth, "year": year_of_birth, "create-submit": "create",
  31.                             "g-recaptcha-response": f"{solved_captcha}"}
  32.  
  33.         resp = requests.post(url=register_url, headers=headers, data=register_payload)
  34.         print(resp.status_code)
  35.         print(resp.ok)
  36.         print(resp.text)
  37.         print(f"Email: {email}, password: {password}")
  38.  
  39.     def get_captcha_id(self):
  40.         # page url is where we are getting the captcha id from.
  41.         pageurl = 'https://secure.runescape.com/m=account-creation/create_account'
  42.         url = f"http://2captcha.com/in.php?key={self.service_key}&method=userrecaptcha&googlekey={self.google_site_key}&pageurl={pageurl}"
  43.         response = requests.get(url)
  44.  
  45.         if response.text[0:2] != 'OK':
  46.             print(f'Service error. Error code: {response.text}')
  47.         captcha_id = response.text[3:]
  48.         print(captcha_id)
  49.         return captcha_id
  50.  
  51.     def get_solved_captcha(self):
  52.         captcha_id = self.get_captcha_id()
  53.         fetch_url = f"http://2captcha.com/res.php?key={self.service_key}&action=get&id={captcha_id}"
  54.         for i in range(1, 30):
  55.             sleep(5)  # wait 5 sec.
  56.             resp = requests.get(fetch_url)
  57.             if resp.text[0:2] == 'OK':
  58.                 captcha_response = resp.text[3:]
  59.                 return captcha_response
  60.  
  61.     def random_email(self, length):
  62.         possible_mails = ["@protonmail.com", "@gmail.com", "@hotmail.com", "@outlook.com"]
  63.         mail = ''.join(random.choices(string.ascii_lowercase + string.digits, k=length)) + random.choice(possible_mails)
  64.         return mail
  65.  
  66.     def random_password(self, length):
  67.         password = ''.join(random.choices(string.ascii_lowercase + string.digits, k=length))
  68.         return password
  69.  
  70.     def random_birth(self):
  71.         day = random.randrange(1, 30)
  72.         month = random.randrange(1, 11)
  73.         year = random.randrange(1990, 2000)
  74.         return day, month, year
  75.  
  76.  
  77. if __name__ == "__main__":
  78.     # Service_key is your api key for 2captcha and google_site_key is the site's captcha api key.
  79.     AccCreator(service_key="removedfonow", google_site_key="removedfonow").register_account()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement