Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions OneByteWallhack.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
import pymem
import re

pm = pymem.Pymem('csgo.exe')
client = pymem.process.module_from_name(pm.process_handle,
'client.dll')
# Define constants
CSGO_EXE = 'csgo.exe'
CLIENT_DLL = 'client.dll'
BYTE_PATTERN = rb'\x33\xC0\x83\xFA.\xB9\x20'

clientModule = pm.read_bytes(client.lpBaseOfDll, client.SizeOfImage)
address = client.lpBaseOfDll + re.search(rb'\x33\xC0\x83\xFA.\xB9\x20',
clientModule).start() + 4
try:
# Open process handle and module
pm = pymem.Pymem(CSGO_EXE)
client = pymem.process.module_from_name(pm.process_handle, CLIENT_DLL)

pm.write_uchar(address, 2 if pm.read_uchar(address) == 1 else 1)
pm.close_process()
# Read module into memory and search for byte pattern
client_module = pm.read_bytes(client.lpBaseOfDll, client.SizeOfImage)
address = client.lpBaseOfDll + re.search(BYTE_PATTERN, client_module).start() + 4

# Modify function byte and close process handle
new_value = 2 if pm.read_uchar(address) == 1 else 1
pm.write_uchar(address, new_value)

except pymem.exception.ProcessNotFound:
print(f'{CSGO_EXE} process not found')
except pymem.exception.ProcessError:
print(f'Error accessing process {CSGO_EXE}')
except pymem.exception.ModuleNotFound:
print(f'{CLIENT_DLL} module not found')
except pymem.exception.MemoryReadError:
print('Error reading memory')
except pymem.exception.MemoryWriteError:
print('Error writing memory')
except AttributeError:
print('Byte pattern not found')
else:
with pm:
pass