-
February 18th, 2004, 08:44 PM
#1
Member
converting asm(hex) into a char array '\xXX'
Hey,
I am writing some shellcode to exploit a service running on my machine. My goal is to spawn a shell, with system privlieges, and start a telnet service via commandline.
I have the C++/ASM code to acomplish this, my question is how to take the pertianit ASM code and convert it into a char array in C++.
IE:
0e 05 0a ff....blah blah blah
into:
Code:
char payload[] = "\x0e\x05\x0a\xff";
My ASM code comes from MSVC++'s debugger...
Thanks for any input
-
February 19th, 2004, 10:34 AM
#2
You are writing shellcode and you don't know how to convert a bunch of bytes to a char array?
How come you know how to write something as complex as shellcode but have no idea how to do this?
Oh oh.
Oliver's Law:
Experience is something you don't get until just after you need it.
-
February 20th, 2004, 09:39 PM
#3
Member
hey,
sorry for my unclear question. I know how to convert hex bytes into a char array, i was just wanting to hear other peoples ideas
Code:
char *hexArray = new char[32768];
char *outputArray = new char[3*strlen(hexArray)];
memset(&hexArray,'\x00',strlen(hexArray));
long int iPos = 0;
for(int i = 0; i < strlen(hexArray);i++)
{
outputArray[iPos] = '\\';
iPos++;
outputArray[iPos] = 'x';
iPos++;
outputArray[iPos] = hexArray[i]l
iPos++;
}
delete []hexArray;
delete []outputArray;
-
February 21st, 2004, 05:49 AM
#4
Junior Member
come cool shell coding tute,
it converts decimal to asm to hex so um i think gdb can convert back, if i find out a shell code ot do it ill post it for u,
right now i just reading have **** to do but ill work on a asm to hex and asm to decimal convertor maybe even a hex to dic :P
cheers
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
|
|