让我说这是我第一次尝试正确的记忆读写应用程序。写函数甚至还没有实现,但它会及时出现的。只是别因为密码而炒我鱿鱼。在
第一件事是完整的程序,这样每个人都可以看到(不要评论我的“糟糕的编码选择”,这件事起作用了,我得到的进程句柄和ID很好)
import ctypes
from ctypes import wintypes
from time import *
import win32ui, win32process ,win32api
PROCESS_ALL_ACCESS = 0x1F0FFF
ReadProcessMemory = ctypes.WinDLL('kernel32',use_last_error=True).ReadProcessMemory
ReadProcessMemory.argtypes = [wintypes.HANDLE,wintypes.LPCVOID,wintypes.LPVOID,ctypes.c_size_t,ctypes.POINTER(ctypes.c_size_t)]
ReadProcessMemory.restype = wintypes.BOOL
WriteProcessMemory = ctypes.WinDLL('kernel32',use_last_error=True).WriteProcessMemory
WriteProcessMemory.argtypes = [wintypes.HANDLE,wintypes.LPVOID,wintypes.LPCVOID,ctypes.c_size_t,ctypes.POINTER(ctypes.c_size_t)]
WriteProcessMemory.restype = wintypes.BOOL
def main():
WindowName = input("Enter the window name: ")
if (len(WindowName) > 0):
Process, pID = attach(WindowName)
Choice = input("Read or Write?").lower()
if (Choice == "write"):
#DoWriteMethod
pass
if (Choice == "read"):
Read(Process)
else:
print("Invalid Window Name!\n\n")
sleep(2)
return 0
def attach(WindowName):
try:
hWnd = win32ui.FindWindow(None,WindowName).GetSafeHwnd()
except:
print("Window not found!\n\n")
sleep(2)
return 0,0
pID = win32process.GetWindowThreadProcessId(hWnd)[1]
Process = win32api.OpenProcess(PROCESS_ALL_ACCESS,0,pID).handle
print("\nProcess = ", Process)
print("ProcessID = ", pID)
return Process,pID
def Write():
return 0
def Read(Process):
Address = input("Enter the address in hexadecial (0x form) \n")
if (Address[0] == "0" and Address[1] == "x"):
BufferAddress = ctypes.create_string_buffer(64)
ptr = ctypes.pointer(BufferAddress)
ReadProcessMemory(Process,Address,BufferAddress,64,None)
print("Pointer contains: ", BufferAddress, "\n\n")
main()
else:
print("Invalid address!\n\n")
sleep(2)
Read(Process)
return 0
if (main() == 0):
main()
if (main() == 1):
exit(0)
在第54行我创建了一个'创建字符串缓冲区(64)'
然后,我在ReadProcessMemory中使用这个值,该值应该存储在那里,但是每当我在第57行打印它时,它只返回以下值:
^{pr2}$我知道这个值应该是90(在作弊引擎中找到一个随机地址),所以它必须包含值90?我怎么能找到这个值。在
我使用的是python3.5.0和相应的win32 modules包
'pip install pypiwin32'
您正在打印对象。打印内容:
相关问题 更多 >
编程相关推荐