Chat Logger

Page 1 of 5 12345 LastLast
Results 1 to 15 of 67
  1. #1
    Apprentice TwistedMind is offline
    MemberRank
    Sep 2010 Join Date
    11Posts

    Chat Logger

    updated
    logs with time now.
    made for june2007, july2008 and oct2008 just by changing the
    Code:
    #define June07
    Code:
    #include "stdafx.h"
    #include <stdio.h>
    #include <iostream>
    #include <fstream>
    #include <time.h>
    
    #include <detours.h>
    //#pragma comment( lib, "Detours.lib") //This isn't needed, don't know why I keep doing that
    
    #include <CDetour.h>
    #pragma comment( lib, "CDetour" )
    using namespace std;
    
    #define June07
    
    #ifdef June07
    const unsigned long MMatchServerGetInstanceAddress    = 0x0040ED00;
    const unsigned long MMatchServerGetObjectAAdress      = 0x00411090;
    const unsigned long MMatchServerOnChatRoomChatAddress = 0x00412B10;
    const unsigned long MMatchServerOnChannelChatAddress  = 0x00454E80;
    const unsigned long MMatchServerOnStageChatAddress    = 0x0045DEA0;
    const unsigned long MMatchObjectGetNameAddress        = 0x0040F180;
    #endif
    
    #ifdef July08
    const unsigned long MMatchServerGetInstanceAddress    = 0x0041E3C0;
    const unsigned long MMatchServerGetObjectAAdress      = 0x00420690;
    const unsigned long MMatchServerOnChatRoomChatAddress = 0x00421F80;
    const unsigned long MMatchServerOnChannelChatAddress  = 0x00471F20;
    const unsigned long MMatchServerOnStageChatAddress    = 0x0044B730;
    const unsigned long MMatchObjectGetNameAddress        = 0x0041E860;
    #endif
    
    #ifdef Oct08
    const unsigned long MMatchServerGetInstanceAddress    = 0x0041E640;
    const unsigned long MMatchServerGetObjectAAdress      = 0x00420960;
    const unsigned long MMatchServerOnChatRoomChatAddress = 0x00422280;
    const unsigned long MMatchServerOnChannelChatAddress  = 0x004729C0;
    const unsigned long MMatchServerOnStageChatAddress    = 0x0044B760;
    const unsigned long MMatchObjectGetNameAddress        = 0x0041EAA0;
    #endif
    
    struct MUID
    {
    	unsigned long Low;
    	unsigned long High;
    };
    
    struct MMatchObject
    {
        char* GetName( )
        {
            return ( ( char* ( __thiscall* ) ( LPVOID ) )MMatchObjectGetNameAddress )( this );
        }
    };
    
    struct MMatchServer
    {
        static MMatchServer* GetInstance( )
        {
            return ( ( MMatchServer *( __cdecl * )( ) )MMatchServerGetInstanceAddress )( );
        }
    
        MMatchObject* GetObjectA( MUID* uidPlayer )
        {
            return ( ( MMatchObject *( __thiscall * ) ( LPVOID, MUID* ) )MMatchServerGetObjectAAdress )( this, uidPlayer );
        }
    };
    
    char* Time( )
    {
    	time_t lTime;
    	struct tm* TM;
    
    	lTime = time( NULL );
    	TM = localtime( &lTime );
    
    	char szBuffer[25];
    	sprintf_s( szBuffer, "[%d:%d:%d]", TM->tm_mday, TM->tm_hour, TM->tm_min );
    
    	return szBuffer;
    }
    
    CDetour MMatchServerOnChatRoomChatDet;
    void WINAPI MMatchServerOnChatRoomChatHook( MUID* uidPlayer, const char* szMessage )
    {
    	ofstream ChatRoomFile;
    	char szBuffer[2000];
    	sprintf_s( szBuffer, "%s %s: %s\n", Time( ), MMatchServer::GetInstance()->GetObjectA( uidPlayer )->GetName( ), szMessage );
    	ChatRoomFile << szBuffer;
    
    	MMatchServerOnChatRoomChatDet.Org( uidPlayer, szMessage );
    }
    
    CDetour MMatchServerOnChannelChatDet;
    void WINAPI MMatchServerOnChannelChatHook( MUID* uidPlayer, MUID* uidChannel, char* szMessage )
    {
    	ofstream ChannelFile;
    	ChannelFile.open( "ChannelChat Log.txt", ios::app );
    
    	char szBuffer[2000];
    	sprintf_s( szBuffer, "%s %s: %s\n", Time( ), MMatchServer::GetInstance()->GetObjectA( uidPlayer )->GetName( ), szMessage );
    	ChannelFile << szBuffer;
    
    	MMatchServerOnChannelChatDet.Org( uidPlayer, uidChannel, szMessage );
    }
    
    CDetour MMatchServerOnStageChatDet;
    void WINAPI MMatchServerOnStageChatHook( MUID* uidPlayer, MUID* uidStage, char* szMessage )
    {
    	ofstream StageFile;
    	StageFile.open( "StageChat Log.txt", ios::app );
    
    	char szBuffer[4024];
    	sprintf_s( szBuffer, "%s %s: %s\n", Time( ), MMatchServer::GetInstance()->GetObjectA( uidPlayer )->GetName( ), szMessage );
    	StageFile << szBuffer;
    
    	MMatchServerOnStageChatDet.Org( uidPlayer, uidStage, szMessage );
    }
    
    DWORD WINAPI MainThread( )
    {
    	MMatchServerOnChatRoomChatDet.Detour( (PBYTE)MMatchServerOnChatRoomChatAddress, (PBYTE)MMatchServerOnChatRoomChatHook );
    	MMatchServerOnChatRoomChatDet.Apply( );
    
    	MMatchServerOnChannelChatDet.Detour( (PBYTE)MMatchServerOnChannelChatAddress, (PBYTE)MMatchServerOnChannelChatHook );
    	MMatchServerOnChannelChatDet.Apply( );
    
    	MMatchServerOnStageChatDet.Detour( (PBYTE)MMatchServerOnStageChatAddress, (PBYTE)MMatchServerOnStageChatHook );
    	MMatchServerOnStageChatDet.Apply( );
    
    	return 0;
    }
    
    extern "C" __declspec( dllexport ) BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
    {
    	DisableThreadLibraryCalls( hInstance );
    	if( dwReason == DLL_PROCESS_ATTACH )
    		CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)&MainThread, NULL, NULL, NULL );
    
    	return TRUE;
    }
    heres the outcome when I chatted in the channel.
    ChannelChat Log.txt:
    Code:
    [11:20:37] TwistedMind: phoenix is a little pecker 
    [11:20:37] TwistedMind: ;D
    [11:20:37] TwistedMind: rofl
    the time goes like this
    (day - hour - minute)

    inject into matchServer and itll do all the work.
    Attached Files Attached Files
    Last edited by TwistedMind; 12-09-10 at 06:49 AM.


  2. #2
    Account Upgraded | Title Enabled! ::.kakashi.:: is offline
    MemberRank
    May 2009 Join Date
    MarsLocation
    321Posts

    Re: Chat Logger

    Thanks man i realy needed that long time ago :/

  3. #3
    Account Upgraded | Title Enabled! killerzx is offline
    MemberRank
    Dec 2008 Join Date
    638Posts

    Re: Chat Logger

    thanks!
    about time someone released this :)

  4. #4
    Member WitchKoder is offline
    MemberRank
    Sep 2010 Join Date
    RaGEZONELocation
    78Posts

    Re: Chat Logger

    THanks very much

  5. #5
    Account Upgraded | Title Enabled! killerzx is offline
    MemberRank
    Dec 2008 Join Date
    638Posts

    Re: Chat Logger

    o-o
    it says im missing files o-o
    Can someone upload the dll for me? I'm getting errors

  6. #6
    Apprentice TwistedMind is offline
    MemberRank
    Sep 2010 Join Date
    11Posts

    Re: Chat Logger

    Quote Originally Posted by killerzx View Post
    o-o
    it says im missing files o-o
    Can someone upload the dll for me? I'm getting errors
    yes you need cdetour and detours v1.5 for it to work.

  7. #7
    Account Upgraded | Title Enabled! killerzx is offline
    MemberRank
    Dec 2008 Join Date
    638Posts

    Re: Chat Logger

    Quote Originally Posted by TwistedMind View Post
    yes you need cdetour and detours v1.5 for it to work.
    where do I get those? o.o

  8. #8
    Apprentice TwistedMind is offline
    MemberRank
    Sep 2010 Join Date
    11Posts

    Re: Chat Logger

    heres cdetour and detours.
    credits to lance for the cdetour library.

    edit
    also uploaded the binary.
    Attached Files Attached Files
    Last edited by TwistedMind; 12-09-10 at 02:49 AM.

  9. #9
    Member iHateFackers is offline
    MemberRank
    Aug 2010 Join Date
    72Posts

    Re: Chat Logger

    Nice release.

  10. #10
    Account Upgraded | Title Enabled! killerzx is offline
    MemberRank
    Dec 2008 Join Date
    638Posts

    Re: Chat Logger

    Quote Originally Posted by TwistedMind View Post
    heres cdetour and detours.
    credits to lance for the cdetour library.

    edit
    also uploaded the binary.
    One again, Thanks :D

    edit : i talked in the lobby, where do I get the logs? O_o
    I injected it into my june 2007 matchserver
    Last edited by killerzx; 12-09-10 at 03:36 AM.

  11. #11
    Sharing is caring KillerStefan is offline
    MemberRank
    Feb 2007 Join Date
    NetherlandsLocation
    2,554Posts

    Re: Chat Logger

    Does this work for all channels and if so, will the logs be divided in channels?
    I'm also wondering if this would work without problem for 2008 files when updating the addresses.

  12. #12
    Apprentice TwistedMind is offline
    MemberRank
    Sep 2010 Join Date
    11Posts

    Re: Chat Logger

    Quote Originally Posted by KillerStefan View Post
    Does this work for all channels and if so, will the logs be divided in channels?
    I'm also wondering if this would work without problem for 2008 files when updating the addresses.
    yes this does work for all channels unless you specify it for a certain channel, eg;
    Code:
    if( uidChannel->High == 1 ) //if the uidChannel is FreeChannel1
    {
        //stuff
    }
    
    if( uidChannel->High == 2 ) //if the uidChannel is FreeChannel2
    {
        //stuff
    }
    if you update the addresses it would work the same as it does on 2007.

    edit
    edit : i talked in the lobby, where do I get the logs? O_o
    I injected it into my june 2007 matchserver
    please read the source.
    Code:
    	ofstream ChannelFile;
    	ChannelFile.open( "ChannelChat Log.txt", ios::app );
    so it'll make a text document in your matchservers folder named 'channelchat log.txt'.
    Last edited by TwistedMind; 12-09-10 at 04:13 AM.

  13. #13
    Account Upgraded | Title Enabled! killerzx is offline
    MemberRank
    Dec 2008 Join Date
    638Posts

    Re: Chat Logger

    will it work on these channels? O_o
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <XML id="channel">
        <DEFAULTCHANNELNAME name="STR:CHANNEL_DEFAULT_NAME"/>
        <DEFAULTRULENAME name="elite"/>
        
        <CHANNEL name="testt" maxplayers="200" rule="elite" levelmin='1' levelmax='99'/>
        <CHANNEL name="test" maxplayers="200" rule="elite" levelmin='1' levelmax='99'/>
    </XML>
    edit :
    please read the source.
    Code:
        ofstream ChannelFile;
        ChannelFile.open( "ChannelChat Log.txt", ios::app );
    so it'll make a text document in your matchservers folder named 'channelchat log.txt'.
    I didn't auto make the file D:
    Last edited by killerzx; 12-09-10 at 04:19 AM.

  14. #14
    Apprentice TwistedMind is offline
    MemberRank
    Sep 2010 Join Date
    11Posts

    Re: Chat Logger

    Quote Originally Posted by killerzx View Post
    will it work on these channels? O_o
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <XML id="channel">
        <DEFAULTCHANNELNAME name="STR:CHANNEL_DEFAULT_NAME"/>
        <DEFAULTRULENAME name="elite"/>
        
        <CHANNEL name="testt" maxplayers="200" rule="elite" levelmin='1' levelmax='99'/>
        <CHANNEL name="test" maxplayers="200" rule="elite" levelmin='1' levelmax='99'/>
    </XML>
    edit :

    I didn't auto make the file D:
    yes it can, just find the uid of them channels and add a conditional statement (if).
    and no you dont need to make it, it will make it for you.

  15. #15
    Account Upgraded | Title Enabled! killerzx is offline
    MemberRank
    Dec 2008 Join Date
    638Posts

    Re: Chat Logger

    Quote Originally Posted by TwistedMind View Post
    yes it can, just find the uid of them channels and add a conditional statement (if).
    and no you dont need to make it, it will make it for you.
    oh..
    how do I find the uid of channels?
    Sorry if I'm asking too much, I'm not good
    at these stuff ):



Page 1 of 5 12345 LastLast

Advertisement