Пример #1
0
def add(user):
    id = user['id']
    if 'bot' not in user.keys() and not DataBase.Status(id):
        username = user['username']
        print(f"Adding {username} to database")
        newUser = DataBase(username, id, 0)
        newUser.GoToDB()
Пример #2
0
def create():
    try:
        response = None
        user = generate_username(1)[0]
        print("Getting new key...")
        captcha_key = hcaptcha.new()
        if not captcha_key:
            raise Exception("Failed to get captcha key")
        print("\033[33mSuccessfully received captcha key\033[0m")

        # For now we only want to invite, for not getting accounts ban uncomment the headers
        headers = {
            'Content-Type': 'application/json',
            #'Cookie': '__dcfduid=61f8ced90af24ebc9736ccf74c566850',
            #'X-Track': 'eyJvcyI6IkxpbnV4IiwiYnJvd3NlciI6IkNocm9tZSIsImRldmljZSI6IiIsInN5c3RlbV9sb2NhbGUiOiJlbi1VUyIsImJyb3dzZXJfdXNlcl9hZ2VudCI6Ik1vemlsbGEvNS4wIChYMTE7IExpbnV4IHg4Nl82NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzkxLjAuNDQ3Mi43NyBTYWZhcmkvNTM3LjM2IiwiYnJvd3Nlcl92ZXJzaW9uIjoiOTEuMC40NDcyLjc3Iiwib3NfdmVyc2lvbiI6IiIsInJlZmVycmVyIjoiIiwicmVmZXJyaW5nX2RvbWFpbiI6IiIsInJlZmVycmVyX2N1cnJlbnQiOiIiLCJyZWZlcnJpbmdfZG9tYWluX2N1cnJlbnQiOiIiLCJyZWxlYXNlX2NoYW5uZWwiOiJzdGFibGUiLCJjbGllbnRfYnVpbGRfbnVtYmVyIjo5OTk5LCJjbGllbnRfZXZlbnRfc291cmNlIjpudWxsfQ=='
        }
        payload = json.dumps({
            "username": user,
            "email": f"{user}@gmail.com",
            "password": password_gen(),
            "date_of_birth": "1998-05-14",
            "consent": True,
            "invite": invite if invite else None,
            "gift_code_sku_id": None,
            "captcha_key": captcha_key
        })
        print("Sending register...")
        response = requests.request("POST",
                                    register_url,
                                    headers=headers,
                                    data=payload)
        #is_valid(json.loads(response.text)["token"])
        if json.loads(response.text)["token"]:
            newUser = DataBase(user, 0, 0)
            newUser.GoToDB()
            print(
                f"Creating {user}, \033[32mSuccess\033[0m - {DataBase.Count()}"
            )
        else:
            raise Exception("failed to get token")
    except Exception as e:
        try:
            print(response.text)
        except:
            print(e)
        print(f"Creating {user}, \033[31mFailed\033[0m - {DataBase.Count()}")
Пример #3
0
def add_user(username, user_id):
    if not DataBase.Status(user_id):
        print(f"Adding {username} to database")
        newUser = DataBase(username, user_id, 0)
        newUser.GoToDB()