WeChat_Win_VersionFix.py
· 1.3 KiB · Python
Brut
import subprocess
import time
import pymem
import pymem.process
import pymem.pattern
def mod_mem(pid):
# 打开进程
pm = pymem.Pymem(pid)
module = pymem.process.module_from_name(pm.process_handle, 'WeChatWin.dll')
# 查找并替换数值
new_value = 0x63090A13
# 在内存中搜索旧值
old_pattern = b'\x1E\x00\x07\x63'
addresses = pymem.pattern.pattern_scan_module(pm.process_handle, module, old_pattern, return_multiple=True)
for address in addresses:
pm.write_int(address, new_value)
print(f'Value at address {hex(address)} changed')
def get_all_pids(image_name):
# Correctly split the command arguments
result = subprocess.run(['tasklist', '/FO', 'list', '/FI', 'IMAGENAME eq ' + image_name], stdout=subprocess.PIPE).stdout.decode('gbk')
# store pids in array
pids = set()
for line in result.split('\n'):
if 'PID' in line:
pids.add(int(line.split(': ')[1]))
return pids
INAME = 'WeChat.exe'
previous_pids = get_all_pids(INAME)
while True:
current_pids = get_all_pids(INAME)
new_pids = list(current_pids - previous_pids)
print('New pids:', new_pids)
for pid in new_pids:
time.sleep(1)
mod_mem(pid)
previous_pids = current_pids
# sleep for 1 second
time.sleep(1)
| 1 | import subprocess |
| 2 | import time |
| 3 | import pymem |
| 4 | import pymem.process |
| 5 | import pymem.pattern |
| 6 | |
| 7 | def 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 | |
| 22 | def 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 | |
| 32 | INAME = 'WeChat.exe' |
| 33 | previous_pids = get_all_pids(INAME) |
| 34 | while 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) |