Skip to content

Instantly share code, notes, and snippets.

@Fogapod
Created August 8, 2020 15:43
Show Gist options
  • Save Fogapod/ff07a02a948bf5546bea2d2d2d25bbd7 to your computer and use it in GitHub Desktop.
Save Fogapod/ff07a02a948bf5546bea2d2d2d25bbd7 to your computer and use it in GitHub Desktop.
import base64
import itertools
from datetime import datetime, timezone
TOKEN_EPOCH = 1293840000
CRYPTO_PART_LEN = 27 # seem to be constant
CHARLES_ID = 505532526257766411
# https://discordapp.com/channels/336642139381301249/381963689470984203/741631031508992063
shuffled_token = "1.zu.xueDXj_YATUTT4IDqTykNNX2KmhNN2NUKMxjzhkiATwv18XkLE3qMU"
id_part = base64.b64encode(str(CHARLES_ID).encode()).decode()
shuffled_token = shuffled_token.replace(".", "")
for c in id_part:
shuffled_token = shuffled_token.replace(c, "", 1)
print(f"Remaining entropy: {shuffled_token}")
min_date = datetime(2018, 1, 1).replace(tzinfo=timezone.utc).timestamp()
max_date = datetime(2020, 8, 8).replace(tzinfo=timezone.utc).timestamp()
date_permutations = itertools.combinations(
shuffled_token, len(shuffled_token) - CRYPTO_PART_LEN
)
with open("possible_tokens.txt", "a") as f:
for i, date_part in enumerate(date_permutations):
try:
date = (
int.from_bytes(base64.standard_b64decode(f"{date_part}=="), "big")
+ TOKEN_EPOCH
)
if not (min_date <= date <= max_date):
continue
except Exception:
continue
finally:
if i % 100_000 == 0:
crypto_part = shuffled_token
for c in date_part:
crypto_part = crypto_part.replace(c, "", 1)
print("loop", i, "".join(date_part), crypto_part)
crypto_part = shuffled_token
for c in date_part:
crypto_part = crypto_part.replace(c, "", 1)
f.write(f"{id_part}.{''.join(date_part)}.{crypto_part}\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment