forked from shwang1114/InjectLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpd.sh
88 lines (74 loc) · 2.72 KB
/
pd.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
#!/usr/bin/env bash
BASE_PATH=$(
cd $(dirname "$0")
pwd
)
COLOR_INFO='\033[0;34m'
COLOR_ERR='\033[0;35m'
NOCOLOR='\033[0m'
PDFM_DIR="/Applications/Parallels Desktop.app"
PDFM_VER="19.1.0-54729"
PDFM_DISP_DIR="${PDFM_DIR}/Contents/MacOS/Parallels Service.app/Contents/MacOS"
PDFM_DISP_DST="${PDFM_DISP_DIR}/prl_disp_service"
LICENSE_FILE="${BASE_PATH}/licenses.json"
LICENSE_DST="/Library/Preferences/Parallels/licenses.json"
echo "${COLOR_INFO}[*] 确保你的版本是: https://download.parallels.com/desktop/v19/${PDFM_VER}/ParallelsDesktop-${PDFM_VER}.dmg"
# check parallels desktop version
VERSION_1=$(defaults read "${PDFM_DIR}/Contents/Info.plist" CFBundleShortVersionString)
VERSION_2=$(defaults read "${PDFM_DIR}/Contents/Info.plist" CFBundleVersion)
INSTALL_VER="${VERSION_1}-${VERSION_2}"
# if [ "${PDFM_VER}" != "${VERSION_1}-${VERSION_2}" ]; then
# echo -e "${COLOR_ERR}[-] This script is for ${PDFM_VER}, but your's is ${INSTALL_VER}.${NOCOLOR}"
# exit 2
# fi
echo "${COLOR_INFO}[*] 复制伪造的授权文件 licenses.json${NOCOLOR}"
# stop prl_disp_service
if pgrep -x "prl_disp_service" &> /dev/null; then
echo -e "${COLOR_INFO}[*] Stopping Parallels Desktop${NOCOLOR}"
pkill -9 prl_client_app &>/dev/null
# ensure prl_disp_service has stopped
"${PDFM_DIR}/Contents/MacOS/Parallels Service" service_stop &>/dev/null
sleep 1
launchctl stop /Library/LaunchDaemons/com.parallels.desktop.launchdaemon.plist &>/dev/null
sleep 1
pkill -9 prl_disp_service &>/dev/null
sleep 1
rm -f "/var/run/prl_*"
fi
if [ -f "${LICENSE_DST}" ]; then
chflags -R 0 "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
rm -f "${LICENSE_DST}" >/dev/null || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
fi
cp -f "${LICENSE_FILE}" "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
chown root:wheel "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
chmod 444 "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
chflags -R 0 "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
chflags uchg "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
chflags schg "${LICENSE_DST}" || {
echo -e "${COLOR_ERR}error $? at line $LINENO.${NOCOLOR}"
exit $?
}
chmod 755 "${PDFM_DISP_DST}"
cp -f "/Applications/Parallels Desktop.app/Contents/MacOS/Parallels Service.app/Contents/MacOS/prl_disp_service" "/Applications/Parallels Desktop.app/Contents/MacOS/Parallels Service.app/Contents/MacOS/prl_disp_service_patched"
echo "${COLOR_INFO}[*] 破解完成。${NOCOLOR}"