Ради интереса хочу написать бэкдор на питоне. Подскажите как можно зашифровать код?
exec = executes the codeYou take the code, encrypt it, generate a source file that will decrypt it and execute it via eval, or exec, I don't remember exactly what this function was called in python.
For interest want to write backdoor on Python for Windows. want obfuscation to make it invisible for AVexec = executes the code
eval = evaluates your code (whatever it returns)
@Adventurer any reason for obfuscation? whats your target enviroment?
check out pyinstaller for compiling it to an executable, you can get around 2-4 / 40 detections that should do the trick for bypassing detections. if that doesn't work do something like this:For interest want to write backdoor on Python for Windows. want obfuscation to make it invisible for AV
#include your other imports
import base64
SCRIPT = b "your base64 encoded script here"
def run (script):
exec (base64.b64decode (script))
if __name__ == "__main__":
run (SCRIPT)
Also maybe you know how to reduce size of pyinstaller?check out pyinstaller for compiling it to an executable
Try nuitka. It may be smaller.pyinstaller
Pernat1y suggested another alternative decent alternative. Getting small sizes with python is a pain in the ass since its all interpreted. If you want small sizes you could possible compress it write a small C stub and decompress it at runtime (would result in some time delay though). Whats your payload doing? there is likely a C/C++ alternativeThanks for the info))this encryption is done for not bypassing AVs totally(in this case).
Also maybe you know how to reduce size of pyinstaller?
find an example coded in C/C++ at that point, will save you a lot of problemsYeah I am checking nuitka and it gives much smaller executable than pyinstaller. Payload is just reverse shell