How to force a program to write into his exe

A

Asipu

The problem is quite difficult and i'm starting to think that it's
impossible
to accomplish..

Suppose you have C.exe. When you run C.exe, it must change his 0x4e's byte
into 0xff.. Of course, when doing so - exception is raised because file is
in use..

Is there a way to do this without problems?
 
J

JKop

Asipu posted:
The problem is quite difficult and i'm starting to think that it's
impossible
to accomplish..

Suppose you have C.exe. When you run C.exe, it must change his 0x4e's
byte into 0xff.. Of course, when doing so - exception is raised because
file is in use..

Is there a way to do this without problems?

Assuming your platform is Windows:

It can't be done by the .exe file. Your options are:

A) Get you .exe file to open another .exe file, then close
itself, the other .exe file with edit the original. The
downside is that you won't be able to delete the second
..exe file.

B) Instead of using another .EXE file to edit the original,
write a batch file. The upside here is that a batch file
*can* delete itself.


-JKop
 
F

Flzw

And the question is :

Why would you even want to do that ? except if you had bad things in mind...
 
A

Asipu

Why would you even want to do that ?

Well the answer is twofold.. First, understanding security (and possibly
overriding it), and making a program that has output data in his own
exe file thus bypassing the need of second file for data storage
(also registry, DB conn, EventLog, other file, ..anything..)..

I know that to majority it seems like a stupid and unnecessary way to
accomplish simple data transfer, but with understranding those
"unusual" hidden procedures, i gain more insight into the broad
spectrum of the problem.
 
G

Gernot Frisch

Assuming your platform is Windows:
It can't be done by the .exe file. Your options are:

A) Get you .exe file to open another .exe file, then close
itself, the other .exe file with edit the original. The
downside is that you won't be able to delete the second
.exe file.

B) Instead of using another .EXE file to edit the original,
write a batch file. The upside here is that a batch file
*can* delete itself.

On Linux you can even delete a running executable, thus this seems to
be windows. If you run a batch file that will delete itself, there's 2
ways of deleting it. Depending on Win9x /NT kernel. The exe could
write a copy of itself, change it, write a batch file, close itself
and run the batch file.
If you're planning on writing a virus that mutates, you'd better
reconsider writing it and code something that is useful to people.
There's a lot of viruses already, we don't need new ones. More,
writing viruses always indicates failure in social life.
-Gernot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,949
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top