def save_account(payload, proxy=None): """Save the needed account information to created_accs.txt""" if USE_PROXIES: proxy_auth_type = get_user_settings()[1] proxy_ip = read_proxy(proxy, proxy_auth_type)[2] proxy = proxy_ip else: proxy = get_ip() # Check if we want user friendly formatting or bot manager friendly acc_details_format = get_user_settings()[7] if acc_details_format: formatted_payload = ( f"\nemail:{payload['email1']}, password:{payload['password1']}," f" Birthday:{payload['month']}/{payload['day']}/{payload['year']}," f" Proxy:{proxy}") else: formatted_payload = (f"\n{payload['email1']}:{payload['password1']}") with open("created_accs.txt", "a+") as acc_list: acc_list.write(formatted_payload) if acc_details_format: print(f"Created account and saved to created_accs.txt" f" with the following details:{formatted_payload}") else: print(f"Created account and saved to created_accs.txt" f" with the following details: {formatted_payload}:{proxy}")
def save_account(payload, proxy=None): """Save the needed account information to created_accs.txt""" if USE_PROXIES: proxy_auth_type = get_user_settings()[1] if proxy_auth_type == 1: # Formatting based on user:pass auth # Formatting our proxy string to only save the IP proxy = str(proxy) proxy = proxy[proxy.find('@') + 1:] proxy = proxy[:proxy.find(':')] else: # Formatting based on IP authentication proxy = str(proxy) proxy = proxy[proxy.find('/') + 2:] proxy = proxy[:proxy.find("'")] else: proxy = get_ip() # Check if we want user friendly formatting or bot manager friendly acc_details_format = get_user_settings()[7] if acc_details_format: formatted_payload = ( f"\nemail:{payload['email1']}, password:{payload['password1']}," f" Birthday:{payload['month']}/{payload['day']}/{payload['year']}," f" Proxy:{proxy}") else: formatted_payload = (f"\n{payload['email1']}:{payload['password1']}") with open("created_accs.txt", "a+") as acc_list: acc_list.write(formatted_payload) if acc_details_format: print(f"Created account and saved to created_accs.txt" f" with the following details:{formatted_payload}") else: print(f"Created account and saved to created_accs.txt" f" with the following details: {formatted_payload}:{proxy}")
def twocaptcha_solver(): """Handles and returns recaptcha answer for osrs account creation page""" SITE_URL = get_site_settings()[1] SITE_KEY = get_site_settings()[0] # osrs site key API_KEY = get_user_settings()[3] # api key read from settings.ini if not API_KEY: raise ValueError("No API key was found in settings.ini.") s = requests.Session() # here we post and parse site key to 2captcha to get captcha ID try: captcha_id = s.post(f"http://2captcha.com/in.php?key={API_KEY}" f"&method=userrecaptcha&googlekey={SITE_KEY}" f"&pageurl={SITE_URL}").text.split('|')[1] except IndexError: print("You likely don't have a valid 2captcha.com API key with funds" " in your settings.ini file. Fix and re-run the program.") # then we parse gresponse from 2captcha response recaptcha_answer = s.get(f"http://2captcha.com/res.php?key={API_KEY}" f"&action=get&id={captcha_id}").text print("Solving captcha...") while 'CAPCHA_NOT_READY' in recaptcha_answer: sleep(6) recaptcha_answer = s.get(f"http://2captcha.com/res.php?key={API_KEY}" f"&action=get&id={captcha_id}").text try: recaptcha_answer = recaptcha_answer.split('|')[1] except IndexError: print("2captcha failed to solve this one.. Returning a blank response " "If the program fails to continue, please msg Gavin with error.") recaptcha_answer = '' else: return recaptcha_answer
def use_osbot(charname, charpass, proxy=None): """Launches OSBot CLI with supplies information""" # Grab all of our settings use_proxies = get_user_settings()[0] osbot_username = get_osbot_settings()[1] osbot_password = get_osbot_settings()[2] osbot_script = get_osbot_settings()[3] script_args = get_osbot_settings()[4] client = find_osbot() if use_proxies: # Format CLI with proxy param cli_cmd = (f'java -jar "{client}" ' f'-proxy {format_current_proxy(proxy)} ' f'-login {osbot_username}:{osbot_password} ' f'-bot {charname}:{charpass}:0000 ' f'-script {osbot_script}:{script_args} ' f'-world 433') else: # Format without a proxy param cli_cmd = (f'java -jar "{client}" ' f'-login {osbot_username}:{osbot_password} ' f'-bot {charname}:{charpass}:0000 ' f'-script {osbot_script}:{script_args} ' f'-world 433') print("") print("\nLoading OSBot with the following settings...") print(cli_cmd) # Run the OSBot CLI in a separate, hidden shell to decrease clutter create_no_window = 0x08000000 subprocess.Popen(f"start /B start cmd.exe @cmd /k {cli_cmd}", shell=True, creationflags=create_no_window)
def format_current_proxy(proxy): """Formats and returns our current proxy for CLI use""" # Example returned proxy: # {'https': 'socks5://username:[email protected]:24613\n'} proxy = str(proxy) proxy_auth_type = get_user_settings()[1] # Formatting shenanigans to get the strings we need for CLI usage if proxy_auth_type == 1: # Formatting based on user:pass@proxy:port proxy_username = proxy[get_index(proxy, '/', 2) + 1:get_index(proxy, ':', 3)] proxy_password = proxy[get_index(proxy, ':', 3) + 1:get_index(proxy, '@', 1)] proxy_host = proxy[get_index(proxy, '@', 1) + 1:get_index(proxy, ':', 4)] proxy_port = proxy[get_index(proxy, ':', 4) + 1:get_index(proxy, "'", 4) - 2] # Format for CLI use (ip:port:user:pass) proxy = ( f"{proxy_host}:{proxy_port}:{proxy_username}:{proxy_password}") return proxy else: # Formatting based on proxy:port (IP authentication) proxy_host = proxy[get_index(proxy, '/', 2) + 1:get_index(proxy, ':', 3)] proxy_port = proxy[get_index(proxy, ':', 3) + 1:-4] # Format for CLI use (ip:port) proxy = (f"{proxy_host}:{proxy_port}") return proxy
def get_payload(captcha) -> dict: """ Generates and fills out our payload. returns: payload (dict): account creation payload data """ # Get username/password options from settings.ini email = get_user_settings()[5] password = get_user_settings()[6] if not email: # We aren't using a custom username prefix -> make it random email = ''.join([ random.choice(string.ascii_lowercase + string.digits) for n in range(6) ]) + '@gmail.com' else: # We're using a custom prefix for our usernames email = email + str(random.randint(1000, 9999)) + '@gmail.com' if not password: password = email[:-10] + str(random.randint(1, 1000)) # Generate random birthday for the account day = str(random.randint(1, 25)) month = str(random.randint(1, 12)) year = str(random.randint(1980, 2006)) # Be at least 13 years old payload = { 'theme': 'oldschool', 'email1': email, 'onlyOneEmail': '1', 'password1': password, 'onlyOnePassword': '******', 'day': day, 'month': month, 'year': year, 'create-submit': 'create', 'g-recaptcha-response': captcha } return payload
def format_current_proxy(proxy): """Formats and returns our current proxy for CLI use""" # Example returned proxy: # {'https': 'socks5://username:[email protected]:24613\n'} proxy_auth_type = get_user_settings()[1] proxy_username, proxy_password, proxy_ip, proxy_port = read_proxy( proxy, proxy_auth_type) if proxy_auth_type == 1: proxy = (f"{proxy_ip}:{proxy_port}:{proxy_username}:{proxy_password}") return proxy else: proxy = (f"{proxy_ip}:{proxy_port}") return proxy
def create_account(): """Creates our account and returns the registration info""" captcha_service = get_user_settings()[2] requests.session() if USE_PROXIES: proxy = get_proxy() if access_page(proxy): if captcha_service == 1: payload = get_payload(twocaptcha_solver()) else: payload = get_payload(anticaptcha_solver()) submit = requests.post(SITE_URL, data=payload, proxies=proxy) if submit.ok: if check_account(submit): save_account(payload, proxy=proxy) if TRIBOT_ACTIVE: use_tribot(payload['email1'], payload['password1'], proxy) elif OSBOT_ACTIVE: use_osbot(payload['email1'], payload['password1'], proxy) else: print("We submitted our account creation request " "but didn't get to the creation successful page.") print(submit.status_code) else: print(f"Creation failed. Error code {submit.status_code}") else: # Not using proxies so we'll create the account(s) with our real IP if access_page(): if captcha_service == 1: payload = get_payload(twocaptcha_solver()) else: payload = get_payload(anticaptcha_solver()) submit = requests.post(SITE_URL, data=payload) if submit.ok: if check_account(submit): save_account(payload) if TRIBOT_ACTIVE: use_tribot(payload['email1'], payload['password1']) elif OSBOT_ACTIVE: use_osbot(payload['email1'], payload['password1']) else: print("We submitted our account creation request " "but didn't get to the creation successful page.") print(submit.status_code) else: print(f"Creation failed. Error code {submit.status_code}")
def saveToDatabase(account, proxy=None): if USE_PROXIES: proxy_auth_type = get_user_settings()[1] if proxy_auth_type == 1: # Formatting based on user:pass auth # Formatting our proxy string to only save the IP proxy = str(proxy) proxy = proxy[proxy.find('@') + 1:] proxy = proxy[:proxy.find(':')] else: # Formatting based on IP authentication proxy = str(proxy) proxy = proxy[proxy.find('/') + 2:] proxy = proxy[:proxy.find("'")] else: proxy = get_ip() try: connection = psycopg2.connect(user="******", password="******", host="127.0.0.1", port="5432", database="accounts") cursor = connection.cursor() postgres_insert_query = """ INSERT INTO accounts (date_created, email, password, proxy) VALUES (now(),%s,%s,%s)""" record_to_insert = (account.get("email"), account.get("password"), proxy) cursor.execute(postgres_insert_query, record_to_insert) connection.commit() print("Username: {}, Password: {}, Proxy {}".format( account.get("email"), account.get("password"), proxy)) except (Exception, psycopg2.Error) as error: if (connection): print("Failed to insert record into accounts table", error) finally: # closing database connection. if (connection): cursor.close() connection.close()
""" Solves and returns the captcha answer via the anti-captcha.com service Documentation: https://pypi.org/project/python-anticaptcha/ Requirements: pip install python-anticaptcha """ import sys try: from python_anticaptcha import AnticaptchaClient, NoCaptchaTaskProxylessTask, AnticaptchaException from modules.helper_modules.utility import get_site_settings, get_user_settings except ImportError as error: print(error) SITE_URL = get_site_settings()[1] SITE_KEY = get_site_settings()[0] # osrs site key API_KEY = get_user_settings()[3] # api key read from settings.ini def anticaptcha_solver(): """Solves repcatcha via AntiCaptcha service""" print("Solving captcha, please wait...") client = AnticaptchaClient(API_KEY) task = NoCaptchaTaskProxylessTask(SITE_URL, SITE_KEY, is_invisible=True) while True: try: try: job = client.createTask(task) except AnticaptchaException as e: print(e) if e.error_id(2): print("No captcha solver available.. Retrying.")
print(error) HEADERS = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5)' ' AppleWebKit/537.36 (KHTML, like Gecko)' ' Chrome/58.0.3029.110 Safari/537.36' } try: PROXY_LIST = open("settings/proxy_list.txt", "r") except FileNotFoundError: sys.exit("proxy_list.txt wasn't found. " "Make sure it's in the same directory.") # Settings pulled from utility.py -> settings.ini file USE_PROXIES = get_user_settings()[0] NUM_OF_ACCS = get_user_settings()[4] SITE_URL = get_site_settings()[1] TRIBOT_ACTIVE = get_tribot_settings()[0] OSBOT_ACTIVE = get_osbot_settings()[0] def get_ip() -> str: """ Gets the user's external IP that will be used to create the account. Because of external dependency, we have a backup site to pull from if needed """ users_ip = requests.get('https://api.ipify.org').text if not users_ip: users_ip = requests.get('http://ip.42.pl/raw').text return users_ip
def use_tribot(charname, charpass, proxy=None): """Gets settings and runs Tribot CLI""" # Storing all of our settings while we're in the correct directory use_proxies = get_user_settings()[0] proxy_auth_type = get_user_settings()[1] tribot_username = get_tribot_settings()[1] tribot_password = get_tribot_settings()[2] tribot_script = get_tribot_settings()[3] script_args = get_tribot_settings()[4] if use_proxies: if proxy_auth_type == 1: proxy_username = format_current_proxy(proxy)[0] proxy_password = format_current_proxy(proxy)[1] proxy_host = format_current_proxy(proxy)[2] proxy_port = format_current_proxy(proxy)[3] else: proxy_host = format_current_proxy(proxy)[0] proxy_port = format_current_proxy(proxy)[1] original_path = os.getcwd() client = find_tribot() # Create our CLI command according to if we're using proxies or not if use_proxies: if proxy_auth_type == 1: # Using proxies with user:pass authentication cli_cmd = (f'java -jar {client} ' f'--username "{tribot_username}" --password "{tribot_password}" ' f'--charusername "{charname}" --charpassword "{charpass}" ' f'--script "{tribot_script}" --scriptargs "{script_args} " ' f'--charworld "433" ' f'--proxyhost "{proxy_host}" ' f'--proxyport "{proxy_port}" ' f'--proxyusername "{proxy_username}" ' f'--proxypassword "{proxy_password}" ') else: # Using proxies with IP based authentication cli_cmd = (f'java -jar {client} ' f'--username "{tribot_username}" --password "{tribot_password}" ' f'--charusername "{charname}" --charpassword "{charpass}" ' f'--script "{tribot_script}" --scriptargs "{script_args} " ' f'--charworld "433" ' f'--proxyhost "{proxy_host}" ' f'--proxyport "{proxy_port}" ') else: # Not using proxies cli_cmd = (f'java -jar {client} ' f'--username "{tribot_username}" --password "{tribot_password}" ' f'--charusername "{charname}" --charpassword "{charpass}" ' f'--script "{tribot_script}" --scriptargs "{script_args} " ' f'--charworld "433" ') print("") print("\nLoading tribot with the following settings...") print(cli_cmd) # Run the Tribot CLI in a separate, hidden shell to decrease clutter create_no_window = 0x08000000 subprocess.Popen(f"start /B start cmd.exe @cmd /k {cli_cmd}", shell=True, creationflags=create_no_window) # Changing back to the account creator directory # So we can see the settings.ini file for the next account. print(f"Changing our directory back to {original_path}") os.chdir(original_path)