• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 6 of 6

    Thread: My first :)

    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      vmv's Avatar
      Join Date
      May 2013
      Posts
      14
      Thanks (-->)
      1
      Thanks (<--)
      2

      My first :)

      John Kittz
      Hello folks,
      I'm very new in this business and like all of you i want to learn everything

      I have this code...made from scratch...from here and there...and it is working nice but its crashing the game very often:

      Code:
      #include "stdafx.h"
      #include <Windows.h>
      #include <tlHelp32.h>
      #include <stdio.h>
      #include <iostream>
      using namespace std;
      
      DWORD GetAddress (int PointerLevel, HANDLE hProcess, DWORD Offsets[], DWORD BaseAddress)
      {
      DWORD pTemp; DWORD PointerAddress; DWORD Pointer = BaseAddress;
      for(int c = 0; c < PointerLevel; c++) { if(c == 0) {
      ReadProcessMemory(hProcess, (LPCVOID)Pointer, &pTemp, sizeof(pTemp), NULL); }
      PointerAddress = pTemp + Offsets[c];
      ReadProcessMemory(hProcess, (LPCVOID)PointerAddress, &pTemp, sizeof(pTemp), NULL); }
      return PointerAddress;
      }
      
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwPid, TCHAR *szModuleName)
      {
         DWORD_PTR dwModuleBaseAddress = 0;
         HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPid);
         if (hSnapshot != INVALID_HANDLE_VALUE)
         {
      	  MODULEENTRY32 ModuleEntry32;
      	  ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
      	  if (Module32First(hSnapshot, &ModuleEntry32))
      	  {
      		 do
      		 {
      		    if (_tcscmp(ModuleEntry32.szModule, szModuleName) == 0)
      		    {
      			   dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
      			   break;
      		    }
      		 }
      		 while (Module32Next(hSnapshot, &ModuleEntry32));
      	  }
      	  CloseHandle(hSnapshot);
         }
         return dwModuleBaseAddress;
      }
      
      int _tmain(int argc, _TCHAR* argv[])
      {
      HWND hwnd = FindWindow (0, _T("Dishonored"));
      HANDLE hProcess;
      DWORD dwPid;
      if(!hwnd) cout << "Error: Cannot find the game\n";
      GetWindowThreadProcessId(hwnd, &dwPid);
      hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, dwPid);
      if(!hProcess) cout << "Error: Cannot open process\n";
          DWORD baseAddress = dwGetModuleBaseAddress(dwPid, "NxCharacter.dll");
          DWORD staticOffset = 0x001A6563;
          DWORD ammoAddress = baseAddress + staticOffset;
          DWORD ammoPointers[] = {0xbc, 0x0, 0x4, 0x4e9};
          DWORD Address = GetAddress (4, hProcess, ammoPointers, ammoAddress);
      
      int arrows;
      int newValue = 999;
      if(!ReadProcessMemory (hProcess, (BYTE*)Address, &arrows, sizeof(arrows), NULL))
      cout << "Error: Failed to read memory\n"; else cout << "Value found: " << arrows << "\n";
      while(1) { Sleep(1);
      if(!WriteProcessMemory (hProcess, (BYTE*)Address, &newValue, sizeof(newValue), NULL))
      cout << "Error: Failed to write to memory\n"; else Sleep(600000); cout << "New Value: " << arrows << "\n";
      }
      std::cin.get();
      return 0;
      }

      What is wrong with it ?
      Thank you,

    2. #2
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      491
      Attach a debugger to your cheat, catch exceptions and see where it goes wrong
      My first :)

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      vmv's Avatar
      Join Date
      May 2013
      Posts
      14
      Thanks (-->)
      1
      Thanks (<--)
      2
      The error comes always with that dll..... "NxCharacter.dll".
      If i try to attach any debugger...the game closes.

      edit: it's weird...but this error is coming only if i go to a specific place.
      Last edited by vmv; 06-07-2013 at 05:37 AM.

    4. #4
      Banned
      Learning to hack games!
       
      Feeling Normal
       
      Xenon's Avatar
      Join Date
      Jun 2013
      Posts
      5
      Thanks (-->)
      1
      Thanks (<--)
      0
      Use Visual Studios debugger. Attach it, and inject to the game. Remember the bp's.

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      vmv's Avatar
      Join Date
      May 2013
      Posts
      14
      Thanks (-->)
      1
      Thanks (<--)
      2
      Are this 2 codes doing the same thing ? :

      Code:
      HMODULE RemoteGetModuleHandle(HANDLE hProcess, LPSTR lpszModuleName) // by Napalm
      {
      	HMODULE hModule = NULL;
      	if(hProcess != NULL){
      		DWORD dwSize = lstrlen(lpszModuleName) + 1;
      		LPBYTE lpszModuleRemoteName = (LPBYTE)VirtualAllocEx(hProcess, NULL, dwSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
      		if(lpszModuleRemoteName != NULL){
      			WriteProcessMemory(hProcess, lpszModuleRemoteName, lpszModuleName, dwSize, NULL);
      			HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0,
      				(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandleA("kernel32.dll"),
      				"GetModuleHandleA"), lpszModuleRemoteName, 0, NULL);
      			if(hThread != NULL)
      			{
      				DWORD dwWaitResult = WaitForSingleObject(hThread, 1000);
      				if(dwWaitResult != WAIT_TIMEOUT)
      					GetExitCodeThread(hThread, (LPDWORD)&hModule);
      				CloseHandle(hThread);
      			}
      			VirtualFreeEx(hProcess, lpszModuleRemoteName, dwSize, MEM_RELEASE);
      		}
      	}
      	return hModule;
      }
      Code:
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwPid, TCHAR *szModuleName)
      {
         DWORD_PTR dwModuleBaseAddress = 0;
         HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPid);
         if (hSnapshot != INVALID_HANDLE_VALUE)
         {
            MODULEENTRY32 ModuleEntry32;
            ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
            if (Module32First(hSnapshot, &ModuleEntry32))
            {
               do
               {
                  if (_tcscmp(ModuleEntry32.szModule, szModuleName) == 0)
                  {
                     dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
                     break;
                  }
               }
               while (Module32Next(hSnapshot, &ModuleEntry32));
            }
            CloseHandle(hSnapshot);
         }
         return dwModuleBaseAddress;
      }
      I will try to attach the debugger to the game and write here the results.

      Thank you,

    6. #6
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      vmv's Avatar
      Join Date
      May 2013
      Posts
      14
      Thanks (-->)
      1
      Thanks (<--)
      2
      Cheats'n'Trainers
      Ok, this is my final work....my brain doesn't helping me anymore :|

      Code:
      #include "stdafx.h"
      #include <windows.h>
      #include <tlHelp32.h>
      #include <stdio.h>
      #include <iostream>
      using namespace std;
      
      int privileges(){ HANDLE Token; TOKEN_PRIVILEGES tp;
          if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&Token)){
      	LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid);tp.PrivilegeCount = 1;
      	tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
      	if (AdjustTokenPrivileges(Token, 0, &tp, sizeof(tp), NULL, NULL)==0){
         	return 1;}else{return 0;}}return 1;}
      
      DWORD GetAddress (int PointerLevel, HANDLE hProcess, DWORD BaseAddress, DWORD Offsets[]){
      	DWORD pTemp;  DWORD PointerAddress;  DWORD Pointer = BaseAddress;
      	for(int c = 0; c < PointerLevel; c++) {	if(c == 0) { 
      	ReadProcessMemory(hProcess, (LPCVOID)Pointer, &pTemp, sizeof(pTemp), NULL); }
      	PointerAddress = pTemp + Offsets[c];
      	ReadProcessMemory(hProcess, (LPCVOID)PointerAddress, &pTemp, sizeof(pTemp), NULL); }
      	return PointerAddress; }
      
      DWORD GetModuleBase (DWORD dwPid, TCHAR *szModuleName) { DWORD dwModuleBase = 0;
         HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPid);
         if (hSnapshot != INVALID_HANDLE_VALUE) {  MODULEENTRY32 ModuleEntry32;  ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
         if (Module32First(hSnapshot, &ModuleEntry32)) { do { if (_tcscmp(ModuleEntry32.szModule, szModuleName) == 0) {
         dwModuleBase = (DWORD)ModuleEntry32.modBaseAddr; break; }} while (Module32Next(hSnapshot, &ModuleEntry32)); }
         CloseHandle(hSnapshot); } return dwModuleBase; }
      
      int _tmain(int argc, _TCHAR* argv[]) {
      
      	HWND hwnd = FindWindow (0, _T("GAME"));
      	HANDLE hProcess;  DWORD dwPid;  int privileges();
      	GetWindowThreadProcessId(hwnd, &dwPid);
      	hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, dwPid);
      	if(!hProcess) cout << "error: cannot open process\n";
      
          DWORD dllBase        = GetModuleBase(dwPid, _T("base.dll"));
          DWORD atkAddress     = dllBase + 0x001C1568;
          DWORD atkPointer[]   = {0xdc, 0x0, 0x254, 0x4ea};
          DWORD rwAddress      = GetAddress (4, hProcess, atkAddress, atkPointer);
      	
      	int atk; int atkNew = 1200;
      
      	if(!ReadProcessMemory (hProcess, (BYTE*)rwAddress, &atk, sizeof(atk), NULL)) 
      	cout << "error: failed to read the memory\n";	else cout << "value found: " << atk << "\n";
      
      	while(1) { Sleep(1);
      	WriteProcessMemory (hProcess, (BYTE*)rwAddress, &atkNew, sizeof(atkNew), NULL); }
      
      	CloseHandle(hProcess);
      	std::cin.get(); 
      	return 0;
      }
      The code is working fine and gives no errors.
      The game also its working fine until ...i change the place...or teleport somewhere else.
      Also the hack it's stopping when i do that and i have to restart it to work again.
      The game is online. And when i move to other map the address is changing always. So there must be something with the way is getting to the base address+pointers....
      Often the game and only the game is crashing.
      So in my humble opinion....there is something wrong with the code or is not what i need...

      I can't attach any debugger to the game because it's just closing instantly.

      Any idea ?

      Thank you,