Guest User

CSGO PointerLogger

a guest
Sep 28th, 2015
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 5.85 KB | None | 0 0
  1. Imports System.Globalization
  2. Imports System.Text.RegularExpressions
  3.  
  4. Public Class Form1
  5.  
  6.     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
  7.     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
  8.     Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAcess As UInt32, ByVal bInheritHandle As Boolean, ByVal dwProcessId As Int32) As IntPtr
  9.     Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As IntPtr) As Boolean
  10.     Private PROCESS_ALL_ACCESS As UInt32 = &H1F0FFF
  11.  
  12.     Private CSGO_process As Process
  13.     Private CSGO_handle As Int32
  14.  
  15.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  16.         CSGO_process = Process.GetProcessesByName("csgo")(0)
  17.         CSGO_handle = OpenProcess(PROCESS_ALL_ACCESS, False, CSGO_process.Id)
  18.         Dim ClientDLL As Int32
  19.         Dim Pattern As String = "81C6????????8945FC890683F9FF7403894E045651"
  20.         For Each [module] As System.Diagnostics.ProcessModule In CSGO_process.Modules
  21.             If [module].FileName.IndexOf("client.dll") <> -1 Then
  22.                 ClientDLL = [module].BaseAddress
  23.             End If
  24.         Next
  25.         ListBox1.Items.Clear()
  26.         Dim EntityList As String = Hex(BitConverter.ToInt32(ReadMemory(AobScan(ClientDLL, &H1800000, "81C6????????8945FC890683F9FF7403894E045651", 0) + 2, 4), 0) - ClientDLL + &H10)
  27.         Dim GlowObjectBase As String = Hex(BitConverter.ToInt32(ReadMemory(AobScan(ClientDLL, &H1800000, "F30F7F05????????83C801C705????????????????660F6F05", 0) + 4, 4), 0) - ClientDLL)
  28.         Dim PlayerJump As String = Hex(BitConverter.ToInt32(ReadMemory(AobScan(ClientDLL, &H1800000, "8915????????8B15????????F6C203740383CE08A808BF????????0F457DFC", 0) + 2, 4), 0) - ClientDLL)
  29.         Dim PlayerAttack As String = Hex(BitConverter.ToInt32(ReadMemory(AobScan(ClientDLL, &H1800000, "8915????????8B15????????F6C203740383CE04A804BF????????", 0) + 2, 4), 0) - ClientDLL)
  30.         ListBox1.Items.Add("EntityList: " & EntityList)
  31.         ListBox1.Items.Add("GlowObjectBase: " & GlowObjectBase)
  32.         ListBox1.Items.Add("Player_Jump: " & PlayerJump)
  33.         ListBox1.Items.Add("Player_Attack: " & PlayerAttack)
  34.         CloseHandle(CSGO_handle)
  35.     End Sub
  36.  
  37.     Private Function ReadMemory(ByVal Address As Int32, ByVal Length As Int32) As Byte()
  38.         Dim Bytes(Length - 1) As Byte
  39.         ReadProcessMemory(CSGO_handle, Address, Bytes, Bytes.Length, vbNull)
  40.         Return Bytes
  41.     End Function
  42.  
  43.     Private Sub WriteInt32(ByVal Address As Int32, ByVal Length As Int32, ByVal Value As Int32)
  44.         Dim Bytes(Length - 1) As Byte
  45.         Bytes = BitConverter.GetBytes(Value)
  46.         WriteProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  47.     End Sub
  48.  
  49.     Private Sub WriteSingle(ByVal Address As Int32, ByVal Length As Int32, ByVal Value As Single)
  50.         Dim Bytes(Length - 1) As Byte
  51.         Bytes = BitConverter.GetBytes(Value)
  52.         WriteProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  53.     End Sub
  54.  
  55.     Private Sub WriteBool(ByVal Address As Int32, ByVal Length As Int32, ByVal Value As Boolean)
  56.         Dim Bytes(Length - 1) As Byte
  57.         Bytes = BitConverter.GetBytes(Value)
  58.         WriteProcessMemory(csgo_handle, Address, Bytes, Bytes.Length, vbNull)
  59.     End Sub
  60.  
  61.     Private Function AobScan(ByVal Base As Integer, ByVal _Range As Integer, ByVal Signature As String, ByVal Instance As Integer) As Integer
  62.         If (Signature <> String.Empty) Then
  63.             Dim New_String As String = Regex.Replace(Signature.Replace("??", "3F"), "[^a-fA-F0-9]", "")
  64.             Dim Count As Integer = -1
  65.             Dim SearchFor As Byte() = New Byte((New_String.Length / 2) - 1) {}
  66.             For i As Integer = 0 To SearchFor.Length - 1
  67.                 SearchFor(i) = Byte.Parse(New_String.Substring(i * 2, 2), NumberStyles.HexNumber)
  68.             Next i
  69.             Dim Sin As Byte() = ReadMemory(Base, _Range)
  70.  
  71.             Dim Z As Integer = 0, P As Integer = 0
  72.             Dim iEnd As Integer = If(SearchFor.Length < &H20, SearchFor.Length, &H20)
  73.             Dim sBytes As Integer() = New Integer(&H100 - 1) {}
  74.             For j As Integer = 0 To iEnd - 1
  75.                 If (SearchFor(j) = &H3F) Then
  76.                     Z = (Z Or (CInt(1) << ((iEnd - j) - 1)))
  77.                 End If
  78.             Next j
  79.             If (Z <> 0) Then
  80.                 For k As Integer = 0 To sBytes.Length - 1
  81.                     sBytes(k) = Z
  82.                 Next k
  83.             End If
  84.             Z = 1
  85.             Dim index As Integer = (iEnd - 1)
  86.             Do While (index >= 0)
  87.                 sBytes(SearchFor(index)) = (sBytes(SearchFor(index)) Or Z)
  88.                 index -= 1
  89.                 Z = (Z << 1)
  90.             Loop
  91.             Do While (P <= (Sin.Length - SearchFor.Length))
  92.                 Z = (SearchFor.Length - 1)
  93.                 Dim last As Integer = SearchFor.Length
  94.                 Dim m As Integer = -1
  95.                 Do While (m <> 0)
  96.                     m = (m And sBytes(Sin(P + Z)))
  97.                     If (m <> 0) Then
  98.                         If (Z = 0) Then
  99.                             Count += 1
  100.                             If Count = Instance Then
  101.                                 Return Base + P
  102.                             End If
  103.                             P += 2
  104.                         End If
  105.                         last = Z
  106.                     End If
  107.                     Z -= 1
  108.                     m = (m << 1)
  109.                 Loop
  110.                 P += last
  111.             Loop
  112.         End If
  113.         Return -1
  114.     End Function
  115. End Class
Advertisement
Add Comment
Please, Sign In to add comment