Guest User

[VB.NET] GlowESP

a guest
Sep 21st, 2015
1,238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer() As Byte, ByVal iSize As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
  2.         Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal iSize As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
  3.         Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAcess As UInt32, ByVal bInheritHandle As Boolean, ByVal dwProcessId As Int32) As IntPtr
  4.         Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As IntPtr) As Boolean
  5.  
  6.     Private PROCESS_ALL_ACCESS As UInt32 = &H1F0FFF
  7.  
  8.    
  9.     Private LocalPlayer As Int32 = &HA932CC
  10.    
  11.     Private EntityList As Int32 = &H4A35A14
  12.    
  13.     Private GlowObjectBase As Int32 = &H4B48F24
  14.    
  15.     Private attack As Int32 = &H2EA7958
  16.    
  17.     Private jump As Int32 = &H4AC69F8
  18.  
  19.    
  20.     Private m_iCrossHairID As Int32 = &H410
  21.    
  22.     Private m_iTeamNum As Int32 = &HF0
  23.    
  24.     Private m_fFlags As Int32 = &H100
  25.    
  26.     Private GlowIndex As Int32 = &H86C0
  27.    
  28.     Private isDormant As Int32 = &HE9
  29.    
  30.     Private bSpotted As Int32 = &H935
  31.    
  32.     Private flashMaxAlpha As Int32 = &H1DB0
  33.  
  34.     Dim csgo_handle As IntPtr
  35.         Dim csgo_process As Process
  36.         Dim dwClient As Int32
  37.         Dim dwEngine As Int32
  38.  
  39.  
  40.         Private Structure GlowStruct
  41.             Public r As Single
  42.             Public g As Single
  43.             Public b As Single
  44.             Public a As Single
  45.             Public rwo As Boolean
  46.             Public rwuo As Boolean
  47.         End Structure
  48.  
  49.         Private Defaultglow As GlowStruct = New GlowStruct With {.r = 0.4F, .g = 0.0F, .b = 0.0F, .a = 1.0F, .rwo = True, .rwuo = False}
  50.         Private GlowEnabled As Boolean = True
  51.         Private GlowShowTeam As Boolean = True
  52.         Private GlowShowEnemies As Boolean = True
  53.         Private g_currentPlayer_GlowIndex As Int32
  54.         Private g_currentPlayer_Team As Int32
  55.  
  56.         Private LocalBase As Int32
  57.         Private LocalPlayer_Team As Int32
  58.         Private GlowPointer As Int32
  59.         Private InCross As Int32
  60.         Private Trigger_EntityBase As Int32
  61.         Private Trigger_EntityBase_TeamID As Int32
  62.         Private nFlashMaxAlpha As Single
  63.         Private fFlag As Byte
  64.  
  65.     Private Sub DrawGlow(ByVal gIndex As Int32, ByVal Color As GlowStruct)
  66.             WriteSingle(GlowPointer + ((gIndex * &H34) + &H4), 4, Color.r)
  67.             WriteSingle(GlowPointer + ((gIndex * &H34) + &H8), 4, Color.g)
  68.             WriteSingle(GlowPointer + ((gIndex * &H34) + &HC), 4, Color.b)
  69.             WriteSingle(GlowPointer + ((gIndex * &H34) + &H10), 4, Color.a)
  70.             WriteBool(GlowPointer + ((gIndex * &H34) + &H24), 1, Color.rwo)
  71.             WriteBool(GlowPointer + ((gIndex * &H34) + &H25), 1, Color.rwuo)
  72.         End Sub
  73.  
  74.     Sub Main()
  75.  
  76.             csgo_process = Process.GetProcessesByName("csgo")(0)
  77.             csgo_handle = OpenProcess(PROCESS_ALL_ACCESS, False, csgo_process.Id)
  78.  
  79.             For Each [Module] As System.Diagnostics.ProcessModule In csgo_process.Modules
  80.                     If [Module].ModuleName.ToLower = "client.dll" Then
  81.                         dwClient = [Module].BaseAddress
  82.                 ElseIf [Module].ModuleName.ToLower = "engine.dll" Then
  83.                         dwEngine = [Module].BaseAddress
  84.                     End If
  85.             Next
  86.  
  87.         While True
  88.  
  89.                     LocalBase = BitConverter.ToInt32(ReadMemory(dwClient + LocalPlayer, 4), 0)
  90.                     LocalPlayer_Team = BitConverter.ToInt32(ReadMemory(LocalBase + m_iTeamNum, 4), 0)
  91.                     GlowPointer = BitConverter.ToInt32(ReadMemory(dwClient + GlowObjectBase, 4), 0)
  92.                     InCross = BitConverter.ToInt32(ReadMemory(LocalBase + m_iCrossHairID, 4), 0)
  93.                     Trigger_EntityBase = BitConverter.ToInt32(ReadMemory(dwClient + EntityList + ((InCross - 1) * 16), 4), 0)
  94.                     Trigger_EntityBase_TeamID = BitConverter.ToInt32(ReadMemory(Trigger_EntityBase + m_iTeamNum, 4), 0)
  95.                     nFlashMaxAlpha = BitConverter.ToSingle(ReadMemory(dwClient + &H4A35A14, 4), 0)
  96.                     fFlag = ReadMemory(dwClient + &H4A35A14, 1)(0)
  97.  
  98.                 For I As Integer = 1 To 64
  99.  
  100.                         Dim g_currentPlayer As Int32 = BitConverter.ToInt32(ReadMemory(dwClient + EntityList + ((I - 1) * 16), 4), 0)
  101.                         Dim g_currentPlayer_Dormant As Boolean = BitConverter.ToBoolean(ReadMemory(g_currentPlayer + isDormant, 4), 0)
  102.  
  103.                         If Not (g_currentPlayer_Dormant) Then
  104.  
  105.                                 g_currentPlayer_GlowIndex = BitConverter.ToInt32(ReadMemory(g_currentPlayer + GlowIndex, 4), 0)
  106.                                 g_currentPlayer_Team = BitConverter.ToInt32(ReadMemory(g_currentPlayer + m_iTeamNum, 4), 0)
  107.                         End If
  108.  
  109.                         If Not (g_currentPlayer_Dormant) Then
  110.                                 If (g_currentPlayer_Team = LocalPlayer_Team) Then
  111.                                     DrawGlow(g_currentPlayer_GlowIndex, Defaultglow)
  112.                             ElseIf Not (g_currentPlayer_Team = LocalPlayer_Team) Then
  113.                                     DrawGlow(g_currentPlayer_GlowIndex, Defaultglow)
  114.                                 End If
  115.                         End If
  116.                     Next
  117.             System.Threading.Thread.Sleep(1)
  118.         End While
  119.     End Sub
  120.  
  121.     Private Function ReadMemory(ByVal Address As Int32, ByVal Length As Int32) As Byte()
  122.             Dim Bytes(Length - 1) As Byte
  123.             ReadProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  124.             Return Bytes
  125.         End Function
  126.  
  127.         Private Sub WriteInt32(ByVal Address As Int32, ByVal Length As Int32, ByVal Value As Int32)
  128.             Dim Bytes(Length - 1) As Byte
  129.             Bytes = BitConverter.GetBytes(Value)
  130.             WriteProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  131.         End Sub
  132.  
  133.         Private Sub WriteSingle(ByVal Address As Int32, ByVal Length As Int32, ByVal Value As Single)
  134.             Dim Bytes(Length - 1) As Byte
  135.             Bytes = BitConverter.GetBytes(Value)
  136.             WriteProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  137.         End Sub
  138.  
  139.         Private Sub WriteBool(ByVal Address As Int32, ByVal Length As Int32, ByVal Value As Boolean)
  140.             Dim Bytes(Length - 1) As Byte
  141.             Bytes = BitConverter.GetBytes(Value)
  142.             WriteProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  143.         End Sub
Advertisement
Add Comment
Please, Sign In to add comment