1
0
Fork 0
Scripts/urle.py
2021-06-30 00:36:37 +02:00

14 lines
289 B
Python
Executable file

#!/usr/bin/env python3
# Brutal URL encoding of whatever string is passed as argument.
import binascii
import sys
s = sys.argv[1].encode()
h = binascii.hexlify(s).decode()
encoded = ""
for i in range(len(h) // 2):
byte = h[i * 2 : i * 2 + 2]
encoded += "%" + byte
print(encoded)