0

I was trying to create a utility that generates an self extracting executable, containing a pregenerated executable and a dynamically generated text file.

I have looked, i may be looking with the wrong keywords, but i have not been able to find anything that would help.

  • 1
    Welcome to StackOverflow, please read about how to ask questions here: https://stackoverflow.com/help/how-to-ask Try to include some of the work that you have done so far, and describe more precisely the problem that you're facing – Miraziz Jan 31 '21 at 16:22
  • You can probably append whatever you want to an exe and it will work – xanatos Jan 31 '21 at 16:23
  • is there an api to read and write from the executable? if so i didnt find it – mildlycompetentprogrammer Jan 31 '21 at 16:23

1 Answers1

1

Quick-n-dirty way

You can append whatever you want to an exe and it will work. So you have your pre-made fixed exe unpacker. You append to it an easily-to-find byte sequence, then you append the file. Or better, you append the file to the stub and then append the length as an int64. So in the unpacker you take a look at the last 8 bytes, see how much big is the payload, then you read the payload. No magic sequence necessary. See appending data to an exe for some suggestions.

Better way

You use mono.cecil to modify the exe stub and add as a resource the compressed content. Here there is a question about the argument.

xanatos
  • 109,618
  • 12
  • 197
  • 280