簡體   English   中英

有沒有用Python內置的好的和易於使用的模塊來編輯內存?

[英]Is there any good and easy-to-use module built in Python for editing memory?

有沒有用Python內置的好的和易於使用的模塊來編輯內存? 或者有這樣的模塊嗎?

我正在尋找的是一種附加到進程並從中讀取/寫入的方法。 就像Cheat Engine的工作原理一樣。 這是一個在C ++中如何工作的例子

花了一些時間才找到這樣做的方法,但這就是我想出來的!

from ctypes import *
from ctypes.wintypes import *

pid = 0 #the pid of the process, aquired earlier by hand

address = 0x0000 #where to read from while in the memory

OpenProcess = windll.kernel32.OpenProcess
ReadProcessMemory = windll.kernel32.ReadProcessMemory
CloseHandle = windll.kernel32.CloseHandle


PROCESS_ALL_ACCESS = 0x1F0FFF

datadummy = b'.'*200
buffer = c_char_p(datadummy)
bufferSize = len(buffer.value)
bytesRead = c_ulong(0)

processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, int(PID))

ReadProcessMemory(processHandle, address, buffer, bufferSize, byref(bytesRead))

CloseHandle(processHandle)

寫入內存我只需添加WriteProcessMemory = windll.kernel32.WriteProcessMemory然后調用它

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM