pull/109/merge
jakevin 2026-06-11 20:13:49 +08:00 committed by GitHub
commit 044f38d62c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 3 deletions

View File

@ -109,8 +109,25 @@ pub fn scan_keys(db_dir: &Path) -> Result<Vec<KeyEntry>> {
let mut task: mach_port_t = 0;
let kr = task_for_pid(mach_task_self(), pid, &mut task);
if kr != KERN_SUCCESS {
// task_for_pid 读取目标进程内存始终需要 root。
// 最常见的 kr=5 (KERN_FAILURE) 就是没加 sudo先指出这一点
// 只有已经是 root 仍然失败,才是 SIP 开启下的签名问题,需要重签。
if libc::geteuid() != 0 {
bail!(
"task_for_pid 失败 (kr={}):抓取密钥需要 root 权限。\n\
\n\
sudo \n\
sudo wx init\n\
\n\
sudo SIP WeChat ad-hoc \n\
codesign README",
kr
);
}
bail!(
"task_for_pid 失败 (kr={})。请按以下步骤修复:\n\
"task_for_pid 失败 (kr={}):已是 root 但仍无法获取 task port\n\
SIP WeChat hardened runtime\n\
\n\
\n\
1. WeChat \n\
codesign --force --deep --sign - /Applications/WeChat.app\n\
@ -118,12 +135,14 @@ pub fn scan_keys(db_dir: &Path) -> Result<Vec<KeyEntry>> {
2. WeChat\n\
killall WeChat && open /Applications/WeChat.app\n\
\n\
3. root\n\
3. \n\
sudo wx init\n\
\n\
codesign \"signature in use\",先执行:\n\
codesign --remove-signature /Applications/WeChat.app/Contents/Frameworks/vlc_plugins/librtp_mpeg4_plugin.dylib\n\
codesign --force --deep --sign - /Applications/WeChat.app",
codesign --force --deep --sign - /Applications/WeChat.app\n\
\n\
SIP sudo ",
kr
);
}