【问题标题】:Is there any good and easy-to-use module built in Python for editing memory?是否有任何内置 Python 的好且易于使用的模块用于编辑内存?
【发布时间】:2012-08-14 17:46:07
【问题描述】:

有没有内置的 Python 中用于编辑内存的好且易于使用的模块?或者有没有这样的模块?

我正在寻找一种附加到进程并读取/写入它的方法。就像作弊引擎的工作原理一样。 Here's a example of how it works in C++.

【问题讨论】:

  • 记忆编辑是什么意思?谁的记忆,什么样的记忆,以什么方式?
  • 你需要让你的问题更清楚。
  • 这个问题根本没有任何意义,而且显然写得不好。请将您的问题编辑成人类可读的问题。
  • 您也许可以使用ctypes 模块来实现。具体来说,使用ctypes.from_address() 函数。

标签: python python-3.2 memory-editing


【解决方案1】:

我花了一段时间才找到这样做的方法,但这就是我想出的!

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 然后调用它

【讨论】:

  • 当我运行 print(readprocessmemory(...)) 它打印 0,我想我应该改变 datadummy = b'.'*200 buffer = c_char_p(datadummy) bufferSize = len(buffer. value) bytesRead = c_ulong(0) 但我不知道是什么..
  • @extreme4all ReadProcessMemory 写入缓冲区“buffer”,返回值为错误代码(0 = 无错误)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-07
  • 1970-01-01
  • 2017-07-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多