Page 1 of 4 123 ... LastLast
Results 1 to 15 of 55

Thread: SenseHeading [works with seq 4.3.2]

  1. #1
    Hoihoi
    Guest

    SenseHeading [works with seq 4.3.2]

    enjoy

    gonna debug it tomorrow so it compiles with M$ VC

    Code:
    // $Header: /usr/local/cvsroot/senseheading/senseheading.c,v 1.4 2002/11/05 23:36:03 hoihoi Exp $
    
    #include <stdio.h>
    #include <string.h>
    #include <winsock2.h>
    #include <tlhelp32.h>
    #include <time.h>
    
    #define CONF_FILE "C:/senseheading/senseheading.conf"
    #define CONF_SIZE 16
    
    struct CONFIG
    {
    	unsigned long long SessionKeyLocation;
    	unsigned int SendInterval;
    	char seq_ip[16];
    	int seq_port;
    } config;
    
    int SendSessionKey(unsigned long long SessionKey);
    
    void readkey (HANDLE hProcess, int useConfig)
    {
    	while (1)
    	{
    		unsigned long addr;
    		unsigned long long key = 0xffffffffffffffff;
    
    		char keypressing;
    
    		if (useConfig == 0)
    		{
    			printf ("\nenter offset (ie: 0x00773b90): ");
    			if (scanf ("%08x", &addr) == 1)
    			{
    				printf ("offset:\t0x%08x\n", addr);
    			}
    		}
    		else
    			addr = config.SessionKeyLocation;
    
    		if (ReadProcessMemory (hProcess, (void *)addr, &key, 8, NULL) == 0)
    		{
    			printf ("ReadProcessMemory on 8 bytes at 0x%08x failed: %u\n", addr, GetLastError());
    		}
    		else
    		{
    			printf ("Session key:\t0x%016llx\n", (unsigned long long) key);
    
    			if ( useConfig == 1)
    			{
    				if (SendSessionKey(key) != SOCKET_ERROR)
    					printf("Sent the session key to %s:%d\n", config.seq_ip, config.seq_port);
    				else
    					printf("Failed to send the session key to %s:%d\n", config.seq_ip, config.seq_port);
    			}
    
    			if (config.SendInterval != 0)
    				sleep(config.SendInterval*1000);
    			else
    			{
    				printf("\nPress some key to continue");
    				scanf("%s", &keypressing);
    			}
    		}
    	}
    
    	fflush (stdin);
    }
    
    int scanproclist ( int useConfig )
    {
        HANDLE         hProcessSnap = NULL;
        PROCESSENTRY32 pe32      = {0};
    
        //  Take a snapshot of all processes in the system.
        hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    
        if (hProcessSnap == INVALID_HANDLE_VALUE)
            return 0;
    
        //  Fill in the size of the structure before using it.
        pe32.dwSize = sizeof(PROCESSENTRY32);
    
        if (Process32First(hProcessSnap, &pe32))
        {
    		HANDLE hProcess;
    
            do
            {
                LPSTR pCurChar;
    			char pName[512];
    
                // strip path and leave exe filename
                for (pCurChar = (pe32.szExeFile + strlen (pe32.szExeFile));
                     *pCurChar != '\\' && pCurChar != pe32.szExeFile - 1;
                     --pCurChar)
    
                strcpy(pName, pCurChar);
    			strlwr(pName);
    
    			if ( (strncmp (pName, "testeqgame", 10) == 0) || (strncmp (pName, "eqgame", 6) == 0) )
    			{
    				printf ("found eqgame - pid = %u\n\n", pe32.th32ProcessID);
    				hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
    				if (hProcess == NULL)
    				{
    					DWORD dw;
    					dw = GetLastError();
    					printf ("OpenProcess failed, error: %u\n", dw);
    					return 0;
    				}
    				readkey (hProcess, useConfig);
    			}
    	  }
            while (Process32Next(hProcessSnap, &pe32));
        }
    
        CloseHandle (hProcessSnap);
        return 0;
    }
    
    
    int ReadConfig (void)
    {
    	int useConfig = 0;
    	char conf_buffer[CONF_SIZE];
    
    	GetPrivateProfileString("Client", "SessionKeyLocation", "0", conf_buffer, CONF_SIZE, CONF_FILE);
    	config.SessionKeyLocation = strtol(conf_buffer,NULL,16);
    
    	GetPrivateProfileString("Client", "SendInterval", "0", conf_buffer, CONF_SIZE, CONF_FILE);
    	config.SendInterval = atoi(conf_buffer);
    
    	GetPrivateProfileString("ShowEQ", "IP", "0", conf_buffer, CONF_SIZE, CONF_FILE);
    	strcpy(config.seq_ip, conf_buffer);
    
    	GetPrivateProfileString("ShowEQ", "Port", "0", conf_buffer, CONF_SIZE, CONF_FILE);
    	config.seq_port = atoi(conf_buffer);
    
    	if (config.SessionKeyLocation > 0)
    		useConfig = 1;
    
    	return useConfig;
    }
    
    int SendSessionKey(unsigned long long SessionKey)
    {
    	int ret;
    	WSADATA wsd;
    	SOCKET ssocket;
    	SOCKADDR_IN seq;
    
    	if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0)
    	{
           printf("WSAStartup failed!\n");
    	   return SOCKET_ERROR;
    	}
    
    	ssocket = socket(AF_INET, SOCK_DGRAM, 0);
    	if (ssocket == INVALID_SOCKET)
    	{
    		printf("socket() failed; %d\n", WSAGetLastError());
    		return SOCKET_ERROR;
    	}
    
    	seq.sin_family = AF_INET;
    	seq.sin_port = htons((short)config.seq_port);
    	seq.sin_addr.s_addr = inet_addr(config.seq_ip);
    
    	ret = sendto(ssocket, &SessionKey, sizeof(unsigned long long), 0, (SOCKADDR *)&seq, sizeof(seq));
    	if (ret == SOCKET_ERROR)
    		return SOCKET_ERROR;
    
    	closesocket(ssocket);
    	WSACleanup();
    
    	return 0;
    }
    
    int main(void)
    {
    	printf ("scanning for eqgame.exe\n");
    
    	if (ReadConfig() == 1)
    		scanproclist(1);
    	else
    		scanproclist(0);
    
    	return 0;
    }
    :

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    951
    i assume 4.3.2 is just about to come out? i did a cvs -z3 update and didn't get anything but new maps :)

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    247
    4.3.2 is not currently "working as intended." I expect a release in the next 12 hours, just need to isolate a crash bug.

    fee

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    11
    HoiHoi has the code above changed since your last post?

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    19

    Wink

    Hoihoi

    I have MS VC 4.2 and when I compile your code i get the following:

    --------------------Configuration: senseheading - Win32 Debug--------------------
    Compiling...
    newbie.cpp
    C:\newbie.cpp(14) : error C2632: 'long' followed by 'long' is illegal
    C:\newbie.cpp(20) : error C2632: 'long' followed by 'long' is illegal
    C:\newbie.cpp(27) : error C2632: 'long' followed by 'long' is illegal
    C:\newbie.cpp(27) : warning C4305: 'initializing' : truncation from 'const unsigned __int64' to 'unsigned long'
    C:\newbie.cpp(27) : warning C4309: 'initializing' : truncation of constant value
    C:\newbie.cpp(48) : error C2632: 'long' followed by 'long' is illegal
    C:\newbie.cpp(59) : error C2065: 'sleep' : undeclared identifier
    C:\newbie.cpp(59) : error C2064: term does not evaluate to a function
    C:\newbie.cpp(96) : error C2001: newline in constant
    C:\newbie.cpp(96) : error C2015: too many characters in constant
    C:\newbie.cpp(97) : error C2105: '--' needs l-value
    C:\newbie.cpp(97) : error C2146: syntax error : missing ';' before identifier 'pCurChar'
    C:\newbie.cpp(147) : error C2632: 'long' followed by 'long' is illegal
    C:\newbie.cpp(171) : error C2632: 'long' followed by 'long' is illegal
    C:\newbie.cpp(171) : error C2664: 'sendto' : cannot convert parameter 2 from 'unsigned long *' to 'const char *' (new behavior; please see help)
    Error executing cl.exe.
    newbie.obj - 13 error(s), 2 warning(s)

    If I take out the long long and replace it with just long and recompile I get the following ( also I placed another \ in the line *pCurChar != '\' && pCurChar != pe32.szExeFile - 1:

    --------------------Configuration: senseheading - Win32 Debug--------------------
    Compiling...
    newbie.cpp
    C:\newbie.cpp(27) : warning C4305: 'initializing' : truncation from 'const unsigned __int64' to 'unsigned long'
    C:\newbie.cpp(27) : warning C4309: 'initializing' : truncation of constant value
    C:\newbie.cpp(59) : error C2065: 'sleep' : undeclared identifier
    C:\newbie.cpp(59) : error C2064: term does not evaluate to a function
    C:\newbie.cpp(171) : error C2664: 'sendto' : cannot convert parameter 2 from 'unsigned long *' to 'const char *' (new behavior; please see help)
    Error executing cl.exe.
    newbie.obj - 3 error(s), 2 warning(s)

    Any hints (notice I compiled the program as I am newbie) Please keep the Flames low

  6. #6
    Registered User
    Join Date
    Oct 2002
    Posts
    12
    You need to replace all the 'unsigned long long' with 'ULONGLONG'...

    You need to replace the call to 'sleep' with a call to 'Sleep'...

    For the error in line 171, you probably just need to explicitly cast the paramater to (char *)...

    You'll probably also need to add Ws2_32.lib to the libraries being linked in to the project.

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    19
    SEQLurker,

    Thanks man ULONGLONG was the answer I also included the w3s_32.lib and the sleep thing who would have thunk a cap S would have made a difference <grin> but I still get a warning:

    --------------------Configuration: senseheading - Win32 Debug--------------------
    Compiling...
    senseheading.c
    C:\senseheading.c(171) : warning C4133: 'function' : incompatible types - from 'unsigned __int64 *' to 'const char *'
    senseheading.obj - 0 error(s), 1 warning(s)


    /emote looks puzzled and bewildered at comment:

    For the error in line 171, you probably just need to explicitly cast the paramater to (char *)...

    I know the error is tellng me that I can't combine 2 different types but how can I make the change?

  8. #8
    Registered User
    Join Date
    Oct 2002
    Posts
    12
    Change this:
    Code:
    	ret = sendto(ssocket, &SessionKey, sizeof(unsigned long long), 0, (SOCKADDR *)&seq, sizeof(seq));
    To this:
    Code:
    	ret = sendto(ssocket, (char *) &SessionKey, sizeof(ULONGLONG), 0, (SOCKADDR *)&seq, sizeof(seq));

  9. #9
    Registered User
    Join Date
    Nov 2002
    Posts
    19
    SEQLurker

    You have the right from now until forever to /bonk me on the head anytime you want.

    Compiles without error... <big Grin>

    Sometimes you have to Pound learning into a warriors head after all our int isn't that great .. hehehe

  10. #10
    Registered User
    Join Date
    Feb 2002
    Posts
    4
    I have this sniffer up and running, looks like it is finding eqgame and the key and sending it off to my seq box, port 666. I have updated seq to 4.3.2 and told it to watch port 666. It doesn't seem that showeq is receiving the packet sent to it due to the fact that spawns are not showing up. Should I expect to see any mesasge in the output from showeq that a key has been recieved?

  11. #11
    Registered User
    Join Date
    Dec 2001
    Posts
    11
    Im having the same problem. Im seeing the packet from the eq machine to the seq machine but seq doesnt seem to be getting it correctly.

  12. #12
    Registered User
    Join Date
    Jan 2002
    Posts
    6
    Thanks Gang and Hoihoi, for this update, I guess I will scrap my auto updating code now. I had to include wsock32.lib to get by the linking errors on W98 solved. Does the latest cvs solve the Keyloading Lock up issue? was causing me problems with my auto updating code in decode before. Havent had a chance to look at decode.cpp yet.. Curious..

    < compiling atm > Will try it out..

    Thanks Again.
    Wxyz.

  13. #13
    Registered User
    Join Date
    Jan 2002
    Posts
    15

    Error while compiling under Dev-C++

    I'm using DEV-C++ and getting the following error... any help?

    line 96 C:\dev-c++\senseheading.c unterminated character constant


    Line 96 is this one (direct copy from up above).

    *pCurChar != '\' && pCurChar != pe32.szExeFile - 1;


    Thanks in Advance
    Last edited by fluke; 11-06-2002 at 10:52 PM.

  14. #14
    Registered User
    Join Date
    Nov 2002
    Posts
    5
    Change '\' to '\\'

  15. #15
    Registered User
    Join Date
    Jan 2002
    Posts
    15
    Thanks for the eyes Bel :-) . Should have jumped right out at me, of course I also ran out of gas on way home from work today too, and that should have jumped out at me too..hehe been one of those days.

    Fluke

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Posting Permissions

You may post new threads
You may post replies
You may post attachments
You may edit your posts
HTML code is Off
vB code is On
Smilies are On
[IMG] code is Off