1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| """ @author: @file: ReadCs.py @time: 2020-05-12 21:07 @desc: KeyboArd """ import win32process from win32con import PROCESS_ALL_ACCESS, PROCESS_VM_READ, PROCESS_VM_WRITE, PROCESS_QUERY_INFORMATION import win32api import ctypes from win32gui import FindWindow
kernel32 = ctypes.windll.LoadLibrary("kernel32.dll") GetLastError = kernel32.GetLastError moduleName = 0x3EF90000 dwOwnObj = 0xD2FB94 dwEntityList = 0x4D43AC4 dwGlowObjectManager = 0x528B8A0 m_iGlowIndex = 0xA428 m_iTeamNum = 0xF4 m_Hp = 0x100
def _GetProcessId(className,windowName): hGameWindow = FindWindow(className, windowName) pid = win32process.GetWindowThreadProcessId(hGameWindow)[1] return pid
def _GetPorcessHandle(pid): hGameHandle = win32api.OpenProcess(PROCESS_ALL_ACCESS, False, pid) return hGameHandle
def _ReadMemeryInt(hGameHandle,_address,bufflength): addr = ctypes.c_ulong() ReadProcessInt = kernel32.ReadProcessMemory ReadProcessInt(int(hGameHandle), _address, ctypes.byref(addr), bufflength, None) return addr.value
def _ReadMemeryWchar(hGameHandle,_address,bufflength): addr = ctypes.c_wchar_p("0" * bufflength) ReadProcessInt = kernel32.ReadProcessMemory ReadProcessInt(int(hGameHandle), _address, addr, bufflength, None) return addr.value
def WriteMemeryInt(hGameHandle, _address, Data): WriteProcessInt = kernel32.WriteProcessMemory WriteProcessInt(int(hGameHandle),_address,ctypes.byref(ctypes.c_ulong(Data)), 4, None) return Data
def WriteMemeryFloat(hGameHandle, _address,Data): WriteProcessInt = kernel32.WriteProcessMemory WriteProcessInt(int(hGameHandle),_address,ctypes.byref(ctypes.c_float(Data)),4,None) return Data
def _ReadHp(hGameHandle, baseAddr): Hp = _ReadMemeryInt(hGameHandle, baseAddr + m_Hp, 4) return Hp
def _ReadTemp(hGameHandle, baseAddr): Temp = _ReadMemeryInt(hGameHandle, baseAddr + m_iTeamNum, 4) return Temp
class Own: pass
class Entity: pass
def _dwGlowLight(hGameHandle): while True: GlowObjectManager = _ReadMemeryInt(hGameHandle, moduleName+dwGlowObjectManager, 4) own = Own() own.Addr = _ReadMemeryInt(hGameHandle, moduleName+dwOwnObj, 4) own.Hp = _ReadHp(hGameHandle, own.Addr) own.Temp = _ReadTemp(hGameHandle, own.Addr) for i in range(32): Ent = Entity() Ent.Addr = _ReadMemeryInt(hGameHandle, moduleName + dwEntityList+i*16, 4) Ent.Hp = _ReadHp(hGameHandle, Ent.Addr) Ent.Temp = _ReadTemp(hGameHandle, Ent.Addr) glow = _ReadMemeryInt(hGameHandle, Ent.Addr+m_iGlowIndex, 4) if(own.Temp != Ent.Temp): WriteMemeryFloat(hGameHandle, (GlowObjectManager+((glow * 0x38)+4)), 1) WriteMemeryFloat(hGameHandle, (GlowObjectManager + ((glow * 0x38) + 8)), 250) WriteMemeryFloat(hGameHandle, (GlowObjectManager + ((glow * 0x38) + 12)), 128) WriteMemeryFloat(hGameHandle, (GlowObjectManager + ((glow * 0x38) + 16)), 1) WriteMemeryInt(hGameHandle, (GlowObjectManager + ((glow * 0x38) + 36)), 1)
def main(): ProcessId = _GetProcessId("Valve001", u"***")
_hGameHandle = _GetPorcessHandle(ProcessId)
_dwGlowLight(_hGameHandle)
if __name__ == '__main__': main()
|