forked from jaku/SnapCameraPreservation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac.sh
116 lines (89 loc) · 3.84 KB
/
mac.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root (sudo)"
exit 1
fi
# Check if Snap Camera is running
if pgrep -x "Snap Camera" > /dev/null; then
pkill -x "Snap Camera"
fi
launchctl remove com.snap.SnapCameraRemover 2> /dev/null
rm -rf ~/Library/Caches/Snap/ 2> /dev/null
rm -rf ~/Library/Caches/com.snap.SnapCamera/ 2> /dev/null
#rm -rf ~/Library/Preferences/Snap/ 2> /dev/null
rm -rf ~/Library/Preferences/com.snap.SnapCamera.plist 2> /dev/null
rm -rf ~/Library/Preferences/com.snap.Snap\ Camera.plist 2> /dev/null
rm -rf /Applications/Snap\ Camera.app/ 2> /dev/null
echo "Please wait while we download Snap Camera"
curl https://snapchatreverse.jaku.tv/snap/static/SnapCamMac.pkg -o /tmp/SnapCamMac.pkg 2> /dev/null
installer -allowUntrusted -verboseR -pkg /tmp/SnapCamMac.pkg -target / > /dev/null
echo "Waiting to make sure Snap Camera is installed"
if pgrep -x "Snap Camera" > /dev/null; then
pkill -x "Snap Camera"
fi
sleep 1
if pgrep -x "Snap Camera" > /dev/null; then
pkill -x "Snap Camera"
fi
sleep 2
if pgrep -x "Snap Camera" > /dev/null; then
pkill -x "Snap Camera"
fi
original_binary="/Applications/Snap Camera.app/Contents/MacOS/Snap Camera"
tmp_hex_dump="/tmp/snapcamera.hex"
modified_binary="/tmp/snapcamera"
if [ ! -f "/Applications/Snap Camera.app/Contents/MacOS/Snap Camera" ]; then
echo "Snap Camera not found. Please install first and then run this script."
exit 1
fi
# Define the original and replacement URLs in hex without spaces
# https://studio-app.snapchat.com
original_url_hex="68747470733a2f2f73747564696f2d6170702e736e6170636861742e636f6d"
# https://snapchatreverse.jaku.tv/snap
replacement_url_hex="68747470733a2f2f736e617063686174726576657273652e6a616b752e7476"
echo "This part will take a while. Please be patient."
# Step 1: Dump the binary to a plain hex representation
xxd -p "$original_binary" | tr -d '\n' > "$tmp_hex_dump"
if [ $? -ne 0 ]; then
echo "Failed to dump the Snap Camera app, check that Terminal has permission under App Management and try again."
exit 1
fi
# Step 2: Modify the hex representation
sed -i '' "s/$original_url_hex/$replacement_url_hex/g" "$tmp_hex_dump"
# Step 3: Convert the hex representation back to a binary
xxd -r -p "$tmp_hex_dump" > "$modified_binary"
# Step 4: Overwrite the original binary with the modified version
# Note: This step requires administrative privileges
sudo cp "$modified_binary" "$original_binary"
if [ $? -ne 0 ]; then
echo "Unable to complete the application move, check that Terminal has permission under App Management and try again."
sleep 2
open "https://support.apple.com/guide/mac-help/allow-apps-to-control-other-apps-on-mac-mchl07817563/mac"
exit 1
fi
# Clean up temporary files
rm "$tmp_hex_dump"
rm "$modified_binary"
chmod +x "/Applications/Snap Camera.app/Contents/MacOS/Snap Camera"
codesign --remove-signature "/Applications/Snap Camera.app"
if [ $? -ne 0 ]; then
# Move the application to another spot before signing as it can fail for some users
cp -fa "/Applications/Snap Camera.app" "/Applications/Snap Camera Temp.app"
codesign --remove-signature "/Applications/Snap Camera Temp.app"
if [ $? -ne 0 ]; then
echo "Failed to remove signatures, Xcode command line tools may not be installed."
exit 1
fi
xattr -cr "/Applications/Snap Camera Temp.app"
codesign --force --deep --sign - "/Applications/Snap Camera Temp.app"
#rm -rf "/Applications/Snap Camera.app"
cp -fa "/Applications/Snap Camera Temp.app" "/Applications/Snap Camera.app"
#rm -rf "/Applications/Snap Camera Temp.app"
echo "Snap Camera has been patched!!"
open "/Applications/Snap Camera.app"
exit 0
fi
xattr -cr "/Applications/Snap Camera.app"
codesign --force --deep --sign - "/Applications/Snap Camera.app"
echo "Snap Camera has been patched!"
open "/Applications/Snap Camera.app"