Skip to content

Instantly share code, notes, and snippets.

@linxlunx
Last active February 10, 2022 23:23
Show Gist options
  • Save linxlunx/1718c584074cd11633bba546873999e9 to your computer and use it in GitHub Desktop.
Save linxlunx/1718c584074cd11633bba546873999e9 to your computer and use it in GitHub Desktop.
Teblak Katla
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
import json
import base64
def new_decoder(encoded):
equalsigns = '=' * int(encoded[-1])
chars = []
for index, char in enumerate(list(encoded[:-1])):
num = 1 if index % 2 == 0 else -1
char_code = ord(char) - num
chars.append(chr(char_code))
new_encoded = ''.join(chars) + equalsigns
decoded = base64.b64decode(new_encoded)
return decoded.decode('utf-8')
# get page
resp = requests.get('https://katla.vercel.app').text
# find json data
re_json = '<script id="__NEXT_DATA__" type="application/json">(.*)</script></body></html>'
find_data = re.findall(re_json, resp)[0]
json_data = json.loads(find_data)
# find hash
hash_text = json_data['props']['pageProps']['hashed']
hashed = new_decoder(hash_text)
word = new_decoder(hashed.split('::')[0])
print('katla:', word.upper())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment