|
-
Feb 22nd, 2003, 05:01 PM
#1
Thread Starter
Frenzied Member
Offset writing to file binary hex
How can i open a file and write to it while it not running. Lets say to change a value at a specific offset. i dont like write process memory thingy cuz the rogram has to be running. i want to do the change when the program isnt running.
What im trying to do is test the security of a program i have. My friend is trying to teach me how to make it hard to break into. So im trying to see if its possible .
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Feb 22nd, 2003, 08:15 PM
#2
Frenzied Member
Lemme see. You want to take an .EXE and write something into it?
Re-writing is trivial. Getting the re-written (patched if your intentions are honorable, hacked otherwise) to run is YOUR problem.
Here is a C fragment
Code:
FILE *out;
char *buffer="\x220\x019\x042"; // hex values - 3 bytes
long offset = 0xbb; // this is the position in the file
out=fopen"myfile.exe","rw");
fseek(out,offset,SEEK_SET); // file pointer is now somewhere in the middle of the file
fwrite(buffer,sizeof(buffer),1,out);
fclose(out);
-
Feb 22nd, 2003, 08:17 PM
#3
Frenzied Member
PS: image file headers (.EXE files) have checksums that you will have to change. You will have to learn image file structures as well.
See PE Image Help in MSDN (Imagehlp)
-
Feb 22nd, 2003, 10:42 PM
#4
Thread Starter
Frenzied Member
thanks this isnt for any other program crack thing or such. I want to see if i can learn why programs are so easy to crack and stuff.
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Feb 22nd, 2003, 10:43 PM
#5
Thread Starter
Frenzied Member
by the way the hex value why must it be 3 bytes? what if i only want to change 1 value
Originally posted by jim mcnamara
Lemme see. You want to take an .EXE and write something into it?
Re-writing is trivial. Getting the re-written (patched if your intentions are honorable, hacked otherwise) to run is YOUR problem.
Here is a C fragment
Code:
FILE *out;
char *buffer="\x220\x019\x042"; // hex values - 3 bytes
long offset = 0xbb; // this is the position in the file
out=fopen"myfile.exe","rw");
fseek(out,offset,SEEK_SET); // file pointer is now somewhere in the middle of the file
fwrite(buffer,sizeof(buffer),1,out);
fclose(out);
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Feb 23rd, 2003, 10:10 AM
#6
Doesn't matter. jim simply wrote some random values.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 23rd, 2003, 06:03 PM
#7
Thread Starter
Frenzied Member
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|