Naposledy aktivní 1721359250

WeChat_Win_VersionFix.py Raw
1import subprocess
2import time
3import pymem
4import pymem.process
5import pymem.pattern
6
7def mod_mem(pid):
8 # 打开进程
9 pm = pymem.Pymem(pid)
10 module = pymem.process.module_from_name(pm.process_handle, 'WeChatWin.dll')
11
12 # 查找并替换数值
13 new_value = 0x63090A13
14
15 # 在内存中搜索旧值
16 old_pattern = b'\x1E\x00\x07\x63'
17 addresses = pymem.pattern.pattern_scan_module(pm.process_handle, module, old_pattern, return_multiple=True)
18 for address in addresses:
19 pm.write_int(address, new_value)
20 print(f'Value at address {hex(address)} changed')
21
22def get_all_pids(image_name):
23 # Correctly split the command arguments
24 result = subprocess.run(['tasklist', '/FO', 'list', '/FI', 'IMAGENAME eq ' + image_name], stdout=subprocess.PIPE).stdout.decode('gbk')
25 # store pids in array
26 pids = set()
27 for line in result.split('\n'):
28 if 'PID' in line:
29 pids.add(int(line.split(': ')[1]))
30 return pids
31
32INAME = 'WeChat.exe'
33previous_pids = get_all_pids(INAME)
34while True:
35 current_pids = get_all_pids(INAME)
36 new_pids = list(current_pids - previous_pids)
37 print('New pids:', new_pids)
38 for pid in new_pids:
39 time.sleep(1)
40 mod_mem(pid)
41 previous_pids = current_pids
42 # sleep for 1 second
43 time.sleep(1)