0

How to run an executable file (.exe), which will be the program code, from memory without saving to disk?

  1. I have an .exe file stored as bytes. It was obtained using open('1.exe', 'rb').read().

  2. I put the byte literal in the Python code of a script: byteCode = b'\x00\x00\x00\...'.

  3. Now I need to run this executable. But from memory, without saving to disk.

5
  • 4
    Welcome to StackOverFlow! Have a look on How to create a Minimal, Reproducible Example and what is a good question. You will even have rewards at visiting those pages. You need to be specific and ask a clear question. Do you want to run .exe file with python? Commented Jul 6, 2019 at 17:37
  • It seems Op has the binary contents of an executable and wishes to run it without saving to disk first. Commented Jul 6, 2019 at 18:28
  • 1
    Based on this, it dosen't appear to be very easy. Writing to a temporary directory and running it from there seems easiest. Commented Jul 6, 2019 at 18:33
  • 1
    Is it a Win32 exe? What OS are you using/targeting? Why do you have to execute it from memory not disc? Why not just run 1.exe? Commented Jul 6, 2019 at 18:34
  • @wjandrea, yes it is Win32 exe. I am use Windows. Commented Jul 6, 2019 at 18:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.