Hey, I am having a problem converting ascii hex into actual hex in C.
This is what I am trying to do:
a.out -h 080483c4
I want to turn that hex number that is getting input in ASCII format to be converted into hex format in a character array like this:
myarray[4] : [0xc4][0x83][0x04][0x08] <= little indian
Does anyone know how to do this? I have looked all over and can't find out how. If anyone has a quick answer that would like to share... I appreciate it.
Second, read it in to a char array as a temp, then use sscanf on it. You can use that to parse out hex numbers (I believe the format is %2x to indicate 2 characters as hex). So it would look something like this (btw, this may not work 100%, this is going off the top of my head without testing it):
argv[2] is assumed to be the 080483c4 read from the command line, since you are passing in variables to main.
You were right on about the sscanf() command and the arguments. I was building a small/simple tool to allow me to easily exploit code vulnerable to stack overflows. I have uploaded the source code for it to my website.
I know you can do some tricks with python at the command line, but I like sticking to good old C and ASM. One thing to note if you are going to test out the code: You need to enter your Hex Address without 0x or 0X. That is something sscanf is suppose to handle... but doesn't (at least it doesn't appear to work for me). It can handle up to a 32bit address.
Joined: Fri 01-25-2002 12:35PM Posts: 316 Location: Your Mom
Source: CSF Building
Brandito wrote:
Thanks Cecil,
You were right on about the sscanf() command and the arguments. I was building a small/simple tool to allow me to easily exploit code vulnerable to stack overflows. I have uploaded the source code for it to my website.
I know you can do some tricks with python at the command line, but I like sticking to good old C and ASM. One thing to note if you are going to test out the code: You need to enter your Hex Address without 0x or 0X. That is something sscanf is suppose to handle... but doesn't (at least it doesn't appear to work for me). It can handle up to a 32bit address.
Thanks again, Brandon
Well my my, aren't you a l33t h4x0r.
_________________ All right, they're on our left, they're on our right, they're in front of us, they're behind us...they can't get away this time
-Lieutenant General Lewis B. Puller, USMC
Users browsing this forum: No registered users and 2 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum