我在缓冲区中有一个可执行文件,我想在不将其写入文件的情况下执行该文件。这可能吗?我的代码示例:
with open("somefile.exe", "rb") as exe_file:
executable_string = exe_file.read()
run(executable_string)
def run(executable_string):
<code to make it run>
如果要模糊化正在通过网络传输的可执行文件,并且不希望它撞击磁盘,则更好的解决方案是将其作为DLL交付。使用SW_HIDE参数(使用ShellExecute或CreateProcess)创建一个诸如notepad.exe或Calc.exe的进程,然后使用“手动映射”注入DLL,该映射不需要磁盘上的文件,然后执行您的主要功能。