Encode/decode target URL with urlsafe functions.

This commit is contained in:
Darko Poljak 2015-10-13 10:09:05 +02:00
parent 0630e5f841
commit 35d85e05ab

4
x.py
View file

@ -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)