-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch-gather.sh
More file actions
executable file
·38 lines (31 loc) · 1.18 KB
/
patch-gather.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# patch-gather.sh — Wrap GatherV2 to always expose CDP on localhost:9222
# Run once after install, and again after each Gather update.
set -e
APP="/Applications/GatherV2.app/Contents/MacOS"
REAL="$APP/GatherV2.bin"
WRAPPER="$APP/GatherV2"
# If the real binary is still named GatherV2 (fresh install or post-update), rename it
if [ -f "$WRAPPER" ] && [ ! -L "$WRAPPER" ] && [ ! -f "$REAL" ]; then
echo "Renaming original binary → GatherV2.bin"
mv "$WRAPPER" "$REAL"
elif [ -f "$WRAPPER" ] && [ -f "$REAL" ]; then
echo "Wrapper already exists, replacing it"
rm "$WRAPPER"
fi
if [ ! -f "$REAL" ]; then
echo "ERROR: GatherV2.bin not found. Is GatherV2 installed at /Applications/GatherV2.app?" >&2
exit 1
fi
echo "Writing wrapper script"
cat > "$WRAPPER" << 'EOF'
#!/bin/bash
exec "$(dirname "$0")/GatherV2.bin" --remote-debugging-port=9222 "$@"
EOF
chmod +x "$WRAPPER"
echo "Re-signing app bundle (ad-hoc)"
codesign --sign - --force --deep /Applications/GatherV2.app
echo ""
echo "Done. GatherV2 will now expose CDP on localhost:9222 on every launch."
echo "If macOS shows a security warning on first launch, go to:"
echo " System Settings → Privacy & Security → Open Anyway"