Ich möchte ein Python-Skript mit Unicode-Escape-Sequenzen verschleiern.Verschlüsseln eines Python-Skripts in Unicode-Escape-Sequenzen
Zum Beispiel
print("Hello World")
in Unicode-Escape-Sequenzen ist:
\x70\x72\x69\x6e\x74\x28\x22\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x22\x29
Aus meiner Befehlszeile ich dies mit erreichen kann:
$ python3 -c \x70\x72\x69\x6e\x74\x28\x22\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x22\x29
Hello World
schaffe ich habe ein file und lege die Unicode-Escape-Sequenz "Hello World" darin als Quellcode ab.
Aber wenn ich es laufen, erhalte ich:
$ python3 sample.py
SyntaxError: unexpected character after line continuation character
Wie kann ich Unicode-Escape-Sequenzen in meinem Quellcode.
Das Problem ist, Python als String liest, also wenn Sie 'exec (Unicode) ausführen' oder 'os .system ("python -c" + Unicode) ', bekomme ich den gleichen Fehler, da es eine Zeichenkette ist, fügt" "zum Unicode hinzu. – kingspp
Ihr Anspruch scheint falsch zu sein: '$ python3 -c \ x70 \ x72 \ x69 \ x6e \ x74 \ x28 \ x22 \ x48 \ x65 \ x6c \ x6c \ x6f \ x20 \ x57 \ x6f \ x72 \ x6c \ x64 \ Traceback x22 \ x29 (jüngste Aufforderung zuletzt): File "" Linie 1 in Nameerror: name 'x70x72x69x6ex74x28x22x48x65x6cx6cx6fx20x57x6fx72x6cx64x22x29' ist nicht –
Bakuriu
in jedem Fall defined' ich verstehe nicht, Ihre Prämisse. 'Hallo Welt' ** ist schon utf-8 **. Utf-8 ist eine Obermenge von 7-Bit-ASCII. – Bakuriu