Source:Warcraft3NameSpoofer

From Codemotion
Jump to: navigation, search

Source:Warcraft3NameSpoofer

Contents

Description

A "namespoofer" for the PC game Warcraft 3 (version 1.22).

Source

  1. #include <windows.h>
  2. #include <psapi.h>
  3. #include <iostream>
  4. #include <Tlhelp32.h>
  5. #include <fstream>
  6. #include "colors.cpp"
  7.  
  8.  using namespace std; 
  9.  
  10.  // Debug Priviledges.
  11.  
  12.  void EnableDebugPriv( )
  13.  {HANDLE hToken;
  14.  LUID sedebugnameValue;
  15.  TOKEN_PRIVILEGES tkp;
  16.  OpenProcessToken( GetCurrentProcess( ), TOKEN_ADJUST_PRIVILEGES |TOKEN_QUERY, &hToken );
  17.  LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &sedebugnameValue );
  18.  tkp.PrivilegeCount = 1;tkp.Privileges[0].Luid = sedebugnameValue;
  19.  tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  20.  AdjustTokenPrivileges( hToken, false, &tkp, sizeof( tkp ), NULL, NULL );
  21.  CloseHandle( hToken );
  22.  } 
  23.  
  24.  int main()
  25.  {
  26.     SetConsoleTitle("GayPimp's Namespoofer for Warcraft III 1.22.");
  27.     SetColor(7);
  28.     cout <<"              ||||||||||||||||||||||||||||||||||||||||||||||||||||\n";
  29.     SetColor(-20);
  30.     cout <<"              ~GayPimp's ";
  31.     SetColor(-2);
  32.     cout <<"N";
  33.     SetColor(2);
  34.     cout <<"a";
  35.     SetColor(3);
  36.     cout <<"m";
  37.     SetColor(4);
  38.     cout <<"e";
  39.     SetColor(5);
  40.     cout <<"s";
  41.     SetColor(6);
  42.     cout <<"p";
  43.     SetColor(7);
  44.     cout <<"o";
  45.     SetColor(8);
  46.     cout <<"o";
  47.     SetColor(9);
  48.     cout <<"f";
  49.     SetColor(10);
  50.     cout <<"e";
  51.     SetColor(11);
  52.     cout <<"r";
  53.     SetColor(12);
  54.     cout <<" for Warcraft III 1.22.0.6328~\n";
  55.     SetColor(7);
  56.     cout <<"              ||||||||||||||||||||||||||||||||||||||||||||||||||||\n" << endl; 
  57.     SetColor(10);
  58.     cout <<"        Do NOT use this program before playing a Battle.net Ladder game." << endl << endl;
  59.  
  60.     SetColor(-2);
  61.     cout <<"         Yellow:           |CFFFFFF00     ";
  62.     SetColor(2);  
  63.     cout <<"NinjaTurtleGreen: |CFF008000" << endl;
  64.     SetColor(3);
  65.     cout <<"         Pale Blue:        |CFF008080     ";
  66.     SetColor(4);
  67.     cout <<"Wine Red:         |CFF800000" << endl;
  68.     SetColor(5);
  69.     cout <<"         Purple:           |CFF800080     "; 
  70.     SetColor(6);
  71.     cout <<"Mustard:          |CFF808000" << endl;
  72.     SetColor(7);
  73.     cout <<"         Pale Grey:        |CFFC0C0C0     "; 
  74.     SetColor(8);
  75.     cout <<"Grey:             |CFF808080" << endl;
  76.     SetColor(9);
  77.     cout <<"         Blue:             |CFF0000FF     "; 
  78.     SetColor(10);  
  79.     cout <<"Green:            |CFF00FF00" << endl;
  80.     SetColor(11);
  81.     cout <<"         Cyan:             |CFF00FFFF     ";
  82.     SetColor(12);
  83.     cout <<"Red:              |CFFFF0000" << endl;
  84.     SetColor(-3);
  85.     cout <<"         Pink:             |CFFFF0000     ";
  86.     SetColor(-1);
  87.     cout <<"White:            |CFFFFFFFF" << endl;
  88.     SetColor(1);
  89.     cout <<"         Teal:             |CFF000080     ";
  90.     SetColor(-1);
  91.     cout <<"Black:            |CFF000000     " << endl <<endl;
  92.     cout <<"Detecting Battle.net lobby... " << endl <<endl;
  93.     SetColor(11);
  94.  
  95.  EnableDebugPriv();
  96.  TCHAR War3Name[32] = TEXT("Warcraft III");
  97.  HWND hWar3 = FindWindow(War3Name, NULL);
  98.  
  99.  if(!hWar3)
  100.  {
  101.  cout << "Warcraft 3 was not found. Please make sure the game is running." << endl;
  102.  system( "pause" );
  103.  return 1;
  104.  } 
  105.  
  106.  DWORD pid;
  107.  GetWindowThreadProcessId( hWar3, &pid );
  108.  HANDLE hOpen = OpenProcess( PROCESS_ALL_ACCESS, false, pid );
  109.   if( !hOpen )
  110.   {
  111.       cout << "Can't open Warcraft III process." << endl;system( "pause" );
  112.   return 1;
  113.   } 
  114.  
  115.   // Finding the name's address.
  116.  
  117.   DWORD Address = 764;
  118.   DWORD Buffer = 0;
  119.   DWORD WINAPI GetLastError(void);
  120.   SIZE_T BytesRead = 0;
  121.  
  122.    for (;;)
  123.  
  124.    {
  125.           ReadProcessMemory(hOpen, (LPCVOID)Address, &Buffer, 4, &BytesRead); 
  126.  
  127.           if(Buffer == 1463898675)
  128.           {
  129.           // ROC (3RAW).
  130.           Address -= 32;
  131.           break;
  132.           }
  133.  
  134.           else if
  135.           (Buffer == 1462982736)
  136.           {
  137.           // TFT (PX3W).
  138.           Address-= 32;
  139.           break;
  140.           }
  141.  
  142.           else
  143.           {
  144.           Address += 65536;
  145.           }
  146.    }
  147.  
  148.                          // Couting out name.
  149.  
  150.                           while(1)
  151.                           {
  152.  
  153.                           char Name[16];
  154.                           Name[15] = 0; 
  155.                           DWORD Address2 = 111665304;
  156.                           for( unsigned int i = 0; i < 15; i++ )
  157.                           {
  158.                           ReadProcessMemory( hOpen, (LPVOID)( Address2 + i), &Buffer, 1, &BytesRead );
  159.                           Name[i] = Buffer;
  160.                           } 
  161.  
  162.                           //CloseHandle( hOpen ); 
  163.                           SetColor(11);
  164.                           cout << "Your current name is: ";
  165.                           SetColor(-1);
  166.                           cout << Name << endl << endl;
  167.                           SetColor(-2); 
  168.                           cout << "Please type in a new name and press enter." << endl << endl;
  169.                           SetColor(-1);
  170.  
  171.                           // Changing the name.
  172.  
  173.                           SIZE_T BytesWritten = 0;
  174.                           char NewName[16];
  175.                           memset(NewName, 0, 16 );
  176.                           cin.getline (NewName,16);
  177.  
  178.                           for( unsigned int j = 0; j < 15; j++ )
  179.                           {
  180.                           WriteProcessMemory( hOpen, (LPVOID)(Address + j), (LPCVOID)(NewName+ j), 1, &BytesWritten );
  181.                           } 
  182.                           SetColor(11);
  183.                           cout << "\n";
  184.                           cout << "Your new name is: ";
  185.                           SetColor(-1);
  186.                           cout << NewName << endl << endl;
  187.                           }
  188.    }

See Also

Links

Personal tools