MCPcopy
hub / github.com/JaveleyQAQ/WeChatOpenDevTools-Python / load_wechatEx_configs

Method load_wechatEx_configs

utils/commons.py:46–71  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44 session.detach()
45
46 def load_wechatEx_configs(self):
47 path = self.wechatutils_instance.get_configs_path()
48 if get_cpu_architecture() == "MacOS x64":
49 wechat_instances = self.wechatutils_instance.get_wechat_pids_and_versions_mac()
50 else:
51 wechat_instances = self.wechatutils_instance.get_wechat_pids_and_versions()
52
53 if wechat_instances:
54 for pid, version in wechat_instances:
55 try:
56 wechatEx_hookcode = open(path + "../scripts/hook.js", "r", encoding="utf-8").read()
57 wechatEx_addresses = open(path + f"../configs/address_{version}_x64.json").read()
58 wechatEx_hookcode = "var address=" + wechatEx_addresses + wechatEx_hookcode
59 session = self.inject_wechatEx(pid, wechatEx_hookcode)
60 if session:
61 self.active_sessions.append(session)
62 print(f"Injected into WeChat instance PID: {pid}, Version: {version}")
63 except Exception as e:
64 print(f"Error injecting into WeChat PID {pid}: {e}")
65 else:
66 self.wechatutils_instance.print_process_not_found_message()
67
68 # 管理会话
69 while self.active_sessions:
70 self.manage_sessions()
71 time.sleep(5) # 每5秒检查一次
72
73 def load_wechatEXE_configs(self):
74 wechat_instances = self.wechatutils_instance.get_wechat_pids_and_versions()

Callers 3

mainFunction · 0.80
commons.pyFile · 0.80

Calls 7

inject_wechatExMethod · 0.95
manage_sessionsMethod · 0.95
get_cpu_architectureFunction · 0.85
get_configs_pathMethod · 0.80

Tested by

no test coverage detected