使用PyMem库通关Cheat Engine Tutorial (除最后一关)
Cheat Engine的版本是7.4,之前有看到过对PyMem库的推荐,于是就写了这个来练一下手。但我暂时没想明白如何用PyMem alloc 一片新的内存,所以就没有完成最后一关。
代码如下:
from pymem import Pymem
tutorial = Pymem("Tutorial-x86_64.exe")
base = tutorial.base_address
def first():
pointer = tutorial.read_int(base + 0x325A70)
address = pointer + 0x7F8
tutorial.write_int(address, 1000)
print("第一关修改成功")
def second():
pointer = tutorial.read_int(base + 0x325A80)
address = pointer + 0x7F8
tutorial.write_int(address, 5000)
print("第二关修改成功")
def third():
pointer_health = tutorial.read_int(base + 0x325AA0)
address_health = pointer_health + 0x818
tutorial.write_float(address_health, 5000.0)
pointer_ammo = tutorial.read_int(base + 0x325AA0)
address_ammo = pointer_ammo + 0x820
tutorial.write_double(address_ammo, 5000.0)
print("第三关修改成功")
def fourth():
address = base + 0x2CB88
tutorial.write_bytes(address, b'\x90\x90', 2)# nop nop
print("第四关修改成功")
def fifth():
pointer = base + 0x325AD0
address = tutorial.read_int(pointer)
tutorial.write_int(address, 5000)
print("第五关修改成功")
def sixth():
address = base + 0x2DB57
# add dword ptr ,02
tutorial.write_bytes(address, b'\x83\x86\xe0\x07\x00\x00\x02', 7)
print("第六关修改成功")
def seventh():
pointer_1 = base + 0x325B00
pointer_2 = tutorial.read_int(pointer_1) + 0x10
pointer_3 = tutorial.read_int(pointer_2) + 0x18
pointer_4 = tutorial.read_int(pointer_3)
address = tutorial.read_int(pointer_4) + 0x18
tutorial.write_int(address, 5000)
def main():
while True:
step = input("请输入关卡数(输入b以停止):")
match step:
case "1":
first()
case "2":
second()
case "3":
third()
case "4":
fourth()
case "5":
fifth()
case "6":
sixth()
case "7":
seventh()
case "b":
break
case _:
print("未实现!")
if __name__ == "__main__":
main()
CE修改器? 是的
页:
[1]