Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.17 KB | None | 0 0
  1. #include "ProudNetHax.h"
  2. #include "Tools.h"
  3. #include <stdio.h>
  4. #include <string>
  5. #include "NMCO\NMGeneral.h"
  6. #include "NMCO\NMFunctionObject.h"
  7. #include "NMCO\NMSerializable.h"
  8. #include "ThemidaSDK.h"
  9.  
  10. char* username = new char[PASSPORT_SIZE];
  11.  
  12. typedef BOOL(__cdecl* pNMCO_CallNMFunc)(int uFuncCode, BYTE* pCallingData, BYTE**ppReturnData, UINT32&  uReturnDataLen);
  13. pNMCO_CallNMFunc NMCO_CallNMFunc;
  14.  
  15. void MessageBoxFormat(const char* format, ...)
  16. {
  17.     char* messageBoxText = new char[1024];
  18.     va_list args;
  19.     va_start(args, format);
  20.     vsnprintf(messageBoxText, 1023, format, args);
  21.  
  22.     MessageBoxA(NULL, messageBoxText, 0, 0);
  23.  
  24.     va_end(args);
  25. }
  26.  
  27. BOOL NMCO_CallNMFunc_Hook(int uFuncCode, BYTE* pCallingData, BYTE**ppReturnData, UINT32&    uReturnDataLen)
  28. {
  29.     VM_START
  30.  
  31.     //CWvsApp::InitializeAuth
  32.     if (uFuncCode == kNMFuncCode_GetNexonPassport)
  33.     {
  34.         CNMSimpleStream* ssStream = new CNMSimpleStream(); // Memleaked actually.
  35.  
  36.         CNMGetNexonPassportFunc* pFunc = new CNMGetNexonPassportFunc(); // Memleaked actually.
  37.         pFunc->bSuccess = true;
  38.  
  39.         strcpy(pFunc->szNexonPassport, username);
  40.         printf(pFunc->szNexonPassport);
  41.  
  42.         pFunc->SetReturn();
  43.  
  44.         if (pFunc->Serialize(*ssStream) == false)
  45.             MessageBoxA(NULL, "Could not Serialize?!", 0, 0);
  46.  
  47.         *ppReturnData = ssStream->GetBufferPtr();
  48.         uReturnDataLen = ssStream->GetBufferSize();
  49.  
  50.         return TRUE;
  51.     }
  52.     else if (uFuncCode == kNMFuncCode_LoginAuth) {
  53.         CNMSimpleStream ssStream;
  54.         ssStream.SetBuffer(pCallingData);
  55.  
  56.         CNMLoginAuthFunc pFunc;
  57.         pFunc.SetCalling();
  58.         pFunc.DeSerialize(ssStream);
  59.  
  60.         memcpy(username, pFunc.szPassport, PASSPORT_SIZE);
  61.         //printf("Username: %s\r\n", username);
  62.  
  63.         // Return to the client that login was successful.. NOT
  64.         CNMSimpleStream* returnStream = new CNMSimpleStream(); // Memleaked actually.
  65.         CNMLoginAuthFunc* retFunc = new CNMLoginAuthFunc(); // Memleaked actually.
  66.         retFunc->SetReturn();
  67.         retFunc->nErrorCode = kLoginAuth_OK;
  68.         retFunc->bSuccess = true;
  69.  
  70.         if (retFunc->Serialize(*returnStream) == false)
  71.             MessageBoxA(NULL, "Could not Serialize?!", 0, 0);
  72.  
  73.         *ppReturnData = returnStream->GetBufferPtr();
  74.         uReturnDataLen = returnStream->GetBufferSize();
  75.  
  76.         return TRUE;
  77.     }
  78.     else if (uFuncCode == kNMFuncCode_SetLocale || uFuncCode == kNMFuncCode_Initialize || uFuncCode == kNMFuncCode_LoginAuth
  79.             || uFuncCode == kNMFuncCode_LogoutAuth || uFuncCode == kNMFuncCode_RegisterCallback || uFuncCode == kNMFuncCode_ResetCallback) {
  80.         return NMCO_CallNMFunc(uFuncCode, pCallingData, ppReturnData, uReturnDataLen);
  81.     }
  82.  
  83.  
  84.     MessageBoxFormat("Woops. Missing something: 0x%x.", uFuncCode);
  85.  
  86.     VM_END
  87.  
  88.     return NMCO_CallNMFunc(uFuncCode, pCallingData, ppReturnData, uReturnDataLen);
  89. }
  90.  
  91. BOOL HaxProudNet()
  92. {
  93.     VM_START
  94.  
  95.     HMODULE module = LoadLibrary("nmcogame");
  96.  
  97.     if (!module) {
  98.         printf("Could not find nmconew.");
  99.         return FALSE;
  100.     }
  101.  
  102.     DWORD address = (DWORD)GetProcAddress(module, "NMCO_CallNMFunc");
  103.  
  104.     if (!address) {
  105.         printf("Could not find NMCO_CallNMFunc.");
  106.         return FALSE;
  107.     }
  108.  
  109.     NMCO_CallNMFunc = (pNMCO_CallNMFunc)address;
  110.  
  111.     if (!SetHook(true, (PVOID*)&NMCO_CallNMFunc, (PVOID)NMCO_CallNMFunc_Hook))
  112.     {
  113.         return FALSE;
  114.     }
  115.  
  116.     VM_END
  117.  
  118.     return TRUE;
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement