Skip to content

Commit

Permalink
Add a request 'decryption' example
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanhrabcak committed Jan 21, 2023
1 parent bf13510 commit d03006a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/decrypt-request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from edupage_api.compression import RequestData
import zlib
from urllib.parse import unquote
import sys

if len(sys.argv) != 2:
print("Usage: python decrypt-request.py \"<request body>\"")
sys.exit(1)

pairs = sys.argv[1].split("&")

request_data = {}
for pair in pairs:
key, value = pair.split("=")
request_data[unquote(key)] = unquote(value)

s = request_data["eqap"]
compressed = RequestData.chromium_base64_decode(s[3:])

decompressed = zlib.decompress(bytes([ord(ch) for ch in compressed]), wbits=-15)
print(unquote(decompressed.decode()))

0 comments on commit d03006a

Please sign in to comment.