Created
September 17, 2023 09:35
-
-
Save neckothy/5c8e2f9bb10876c83a9e090491071909 to your computer and use it in GitHub Desktop.
get valid x-mgpk-hash headers for requests to a certain terrible manga platform nobody should be supporting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# original PoC from sometime in May, should still work | |
# valid for both APIs (JP/US) | |
import hashlib | |
# returned on register, login, etc | |
HASH_KEY = "" | |
# my PoC, cleaned up by someone much smarter than me (ty boss) | |
def get_mgpk_hash(params): | |
sha_256 = hashlib.sha256() | |
for k, v in sorted({"hash_key": HASH_KEY, **params}.items()): | |
sha_256.update(bytes(hashlib.md5(bytes(v, "utf-8")).hexdigest(), "utf-8")) | |
return sha_256.hexdigest() | |
params = { ... } | |
headers = { ... } | |
headers["x-mgpk-hash"] = get_mgpk_hash(params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment