2018-11-13 22:39:03 -08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
# This script is necessary to circumvent the entitlements check in imagent.
|
|
|
|
|
# Might want to wrap this script up in a startup script or something so we make sure this
|
|
|
|
|
# happens every time.
|
|
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
|
echo "Usage: hookAgent.sh libagentHook.dylib"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
LIB_PATH=$(python -c "import os; print(os.path.realpath('$1'))")
|
|
|
|
|
echo "Library path: $LIB_PATH"
|
|
|
|
|
|
|
|
|
|
echo "Telling imagent to launch with inserted libraries for uid $EUID"
|
|
|
|
|
sudo launchctl debug gui/$EUID/com.apple.imagent --environment DYLD_INSERT_LIBRARIES=$LIB_PATH
|
|
|
|
|
launchctl kill SIGKILL gui/501/com.apple.imagent
|
|
|
|
|
|
2019-01-22 23:31:36 -08:00
|
|
|
echo "\nYou might have to kill imagent for changes to take effect (killall imagent)"
|
2018-11-13 22:39:03 -08:00
|
|
|
|