Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ctypes import *
- from time import sleep
- def GetHandle(windowname):
- hwnd = windll.user32.FindWindowA(0,windowname.encode())
- while (not hwnd):
- hwnd = windll.user32.FindWindowA(0,windowname.encode())
- sleep(0.25)
- pId = c_uint32()
- windll.user32.GetWindowThreadProcessId(hwnd,byref(pId))
- return windll.kernel32.OpenProcess(0x0010 | 0x0020 | 0x0008 | 0x0400, 0, pId.value)
- def WriteMem(handle,address,ptr,size):
- old = c_uint32()
- old2 = c_uint32()
- windll.kernel32.VirtualProtectEx(handle,address,size,0x40,byref(old))
- windll.kernel32.WriteProcessMemory(handle,address,ptr,size,0)
- windll.kernel32.VirtualProtectEx(handle,address,size,old,byref(old2))
- #Usage: WriteMem(handle,0x00400000,byref(cvartype),size)
- def ReadDW(handle,address):
- value = c_uint32()
- old = c_uint32()
- old2 = c_uint32()
- windll.kernel32.VirtualProtectEx(handle,address,4,0x40,byref(old))
- windll.kernel32.ReadProcessMemory(handle,address,byref(value),4,0)
- windll.kernel32.VirtualProtectEx(handle,address,4,old,byref(old2))
- return value.value
- def LoadLibrary(library):
- return windll.kernel32.LoadLibraryA(library.encode())
- def GetProcAddress(module,function):
- handle = windll.kernel32.GetModuleHandleA(module.encode())
- return windll.kernel32.GetProcAddress(handle,function.encode())
- def Alloc(handle,size):
- return windll.kernel32.VirtualAllocEx(handle,0,size,0x1000|0x2000,0x40)
- def GetDword():
- try:
- value = int(input("Please enter a valid number: "))
- except:
- print("The input is not a number")
- return GetDword()
- if value>(2**32 - 1):
- print("Value too big, max is 4294967295")
- return GetDword()
- if value < 0:
- print("Value too low, min is 0")
- return GetDword()
- value = c_uint32(value)
- return value
Add Comment
Please, Sign In to add comment