Din pricina faptului ca nu am gasit prea multe exemple pe internet, si eram curios daca poti rula cod python obfuscated pentru ca cere indentare, am scris script-ul asta inspirandu-ma de aici.
Folosind aceasta metoda este posibil sa stochezi codul si intr-o baza de date.
import base64
def encode(key, string):
encoded_chars = []
for i in xrange(len(string)):
key_c = key[i % len(key)]
encoded_c = chr(ord(string[i]) + ord(key_c) % 256)
encoded_chars.append(encoded_c)
encoded_string = "".join(encoded_chars)
return base64.urlsafe_b64encode(encoded_string)
def decode(key, string):
decoded_chars = []
decoded_string = base64.b64decode(string, '-_')
for i in xrange(len(decoded_string)):
key_c = key[i % len(key)]
decoded_c = chr(ord(decoded_string[i]) - ord(key_c) % 256)
decoded_chars.append(decoded_c)
decoded_string = "".join(decoded_chars)
return decoded_string
creator = "yo20063"
code = "g9ubo6SXU7bKVHiZYlObm1JSeV2gm5tSV5-Yme7ilZGkm5ealo86lqWlmdhSmZ5Wn-LippFqQFOZj1Kgop-h7Y-b"
if __name__ == "__main__":
exec(decode(creator, code))