PDA

View Full Version : Update only if new?



lane
11-14-2002, 07:12 AM
I thought I had seen code in one of these treads to only update the key only if it was new. I can't seem to find that bit of code now. If anyone knows where it is, or has some, please post. Doesn't matter whos version of sniffer or anything, I just need to see something.

Thanks all.

-Lane

DebianSEQ
11-14-2002, 12:59 PM
The Visual Basic version someone posted does this. I've moved to it for sheer ease of use, and is configurable without a recompile.

lane
11-14-2002, 06:34 PM
I thought I had found something "spiffier" than this, but it works. It will probably look like crap, but basically the code gets a new key (key), compares it to and onld key (tkey) if they are not the same then get a key from memory again (tkey) and send that to the linux box and beep so you know it got a new key.

This uses the code from senceheading. Not rocket science.



if (ReadProcessMemory (hProcess, (void *)addr, &key, 8, NULL) == 0)
{
printf ("ReadProcessMemory on 8 bytes at 0x%08x failed: %u\n", addr, GetLastError());
}
else
{
if (tkey != key)
{
tkey = key;
printf ("Session Special Code (Key):\t0x%016I64x\n", (unsigned long long) key);
if ( useConfig == 1)
{
if (SendSessionKey(key) != SOCKET_ERROR)
{
printf("Sent a new key to %s:%d\n", config.seq_ip, config.seq_port);
Beep (500,500);
}
else
printf("Failed to send new secret key to %s:%d\n", config.seq_ip, config.seq_port);
}
if (config.SendInterval != 0)
sleep(config.SendInterval*1000);
else
{
printf("\nPress some dang key:");
scanf("%s", &keypressing);
}
}
}


-Lane