From 35d85e05aba1926fa437ac2f835e92431f313b84 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Tue, 13 Oct 2015 10:09:05 +0200 Subject: [PATCH] Encode/decode target URL with urlsafe functions. --- x.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x.py b/x.py index 4be88b8..a50e8e8 100644 --- a/x.py +++ b/x.py @@ -89,7 +89,7 @@ def x(url): # allow only one request at a time with lock: durl = str.encode(url) - durl = base64.b64decode(durl) + durl = base64.urlsafe_b64decode(durl) durl = zlib.decompress(durl) aes = aes_new() durl = aes.decrypt(durl) @@ -134,7 +134,7 @@ if __name__ == "__main__": foo = str.encode(sys.argv[2]) foo = aes.encrypt(foo) foo = zlib.compress(foo) - foo = base64.b64encode(foo) + foo = base64.urlsafe_b64encode(foo) stdout_write(foo) print() sys.exit(0)