SolvedMethods For Writing To File

Posts 1–8 of 8 · Page 1 of 1
Methods For Writing To File
I want to make an app where if certain conditions are met then it will create another file like an .exe or a .dll. The method i am thinking about using is fopen() then writing the bytes of the file i want to that file i created. I am sure there is a better solution because the method i am thinking of is kind of overkill. Any suggestions are appreciated.
Quote Originally Posted by 258456 View Post
I want to make an app where if certain conditions are met then it will create another file like an .exe or a .dll. The method i am thinking about using is fopen() then writing the bytes of the file i want to that file i created. I am sure there is a better solution because the method i am thinking of is kind of overkill. Any suggestions are appreciated.
What about it is overkill? If you wanna write a file out, you're going to need the file data one way or the other. Do note that people can easily extract the static exe binary from your program by running a PE scan over the file.
what do u mean they can extract it? like they can get the file just by the bytes?
Quote Originally Posted by 258456 View Post
what do u mean they can extract it? like they can get the file just by the bytes?

Yes, that's what I mean. If you're storing the bytes in your program, they will be in your program's binary. It's fairly simply then to (if you know it's an embedded exe), scan for, and extract it.
Quote Originally Posted by Jason View Post



Yes, that's what I mean. If you're storing the bytes in your program, they will be in your program's binary. It's fairly simply then to (if you know it's an embedded exe), scan for, and extract it.
aw crap. I was afraid of that. Well the only other option is to download off of a server but that's not logical in my case. I think I will just put some protective measures on the file to be written along with the client application that holds the bytes.
If you encrypt the entire binary before storing it as a resource other people extracting the file should not be a problem.
Create a appliaction that reads the binary of a file, encrypts the data and then writes it to the end of the file you want to store it in.
Then in the appliaction where the "resource" is stored create a function thats reads from the application itself, decrypts the data and deploys it to a copy of the original file.


Edit: I guess encrypting binary is the most easy thing to do.
I wrote a .NET library a while ago that does something similar to what Variant suggested. It basically nests and file within a PE file (.dll/.exe) as encrypted data. Then, only the calling exe (the one with the file nested within it) can extract the file. (Well, unless someone knew how the file was stored/encrypted and where the keys were etc, then they could just reverse the process manually)
I like this idea. I will encrypt my bytes. thx guys.
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us