| View previous topic :: View next topic |
| Author |
Message |
kb3z0n Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 542
|
Posted: Thu Nov 20, 2008 10:29 pm Post subject: Hex editing in c++? |
|
|
Hey, i wanted to know if its possible to hex edit in C++..
As in i want to edit the TEXT, at a place.
I know you can do
fopen
fwrite
fclose.. etc.
But how do you edit text, instead of bytes?
|
|
| Back to top |
|
 |
SXGuy I post too much
Reputation: 0
Joined: 19 Sep 2006 Posts: 3551
|
Posted: Fri Nov 21, 2008 3:23 am Post subject: |
|
|
| im not an expert at c++ but in other languages i useually have to define what i wanna edit as ASCII
|
|
| Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Fri Nov 21, 2008 6:48 am Post subject: |
|
|
| Code: |
ofstream myfile;
myfile.open ("report.txt");
String mytext = "Hello this is my text =D";
myfile << mytext.c_str();
myfile.close();
|
=]
http://www.cplusplus.com/doc/tutorial/files.html
_________________
Gone |
|
| Back to top |
|
 |
sphere90 Grandmaster Cheater
Reputation: 0
Joined: 24 Jun 2006 Posts: 912
|
Posted: Fri Nov 21, 2008 6:58 am Post subject: Re: Hex editing in c++? |
|
|
| kb3z0n wrote: | Hey, i wanted to know if its possible to hex edit in C++..
As in i want to edit the TEXT, at a place.
I know you can do
fopen
fwrite
fclose.. etc.
But how do you edit text, instead of bytes? |
fopen
fprintf
fclose
|
|
| Back to top |
|
 |
kb3z0n Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 542
|
Posted: Fri Nov 21, 2008 10:58 am Post subject: |
|
|
| But i want to edit, a IP inside a exe file..At a sertain place.
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Nov 21, 2008 5:00 pm Post subject: |
|
|
just write the bytes of the ascii.
_________________
|
|
| Back to top |
|
 |
kb3z0n Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 542
|
Posted: Fri Nov 21, 2008 9:01 pm Post subject: |
|
|
| Uh, could you give me an example? D:
|
|
| Back to top |
|
 |
deleted19776 I post too much
Reputation: 11
Joined: 29 Apr 2007 Posts: 3838
|
Posted: Fri Nov 21, 2008 9:40 pm Post subject: |
|
|
| Aw dang it, I really want to edit bytes, so I can finish up my project.
|
|
| Back to top |
|
 |
kb3z0n Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 542
|
Posted: Fri Nov 21, 2008 9:47 pm Post subject: |
|
|
If your editing at a certain pointer, i have this code.
Credits to Rot1 for code..
| Code: |
FILE * pFile; //Declare A New FILE Variable
BYTE buffer[] = {0x01}; //Acc = 1
pFile = fopen("Mob.wz" , "r+"); //Use fopen (LZOpenFile/CreateFile) On The File With r+ Access mode (Read/Write)
fseek(pFile , 0x00000000 , SEEK_SET); //Use fseek (LZSeek/SetFilePointer) To Move Pointer To Location We Want (Offset [HEX]) From The Beggining Of The File (SEEK_SET)
fwrite (buffer , 1 , sizeof(buffer) , pFile ); //Use fwrite (LZWrite/WriteFile) To Write Buffer To File
fclose(pFile); //Use fclose (LZCloseFile/CloseFile) To Close The File
}
|
|
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Sat Nov 22, 2008 3:53 am Post subject: |
|
|
using that code above remove the fwrite() part and replace it with fprintf()
example.
| Code: |
// ASCII of "127.0.0.1"
fprintf (pFile, "127.0.0.1");
|
or
| Code: |
char ip[] = "127.0.0.1";
fprintf (pFile, "%s", ip);
|
_________________
|
|
| Back to top |
|
 |
|