[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112757":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":13,"stars30d":13,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":10,"rankLanguage":10,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":10,"pushedAt":21,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":25,"discoverSource":26},112757,"axpc","andrd3v\u002Faxpc","andrd3v","universal XPC message interceptor for macOS","",null,"C",54,2,0,42.63,"MIT License",false,"main",true,[],"2026-11-09 16:43:43","2026-11-19 01:00:03","# axpc\n\nUniversal XPC message interceptor for macOS. Hooks all IPC channels (XPC, NSXPC, Mach bootstrap, CFMessagePort, distributed notifications) in any process, including sandboxed daemons, with a real-time ncurses TUI.\n\n![axpc](screenshot.png)\n\n## What it does\n\n- **xpchook.dylib** - intercepts XPC connections, messages, replies, bootstrap lookups, CFMessagePort calls, NSXPCConnection lifecycle, and NSDistributedNotificationCenter posts. Logs everything to `\u002Ftmp\u002Faxpc\u002F` (or `\u002FLibrary\u002FApple\u002Fusr\u002Flib\u002Faxpc_logs\u002F` for sandboxed processes, or os_log as a last resort).\n- **injector** - injects the hook dylib into running processes using `processor_set_tasks` (PST) for task port acquisition and remote `dlopen` via a custom arm64e trampoline. Handles sandbox extensions, `__RESTRICT` binaries, and `checked-allocations` entitlement via ptrace fallback.\n- **axpc** (TUI) - ncurses interface that lists all processes, lets you inject into any of them, and shows intercepted XPC messages in real-time with color-coded tags.\n\n## Requirements\n\n- macOS on Apple Silicon (arm64e)\n- SIP disabled (`csrutil disable` from Recovery)\n- AMFI disabled (boot-args: `amfi_get_out_of_my_way=1 amfi_allow_any_signature=1`)\n- Root access\n\n## Building\n\n```bash\nmake\n```\n\nProduces:\n- `build\u002Fxpchook.dylib` - the hook library (auto-codesigned with ad-hoc signature)\n- `build\u002Finjector` - the CLI injector\n- `build\u002Faxpc` - the TUI monitor\n\nIf you want to codesign manually:\n\n```bash\ncodesign -f -s - build\u002Fxpchook.dylib\ncodesign -f -s - build\u002Finjector\ncodesign -f -s - build\u002Faxpc\n```\n\n## Usage\n\n### TUI (recommended)\n\n```bash\nsudo build\u002Faxpc\n```\n\nThe TUI shows:\n- **Top panel** - process list with monitoring status and message counts. Processes with active hooks show a green dot.\n- **Middle bar** - filter input (press `\u002F` to type a filter, Enter\u002FEsc to confirm)\n- **Bottom panel** - real-time log stream with color-coded message types\n\nControls:\n| Key | Action |\n|-----|--------|\n| Tab | Switch focus between process list and log view |\n| Enter | Open inject menu for selected process |\n| \u002F | Enter filter mode |\n| c | Clear filter |\n| y | Copy visible logs to clipboard (pbcopy) |\n| G | Jump to bottom (re-enable auto-scroll) |\n| Up\u002FDown | Navigate \u002F scroll |\n| PgUp\u002FPgDn | Page scroll in log view |\n| Mouse scroll | Scroll in the panel under cursor |\n| q | Quit |\n\nThe inject menu (Enter on a process) offers:\n1. **dlopen inject** - injects via remote thread creation + dlopen. Works on all processes including `__RESTRICT` binaries. Only hooks NSXPC (ObjC swizzle).\n2. **Restart with all hooks** - kills the process and relaunches it with `DYLD_INSERT_LIBRARIES` (or via `launchctl debug` for daemons). Hooks everything (XPC C API, NSXPC, bootstrap, CFMessagePort, distributed notifications). Won't work on `__RESTRICT` binaries - the TUI warns you.\n\n### CLI injector\n\n```bash\n# inject into a process by PID\nsudo build\u002Finjector -p \u003Cpid> build\u002Fxpchook.dylib\n\n# inject by process name\nsudo build\u002Finjector -n \u003Cname> build\u002Fxpchook.dylib\n\n# kill + restart with DYLD_INSERT_LIBRARIES\nsudo build\u002Finjector -r \u003Cname> build\u002Fxpchook.dylib\n\n# restart a launchd daemon with hooks (launchctl debug)\nsudo build\u002Finjector -d \u003Clabel> build\u002Fxpchook.dylib\n\n# inject into all processes\nsudo build\u002Finjector -a build\u002Fxpchook.dylib\n\n# list all processes with PST task port status\nsudo build\u002Finjector -l\n```\n\n### Filter syntax\n\nThe filter supports multiple space-separated tokens (AND logic):\n\n- `pid:1234` - filter by PID\n- `tag:SEND` - filter by message tag (INIT, CONN, SEND, RECV, REPLY, BOOT, NSXPC, CFMP, DNOTE, EVENT)\n- `port:0x1234` - filter by Mach port in message text\n- `anything else` - case-insensitive substring match against message text, process name, or tag\n\nExample: `tag:SEND accountsd` - shows only SEND messages from accountsd.\n\n## How injection works\n\n1. **Task port** - acquired via `processor_set_tasks` (PST). This bypasses `task_for_pid` restrictions.\n2. **Remote symbol resolution** - reads the target's `dyld_all_image_infos`, walks Mach-O load commands and symbol tables to find `dlopen`, `dlerror`, `_pthread_set_self`, and `sandbox_extension_consume` in the target's address space.\n3. **Sandbox extensions** - if the target is sandboxed, issues file-read and file-map-executable sandbox extensions for the dylib path.\n4. **Staging** - copies the dylib to `\u002FLibrary\u002FApple\u002Fusr\u002Flib\u002F` and re-codesigns it (ad-hoc), so sandboxed processes can load it.\n5. **Trampoline** - allocates RX memory in the target, writes a compact arm64e shellcode that: calls `_pthread_set_self`, consumes sandbox extensions (if any), calls `dlopen`, stores the result, calls `dlerror` on failure, and spins (`B .`) when done.\n6. **Thread** - creates a new thread in the target via `thread_create_running`, waits for it to hit the spin instruction, reads the result, and cleans up.\n\nFor `checked-allocations` processes, falls back to `ptrace(PT_ATTACH)` before thread creation.\n\nFor launchd daemons (`-d` mode), uses `launchctl debug \u003Ctarget> --environment DYLD_INSERT_LIBRARIES=\u003Cpath>` + `launchctl kill SIGTERM` + `launchctl kickstart` for a one-shot restart with full interposition.\n\n## Log format\n\n```\nHH:MM:SS.mmm   TAG process    message\n```\n\nTags: INIT, CONN, SEND, RECV, REPLY, BOOT, NSXPC, CFMP, DNOTE, EVENT\n\n## Tested on\n\n- macOS 27.3 beta 1\n- Apple Silicon M4 Pro\n- SIP disabled, AMFI disabled\n- Verified with system daemons (accountsd, adid, mediaremoted, etc.)\n- Stress-tested with ~4000 messages in real-time streaming\n\n## MCP server\n\naxpc has an MCP server so AI assistants like Claude can read XPC logs, inject into processes, and monitor traffic directly.\n\n### Setup\n\nAdd to your Claude Code config (`~\u002F.claude\u002Fsettings.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"axpc\": {\n      \"command\": \"python3\",\n      \"args\": [\"\u002Fpath\u002Fto\u002Faxpc\u002Fmcp\u002Fserver.py\"]\n    }\n  }\n}\n```\n\nReplace `\u002Fpath\u002Fto\u002Faxpc` with the actual path. No dependencies needed, just python3.\n\n### Tools\n\n| Tool | Description |\n|------|-------------|\n| `status` | log file count, total messages, monitored processes |\n| `logs` | read intercepted XPC messages with optional filter, process, tag |\n| `log_files` | list active log files with size and modification time |\n| `inject` | inject xpchook.dylib into a process (dlopen\u002Frestart\u002Fdaemon) |\n| `processes` | list all processes with PST task port status |\n\n### Example\n\nAfter setup, you can ask Claude things like:\n- \"show me recent XPC messages from accountsd\"\n- \"inject into airportd and show me what it sends\"\n- \"how many XPC messages did adid send?\"\n- \"filter logs for bootstrap lookups\"\n\n`inject` and `processes` require root - run Claude Code under sudo or the injector will fail.\n\n## Contributing\n\n\u003Csub>If you want to help - open an issue or submit a pull request. Bug reports, new ideas, support for other architectures, better TUI, whatever. All contributions welcome.\u003C\u002Fsub>\n\n## License\n\nMIT\n","axpc 是一个面向 macOS Apple Silicon 平台的通用 XPC 进程间通信（IPC）消息拦截与监控工具。它通过动态注入 hook 库，实时捕获并记录 XPC、NSXPC、Mach bootstrap、CFMessagePort 及分布式通知等 IPC 通道的完整交互过程，并提供基于 ncurses 的交互式终端界面（TUI）进行进程选择、注入控制和消息流可视化。项目采用 C 实现，依赖 processor_set_tasks 和自定义 arm64e trampoline 实现高兼容性注入，支持沙盒化守护进程及 __RESTRICT 二进制文件（通过 ptrace 回退）。适用于系统安全研究、macOS 底层 IPC 行为分析、沙盒权限调试及逆向工程等需要深度观测系统级 IPC 流量的场景。","2026-11-24 04:44:04","CREATED_QUERY"]