
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports BasicBunnyhop.Wrappers
Module Main
#Region "Memory APIs / Wrappers"
Public Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <[In](), Out()> ByVal buffer As Byte(), ByVal size As UInt32, <Out()> ByRef lpNumberOfBytesRead As IntPtr) As Integer
End Function
Public Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As IntPtr, <Out()> ByRef lpNumberOfBytesWritten As IntPtr) As Boolean
End Function
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
Public Function ReadBytes(ByVal Address As Long, ByVal BytesToRead As UInt32) As Byte()
Dim ptr2 As IntPtr
Dim buffer As Byte() = New Byte(BytesToRead - 1) {}
ReadProcessMemory(handle, New IntPtr(Address), buffer, BytesToRead, ptr2)
Return buffer
End Function
Public Function ReadMemory(ByVal Address As Long) As Integer
Return BitConverter.ToInt32(ReadBytes(Address, 4), 0)
End Function
Private Function GetObjectBytes(ByVal value As Object) As Byte()
If value.GetType() Is GetType(Byte()) Then Return CType(value, Byte())
Dim buffer(Marshal.SizeOf(value) - 1) As Byte
Dim ptr As IntPtr = Marshal.AllocHGlobal(buffer.Length)
Marshal.StructureToPtr(value, ptr, True)
Marshal.Copy(ptr, buffer, 0, buffer.Length)
Marshal.FreeHGlobal(ptr)
Return buffer
End Function
Public Function WriteMemory(ByVal address As Integer, ByVal value As Object, ByVal unicode As Boolean) As Boolean
Dim buffer() As Byte
If TypeOf value Is String Then
If unicode Then buffer = Encoding.Unicode.GetBytes(value.ToString()) Else buffer = Encoding.ASCII.GetBytes(value.ToString())
Else
buffer = GetObjectBytes(value)
End If
Dim result As Boolean = WriteProcessMemory(handle, New IntPtr(address), buffer, New IntPtr(buffer.Length), IntPtr.Zero)
Return result
End Function
#End Region
#Region "Offsets"
'Dynamic Offsets
Public localPlayer As Integer = &HA9330C
Public jump As Integer = &H4ACA244
'Static Offsets
Public m_Flags As Integer = &H100
#End Region
'Process
Public process As Process
Public handle As IntPtr
Public DLL As Integer
Public DLLString As String
Public Running As Boolean = False
'Our Values
Public Flags As Integer
Public playBase As Integer
Sub Main()
GetProcess()
End Sub
Public Sub Bunnyhop()
Do
playBase = ReadMemory(DLL + localPlayer)
Flags = ReadMemory(playBase + m_Flags)
'Terrible way to do it, but it works.
If GetAsyncKeyState(&H20) Then
playBase = ReadMemory(CLng((DLL + localPlayer)))
If Flags = 257 Or Flags = 263 Then
WriteMemory(DLL + jump, 5, 4)
Threading.Thread.Sleep(25)
End If
If Flags = 256 Or Flags = 263 Then
WriteMemory(DLL + jump, 4, 4)
End If
End If
Threading.Thread.Sleep(1)
Loop
End Sub
Sub GetProcess()
Try
Dim csgoProcess As Process() = Process.GetProcessesByName("csgo")
If (csgoProcess.Length <> 0) Then
Dim processModule As ProcessModule
For Each processModule In csgoProcess(0).Modules
If (processModule.ModuleName.Contains("client.dll") AndAlso Not processModule.ModuleName.Contains("steamclient.dll")) Then
DLL = processModule.BaseAddress.ToInt32
DLLString = (DLL & processModule.ModuleName.ToString)
Running = True
Console.Beep(659, 125)
process = Process.GetProcessesByName("csgo")(0)
handle = process.Handle
Exit For
End If
Next
End If
If Not Running Then
Console.ForegroundColor = ConsoleColor.Gray
Console.WriteLine("Waiting for csgo.exe...")
Thread.Sleep(500)
Console.Clear()
GetProcess()
End If
Catch
GetProcess()
End Try
End Sub
End Module