[C++]Metin2 Packet Reader

08/29/2013 14:34 LoveCpp#1
Hello guys here is a video :


It returns like : packet header , arg2, arg3....

You can check packets or find out new packets to use.(For hacks or your pserver.)

NOTE : You can add this dll to your exe.(Initialize)

Source :
PHP Code:
#include "stdafx.h"
#include <iostream>
#include <detours.h>
#include <vector>
#include <io.h>
#include <fcntl.h>
using namespace std;

typedef int(__fastcall tHookPacketFunction)(intintunsigned intlong**a3); // int __thiscall sub_52AA90(int this, unsigned int a2, const void *a3)
tHookPacketFunction oHookPacketFunction;
void OpenConsole();

void OpenConsole()
{
    
int hCrtInhCrtOut;
    
FILE *conIn, *conOut;

    
AllocConsole();
    
hCrtIn _open_osfhandle((intptr_tGetStdHandle(STD_INPUT_HANDLE), _O_TEXT);
    
hCrtOut _open_osfhandle((intptr_tGetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
    
conIn _fdopen(hCrtIn"r");
    
conOut _fdopen(hCrtOut"w");
    *
stdin = *conIn;
    *
stdout = *conOut;
}

int __fastcall hHookPacketFunction(int a1int ebxunsigned int a2long **a3)
{
    
//int iVal = static_cast<int>(reinterpret_cast<BYTE*>(a3)[0]);
    
for (long i 0sizeof(a3); i++){
        if (
== sizeof(a3) - 1)
            
cout << static_cast<int>(reinterpret_cast<BYTE*>(a3)[i]) << endl;
        else if (
== 0)
            
cout << "Packet header : " << static_cast<int>(reinterpret_cast<BYTE*>(a3)[i]) << ", ";
        else
            
cout << static_cast<int>(reinterpret_cast<BYTE*>(a3)[i]) << ", ";
    }
    return 
oHookPacketFunction(a1ebxa2a3);
}

extern "C" __declspec(dllexportvoid __cdecl Initialize()
{
    
OpenConsole();
    
oHookPacketFunction = (tHookPacketFunctionDetourFunction((PBYTE0x0052AA90, (PBYTEhHookPacketFunction);
}

BOOL APIENTRY DllMain(HANDLE hModuleDWORD ul_reason_for_callLPVOID lpReserved)
{
    switch (
ul_reason_for_call)
    {
    case 
DLL_PROCESS_ATTACH:
        
CreateThread(NULL0reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL0NULL);
        break;
    case 
DLL_THREAD_ATTACH:
        break;
    case 
DLL_THREAD_DETACH:
        break;
    case 
DLL_PROCESS_DETACH:
        break;
    }
    return 
TRUE;

Epic credits : PoZHx
Max 8 bytes.

Compiled :
08/29/2013 14:38 TheMarv :<#2
Its not much, but well done :P

Can you send packets, either? Because I dont see a function for sending packets
08/29/2013 14:42 LoveCpp#3
i dont want to share much here.
sending packets is easy , but i didnt want to do though.
08/29/2013 14:51 TheMarv :<#4
Quote:
Originally Posted by [SA]Mentras View Post
Thanks4Share
Please use the "Thanks" button instead of making a new post
08/29/2013 15:52 LoveCpp#5
#dll added
08/29/2013 17:23 ricky92#6
That's probably the worst code snippet I've ever seen to print a byte sequence.
Why are you using all that UINT64 stuff? Just make "a3" a LPBYTE and access its data using a3[index]; also, you're declaring "i" as a 64-bit integer, which is really unnecessary, since the maximum value it will ever reach is 8!
08/29/2013 17:37 LoveCpp#7
Quote:
Originally Posted by ricky92 View Post
That's probably the worst code snippet I've ever seen to print a byte sequence.
Why are you using all that UINT64 stuff? Just make "a3" a LPBYTE and access its data using a3[index]; also, you're declaring "i" as a 64-bit integer, which is really unnecessary, since the maximum value it will ever reach is 8!
yeah so?
08/29/2013 19:03 ƬheGame#8
for (char i = 0; i < sizeof(a3); i++){ }
hätts auch getan wieso so ein UINT64 und so viel speicher vebrauchen?
08/29/2013 19:18 DexterSK#9
,,NOTE : You can add this dll to your exe.(Initialize)" how to add dll to exe? :)
08/29/2013 19:30 sema1995#10
Quote:
Originally Posted by DexterSK View Post
,,NOTE : You can add this dll to your exe.(Initialize)" how to add dll to exe? :)
Use LordPE.
08/29/2013 19:36 DexterSK#11
Quote:
Originally Posted by sema1995 View Post
Use LordPE.
And short tutorial :P
08/29/2013 23:03 [uLow]Beni#12
which packet function are you using, can u post a screenshot from ida/ce/olly ?
08/30/2013 00:02 KaMeR1337#13
Quote:
Originally Posted by !Beni! View Post
which packet function are you using, can u post a screenshot from ida/ce/olly ?
just use his pseudo code he used. as a pattern
08/30/2013 13:40 Zonni#14
Quote:
Originally Posted by DexterSK View Post
,,NOTE : You can add this dll to your exe.(Initialize)" how to add dll to exe? :)
change extension file from .dll to .mix and add to your metin2 client folder


it should run automatically when client starts
05/08/2014 12:52 TheTompa#15
how to find 0x0052AA90 adress ?