jcsn
June 10th, 2003, 13:58
Ok, this should be the most confusing post ever..
Basically, I have a mail program which sends "HELO (your_host_name)" to the mail server, and I'm trying to get it to send "HELO (random_string)."
I was able to change it and make it send a static string like "HELO yahoo.com," but my main problem with having it send a random string is converting the integer to a string. To get the "random" number, I'm calling GetTickCount, which (I think) sets EAX to it's return value.
I've read the other posts on this board about converting integers to string by using _wsprintfA. That isn't available in my target, but I found sprintf which seems to be the same, so that's what I've been using instead. NOW!
my problem (I think) is how I'm setting aside a buffer for sprintf to use. I tried opening the program in Hiew and finding a bunch of free space (bunch of 0's) and changing them to 20's for spaces, then passing the address of that for the buffer and it errors (well, freezes Olly). I also tried just pointing it to an address with a bunch of zero's and it errors, as it probably should.
I hope you understand what the hell I'm talking about.
Here's the sprintf changes I've made:
I changed (this is right after it gets "your_host_name" with gethostname, and the hostname is in EAX)
to
So this jumps to the extra sprintf code I'm putting in. Then..
Is this at all salvagable, or is it completely wrong? I know for sure it's at least a little bit wrong hehe

Basically, I have a mail program which sends "HELO (your_host_name)" to the mail server, and I'm trying to get it to send "HELO (random_string)."
I was able to change it and make it send a static string like "HELO yahoo.com," but my main problem with having it send a random string is converting the integer to a string. To get the "random" number, I'm calling GetTickCount, which (I think) sets EAX to it's return value.
I've read the other posts on this board about converting integers to string by using _wsprintfA. That isn't available in my target, but I found sprintf which seems to be the same, so that's what I've been using instead. NOW!

I hope you understand what the hell I'm talking about.

Here's the sprintf changes I've made:
I changed (this is right after it gets "your_host_name" with gethostname, and the hostname is in EAX)
Quote:
00464CFE . E8 B5FCF9FF CALL advanced.004049B8 |
to
Quote:
00464CFE /E9 B94D0800 JMP advanced.004E9ABA |
So this jumps to the extra sprintf code I'm putting in. Then..
Quote:
004E9ABA E8 6FCE9977 CALL KERNEL32.GetTickCount 004E9ABF 50 PUSH EAX ; GetTickCount return value? 004E9AC0 68 EE9A4E00 PUSH advanced.004E9AEE ; ASCII "%X" 004E9AC5 68 F19A4E00 PUSH advanced.004E9AF1 ; ASCII " " (there's more spaces, only shows one on messageboard) 004E9ACA E8 F0DCAA77 CALL ntdll.sprintf 004E9ACF A1 F19A4E00 MOV EAX,DWORD PTR DS:[4E9AF1] ; replace EAX, which has "my_host_name" with the GetTickCount output 004E9AD4 E8 DFAEF1FF CALL advanced.004049B8 004E9AD9 ^ E9 25B2F7FF JMP advanced.00464D03 |
Is this at all salvagable, or is it completely wrong? I know for sure it's at least a little bit wrong hehe
