Project:Useful VB.NET 2008 Stuff/Warcraft3NameSpoofer

From Codemotion
Jump to: navigation, search

Project:Useful VB.NET 2008 Stuff/Warcraft3NameSpoofer

Description

A very simple console Warcraft III Name Spoofer program for version 1.22a. Credits to Root's (AKA Tyrano) C++ NameSpoofer for some ideas and Enmitix for his Dynamic Memory tutorial.

Click here for the plain code!

NOTE: WHEN RUNNING THIS ON WINDOWS VISTA, BOTH WARCRAFT III AND THIS PROGRAM HAVE TO BE RUN AS ADMINISTRATOR!

Code

Parent Directory: Project:Useful VB.NET 2008 Stuff
Plain Code: VB.NET 2008 Stuff/Warcraft3NameSpoofer&action=edit edit

  1. Module Warcraft3NameSpoofer
  2.     Private Declare Function OpenProcess Lib "kernel32" _
  3. (ByVal dwDesiredAccess As Integer, _
  4. ByVal bInheritHandle As Integer, _
  5. ByVal dwProcessId As Integer) As Integer
  6.     Private Declare Function ReadProcessMemory Lib "kernel32" _
  7. (ByVal hProcess As Integer, _
  8. ByVal lpBaseAddress As Integer,_
  9.  ByRef lpBuffer As Integer, _
  10. ByVal nSize As Integer, _
  11. ByRef lpNumberOfBytesWritten As Integer) As Integer
  12.     Private Declare Function WriteProcessMemory Lib "kernel32" _
  13. (ByVal hProcess As Integer, _
  14. ByVal lpBaseAddress As Integer, _
  15. ByRef lpBuffer As Integer, _
  16. ByVal nSize As Integer, _
  17. ByRef lpNumberOfBytesWritten As Integer) As Integer
  18.     Private Declare Function CloseHandle Lib "kernel32" _
  19. (ByVal hObject As Integer) As Integer
  20.  
  21.     Private Const PROCESS_ALL_ACCESS = &H1F0FFF
  22.  
  23.     Public Version As Integer
  24.  
  25.     Sub Main()
  26.         Console.Title = "Theta's Warcraft3NameSpoofer v1.22"
  27.         Console.BackgroundColor = ConsoleColor.Red
  28.         Console.ForegroundColor = ConsoleColor.Green
  29.  
  30.         Console.Write("A very simple console program, ")
  31.         Console.Write("Warcraft3NameSpoofer for version 1.22a")
  32.         Console.Write(ControlChars.Lf)
  33.         Console.Write(ControlChars.Lf)
  34.         Console.Write("By Theta -- codemotion.net")
  35.         Console.Write(ControlChars.Lf)
  36.         Console.Write(ControlChars.Lf)
  37.         Console.Write("Don't use this program before playing a ")
  38.         Console.Write("Battle.net Ladder game!")
  39.         Console.Write(ControlChars.Lf)
  40.         Console.Write(ControlChars.Lf)
  41.         Console.Write(ControlChars.Lf)
  42.         Console.Write(ControlChars.Lf)
  43.  
  44.         Dim myProcesses As Process() = _
  45. Process.GetProcessesByName("war3")
  46.  
  47.         If myProcesses.Length = 0 Then
  48.             Console.Write("Error! Warcraft III Not Found!")
  49.             Console.Write(ControlChars.Lf)
  50.             Console.Write(ControlChars.Lf)
  51.             Console.Write(ControlChars.Lf)
  52.             Console.Write(ControlChars.Lf)
  53.             Console.Write("Press any key to continue")
  54.             Console.ReadKey()
  55.             Exit Sub
  56.         End If
  57.  
  58.         Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, _
  59. myProcesses(0).Id)
  60.  
  61.         If hProcess = IntPtr.Zero Then
  62.             Console.Write("Error! Access Denied!")
  63.             Console.Write(ControlChars.Lf)
  64.             Console.Write(ControlChars.Lf)
  65.             Console.Write(ControlChars.Lf)
  66.             Console.Write(ControlChars.Lf)
  67.             Console.Write("Press any key to continue")
  68.             Console.ReadKey()
  69.             CloseHandle(hProcess)
  70.             Exit Sub
  71.         End If
  72.  
  73.         Dim Address As Integer = 764
  74.  
  75.         Dim Buffer As Integer
  76.  
  77.         Dim bytesRead As Integer
  78.  
  79.         Do
  80.             ReadProcessMemory(hProcess, Address, Buffer, 4, bytesRead)
  81.             If Buffer = 1463898675 Then
  82.                 Address -= 32
  83.                 Version = 0
  84.                 Exit Do
  85.             ElseIf Buffer = 1462982736 Then
  86.                 Address -= 32
  87.                 Version = 1
  88.                 Exit Do
  89.             Else
  90.                 Address += 65536
  91.             End If
  92.         Loop
  93.  
  94.         Dim ret As Byte() = Nothing
  95.  
  96.         Dim oldName As String = ""
  97.  
  98.         For i As Integer = 0 To 15
  99.             ReadProcessMemory(hProcess, Address + i, Buffer, 1, 0)
  100.  
  101.             ret = BitConverter.GetBytes(Buffer)
  102.  
  103.             If Version = 0 Then
  104.                 oldName &= _
  105. System.Text.Encoding.ASCII.GetString(ret).Replace("RAW", "")
  106.             Else
  107.                 oldName &= _
  108. System.Text.Encoding.ASCII.GetString(ret).Replace("X3W", "")
  109.             End If
  110.         Next
  111.  
  112.         Console.Write("Your current name is: ")
  113.  
  114.         Console.Write(oldName)
  115.         Console.Write(ControlChars.Lf)
  116.         Console.Write(ControlChars.Lf)
  117.  
  118.         Console.Write("Type in a new name:")
  119.         Console.Write(ControlChars.Lf)
  120.         Console.Write(ControlChars.Lf)
  121.  
  122.         Dim newName As String = Console.ReadLine
  123.  
  124.         If (Len(newName) > 15) Then
  125.             Console.Write(ControlChars.Lf)
  126.             Console.Write(ControlChars.Lf)
  127.             Console.Write_
  128. ("Error! The new name is longer than 15 characters!")
  129.             Console.Write(ControlChars.Lf)
  130.             Console.Write(ControlChars.Lf)
  131.             Console.Write(ControlChars.Lf)
  132.             Console.Write(ControlChars.Lf)
  133.             Console.Write("Press any key to continue")
  134.             Console.ReadKey()
  135.             CloseHandle(hProcess)
  136.             Exit Sub
  137.         End If
  138.  
  139.         For i = 0 To Len(newName) - 1
  140.             WriteProcessMemory(hProcess, (Address) + i, _
  141. Asc(Mid(newName, i + 1, 1)), 1, 0&)
  142.         Next i
  143.         For i = Len(newName) To 14
  144.             WriteProcessMemory(hProcess, (Address) + i, &H0, 1, 0&)
  145.         Next i
  146.  
  147.         Console.Write(Constants.vbLf)
  148.         Console.Write(ControlChars.Lf)
  149.         Console.Write(ControlChars.Lf)
  150.         Console.Write("Your new name is: ")
  151.         Console.Write(newName)
  152.         Console.Write(ControlChars.Lf)
  153.         Console.Write(ControlChars.Lf)
  154.         Console.Write(ControlChars.Lf)
  155.         Console.Write(ControlChars.Lf)
  156.         Console.Write("Press any key to continue")
  157.         Console.ReadKey()
  158.         CloseHandle(hProcess)
  159.     End Sub
  160. End Module
Personal tools