process_inject
process_inject copied to clipboard
macOS Process Injection Tool
macOS Process Injection Tool [SIP OFF]
Usage
process_inject <target> <dylib> [flags]
Parameters:
<target>: Can be one of:- Process ID of the target process (for direct injection)
- Process name (when using -name flag)
- Application bundle path (when using -spawn flag)
<dylib>: The full path to the dynamic library (dylib) to inject.[flags]: Optional flags for different injection modes.
Flags:
-name: Use the process name instead of process ID to identify the target (for existing processes).-spawn: Spawn a new process from the specified application bundle and inject the dylib.
Examples:
- Inject into an already running process by PID:
process_inject 1234 "/path/to/library.dylib"
- Inject into an already running process by name:
process_inject "Safari" "/path/to/library.dylib" -name
- Spawn a new process and inject (spawn mode):
process_inject "/Applications/Calculator.app/Contents/MacOS/Calculator" "/path/to/library.dylib" -spawn
Note: Injecting into root processes requires root privileges
sudo codesign -f -s - --all-architectures --deep --entitlements "process_inject.entitlements" process_inject
References
Thanks to these projects for their inspiring idea and code!