|
|
|
|
@ -8,6 +8,11 @@ VERSION='1.09' |
|
|
|
|
# 最大支持流媒体 |
|
|
|
|
SUPPORT_NUM='2' |
|
|
|
|
|
|
|
|
|
# 选择 IP API 服务商 |
|
|
|
|
IP_API=https://api.ip.sb/geoip; ISP=isp |
|
|
|
|
#IP_API=https://ifconfig.co/json; ISP=asn_org |
|
|
|
|
#IP_API=https://ip.gs/json; ISP=asn_org |
|
|
|
|
|
|
|
|
|
E[0]="Language:\n 1.English (default) \n 2.简体中文" |
|
|
|
|
C[0]="${E[0]}" |
|
|
|
|
E[1]="Support change IP for warp-go mode" |
|
|
|
|
@ -80,8 +85,8 @@ E[34]="License should be 26 characters, please re-enter WARP+ License. Otherwise |
|
|
|
|
C[34]="License 应为26位字符,请重新输入 WARP+ License \(剩余\${i}次\): " |
|
|
|
|
E[35]="Please customize the WARP+ device name (Default is [warp-go] if left blank):" |
|
|
|
|
C[35]="请自定义 WARP+ 设备名 (如果不输入,默认为 [warp-go]):" |
|
|
|
|
E[36]="" |
|
|
|
|
C[36]="" |
|
|
|
|
E[36]="Press [y] to confirm whether to uninstall dependencies: nodejs and npm. Other keys do not uninstall by default:" |
|
|
|
|
C[36]="是否卸载依赖 nodejs 和 npm,确认请按 [y] ,其他键默认不卸载:" |
|
|
|
|
E[37]="" |
|
|
|
|
C[37]="" |
|
|
|
|
E[38]="" |
|
|
|
|
@ -143,7 +148,7 @@ statistics_of_run-times() { |
|
|
|
|
|
|
|
|
|
# 选择语言,先判断 warp 脚本里的语言选择,没有的话再让用户选择,默认英语 |
|
|
|
|
select_laguage() { |
|
|
|
|
if [[ -z "$L" ]]; then |
|
|
|
|
if [ -z "$L" ]; then |
|
|
|
|
if [ -e /opt/warp-go/language ]; then |
|
|
|
|
L=$(cat /opt/warp-go/language 2>&1) |
|
|
|
|
elif [ -e /etc/wireguard/language ]; then |
|
|
|
|
@ -153,7 +158,7 @@ select_laguage() { |
|
|
|
|
E ) L=E;; |
|
|
|
|
C ) L=C;; |
|
|
|
|
* ) L=E && hint "\n $(text 0) \n" && reading " $(text 3) " LANGUAGE |
|
|
|
|
[[ $LANGUAGE = 2 ]] && L=C;; |
|
|
|
|
[ "$LANGUAGE" = 2 ] && L=C;; |
|
|
|
|
esac |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
@ -170,18 +175,19 @@ check_system_info() { |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
for a in "${CMD[@]}"; do |
|
|
|
|
SYS="$a" && [[ -n $SYS ]] && break |
|
|
|
|
SYS="$a" && [ -n "$SYS" ] && break |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
REGEX=("debian" "ubuntu" "centos|red hat|kernel|oracle linux|amazon linux|alma|rocky") |
|
|
|
|
RELEASE=("Debian" "Ubuntu" "CentOS") |
|
|
|
|
PACKAGE_UPDATE=("apt -y update" "apt -y update" "yum -y update") |
|
|
|
|
PACKAGE_INSTALL=("apt -y install" "apt -y install" "yum -y install") |
|
|
|
|
PACKAGE_UNINSTALL=("apt -y autoremove" "apt -y autoremove" "yum -y autoremove") |
|
|
|
|
|
|
|
|
|
for ((b=0; b<${#REGEX[@]}; b++)); do |
|
|
|
|
[[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[b]} ]] && SYSTEM="${RELEASE[b]}" && break |
|
|
|
|
[[ $(tr '[:upper:]' '[:lower:]' <<< "$SYS") =~ ${REGEX[b]} ]] && SYSTEM="${RELEASE[b]}" && break |
|
|
|
|
done |
|
|
|
|
[[ -z $SYSTEM ]] && error " $(text 5) " |
|
|
|
|
[ -z "$SYSTEM" ] && error " $(text 5) " |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 检查是否有安装任一版本的 python 依赖,如全部没有,则安装 python3 |
|
|
|
|
@ -206,7 +212,7 @@ check_unlock_running() { |
|
|
|
|
|
|
|
|
|
# 判断是否已经安装 WARP 网络接口或者 Socks5 代理,如已经安装组件尝试启动。再分情况作相应处理 |
|
|
|
|
check_warp() { |
|
|
|
|
if [[ -z "${STATUS[@]}" ]]; then |
|
|
|
|
if [ -z "${STATUS[*]}" ]; then |
|
|
|
|
if [[ $(ip a) =~ ": WARP:"|": wgcf:" ]]; then |
|
|
|
|
WARP="--interface wgcf" |
|
|
|
|
if [[ $(ip a) =~ ": WARP:" ]]; then |
|
|
|
|
@ -215,14 +221,14 @@ check_warp() { |
|
|
|
|
if grep -qE 'Type[ ]+=[ ]+team' /opt/warp-go/warp.conf; then |
|
|
|
|
hint "\n $(text 32) \n" && reading " $(text 3) " CHANGE_ACCOUNT |
|
|
|
|
case "$CHANGE_ACCOUNT" in |
|
|
|
|
2 ) [[ -z $LICENSE ]] && reading " $(text 42) " LICENSE |
|
|
|
|
2 ) [ -z "$LICENSE" ] && reading " $(text 42) " LICENSE |
|
|
|
|
local i=5 |
|
|
|
|
until [[ $LICENSE =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do |
|
|
|
|
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do |
|
|
|
|
(( i-- )) || true |
|
|
|
|
[[ $i = 0 ]] && error " $(text 33) " && exit 1 || reading " $(text 34) " LICENSE |
|
|
|
|
[ "$i" = 0 ] && error " $(text 33) " && exit 1 || reading " $(text 34) " LICENSE |
|
|
|
|
done |
|
|
|
|
[[ -n $LICENSE && -z $NAME ]] && reading " $(text 35) " NAME |
|
|
|
|
[[ -n $NAME ]] && NAME="${NAME//[[:space:]]/_}" || NAME=${NAME:-'warp-go'} |
|
|
|
|
[[ -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 35) " NAME |
|
|
|
|
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME=${NAME:-'warp-go'} |
|
|
|
|
echo "$LICENSE" > /opt/warp-go/License |
|
|
|
|
echo "$NAME" > /opt/warp-go/Device_Name;; |
|
|
|
|
3 ) exit 0;; |
|
|
|
|
@ -231,8 +237,8 @@ check_warp() { |
|
|
|
|
fi |
|
|
|
|
TRACE4=$(curl -ks4m8 $WARP https://www.cloudflare.com/cdn-cgi/trace | grep warp | sed "s/warp=//g") |
|
|
|
|
TRACE6=$(curl -ks6m8 $WARP https://www.cloudflare.com/cdn-cgi/trace | grep warp | sed "s/warp=//g") |
|
|
|
|
[[ $TRACE4 =~ on|plus ]] && STATUS[0]=1 || STATUS[0]=0 |
|
|
|
|
[[ $TRACE6 =~ on|plus ]] && STATUS[1]=1 || STATUS[1]=0 |
|
|
|
|
[[ "$TRACE4" =~ on|plus ]] && STATUS[0]=1 || STATUS[0]=0 |
|
|
|
|
[[ "$TRACE6" =~ on|plus ]] && STATUS[1]=1 || STATUS[1]=0 |
|
|
|
|
else |
|
|
|
|
STATUS=(0 0) |
|
|
|
|
fi |
|
|
|
|
@ -241,7 +247,7 @@ check_warp() { |
|
|
|
|
if type -p warp-cli >/dev/null 2>&1; then |
|
|
|
|
! systemctl is-active warp-svc >/dev/null 2>&1 && systemctl start warp-svc && sleep 5 |
|
|
|
|
if [[ $(warp-cli --accept-tos settings) =~ WarpProxy ]]; then |
|
|
|
|
[[ $(ss -nltp) =~ 'warp-svc' ]] && CLIENT_PORT=$(ss -nltp | grep warp-svc | grep -oP '127.0*\S+' | cut -d: -f2) && STATUS[2]=1 || STATUS[2]=0 |
|
|
|
|
[[ $(ss -nltp) =~ 'warp-svc' ]] && CLIENT_PORT=$(ss -nltp | grep warp-svc | grep -oP '127\.0*\S+' | cut -d: -f2) && STATUS[2]=1 || STATUS[2]=0 |
|
|
|
|
else |
|
|
|
|
[[ $(ip a) =~ 'CloudflareWARP' ]] && STATUS[2]=1 || STATUS[2]=0 |
|
|
|
|
fi |
|
|
|
|
@ -249,13 +255,13 @@ check_warp() { |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
type -p wireproxy >/dev/null 2>&1 && [[ ! $(ss -nltp) =~ 'wireproxy' ]] && systemctl restart wireproxy |
|
|
|
|
[[ $(ss -nltp) =~ 'wireproxy' ]] && WIREPROXY_PORT=$(ss -nltp | grep wireproxy | grep -oP '127.0*\S+' | cut -d: -f2) && STATUS[3]=1 || STATUS[3]=0 |
|
|
|
|
[[ $(ss -nltp) =~ 'wireproxy' ]] && WIREPROXY_PORT=$(ss -nltp | grep wireproxy | grep -oP '127\.0*\S+' | cut -d: -f2) && STATUS[3]=1 || STATUS[3]=0 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
wgcf_warp() { wget -N --no-check-certificate https://raw.githubusercontent.com/fscarmen/warp/main/menu.sh && bash menu.sh; exit; } |
|
|
|
|
warp-go() { wget -N --no-check-certificate https://raw.githubusercontent.com/fscarmen/warp/main/warp-go.sh && bash warp-go.sh; exit; } |
|
|
|
|
p3terx() { bash <(curl -fsSL git.io/warp.sh) menu; exit; } |
|
|
|
|
misaka() { wget -N --no-check-certificate https://raw.githubusercontents.com/Misaka-blog/Misaka-WARP-Script/master/misakawarp.sh && bash misakawarp.sh; exit; } |
|
|
|
|
misaka() { wget -N --no-check-certificate https://gitlab.com/misakablog/warp-script/-/raw/main/warp.sh && bash warp.sh; exit; } |
|
|
|
|
|
|
|
|
|
CASE_IPV4() { NIC="-ks4m8 $WARP"; RESTART="warp_restart"; } |
|
|
|
|
CASE_IPV6() { NIC="-ks6m8 $WARP"; RESTART="warp_restart"; } |
|
|
|
|
@ -272,49 +278,50 @@ check_warp() { |
|
|
|
|
DO0=("exit") |
|
|
|
|
|
|
|
|
|
for ((f=0; f<${#INSTALL_CHECK[@]}; f++)); do |
|
|
|
|
[[ ${STATUS[@]} = "${INSTALL_CHECK[f]}" ]] && break |
|
|
|
|
[[ "${STATUS[*]}" = "${INSTALL_CHECK[f]}" ]] && break |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
# 默认只安装一种 WARP 形式时,不用选择。如两种或以上则让用户选择哪个方式的解锁 |
|
|
|
|
CHOOSE2=1 |
|
|
|
|
if echo "$f" | grep -qvwE "12|13|14|15"; then |
|
|
|
|
hint "${SHOW[f]}" && reading " $(text 3) " CHOOSE2 |
|
|
|
|
echo "$CHOOSE2" | grep -qvwE "${NUM[f]}" && error " $(text 54) " |
|
|
|
|
if grep -qvwE "12|13|14|15" <<< "$f"; then |
|
|
|
|
hint "${SHOW[f]}" && reading " $(text 3) " CHOOSE2 |
|
|
|
|
[[ "$f" = 0 && "$CHOOSE2" != [0-4] ]] && CHOOSE2=1 |
|
|
|
|
grep -qvwE "${NUM[f]}" <<< "$CHOOSE2" && error " $(text 54) " |
|
|
|
|
fi |
|
|
|
|
$(eval echo \${DO$CHOOSE2[f]}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 期望解锁流媒体, 变量 SUPPORT_NUM 限制选项枚举的次数,不填默认全选, 解锁状态保存在 /usr/bin/status.log |
|
|
|
|
input_streammedia_unlock() { |
|
|
|
|
if [[ -z "${STREAM_UNLOCK[@]}" ]]; then |
|
|
|
|
if [ -z "${STREAM_UNLOCK[@]}" ]; then |
|
|
|
|
hint "\n $(text 15) \n" && reading " $(text 3) " CHOOSE4 |
|
|
|
|
for ((d=0; d<"$SUPPORT_NUM"; d++)); do |
|
|
|
|
( [[ -z "$CHOOSE4" ]] || echo "$CHOOSE4" | grep -q "$((d+1))" ) && STREAM_UNLOCK[d]='1' || STREAM_UNLOCK[d]='0' |
|
|
|
|
[[ $d = 0 ]] && echo 'null' > /usr/bin/status.log || echo 'null' >> /usr/bin/status.log |
|
|
|
|
( [ -z "$CHOOSE4" ] || echo "$CHOOSE4" | grep -q "$((d+1))" ) && STREAM_UNLOCK[d]='1' || STREAM_UNLOCK[d]='0' |
|
|
|
|
[ "$d" = 0 ] && echo 'null' > /usr/bin/status.log || echo 'null' >> /usr/bin/status.log |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
|
UNLOCK_SELECT=$(for ((e=0; e<"$SUPPORT_NUM"; e++)); do |
|
|
|
|
[[ "${STREAM_UNLOCK[e]}" = 1 ]] && echo -e "[[ ! \${R[*]} =~ 'No' ]] && check$e;" || echo -e "#[[ ! \${R[*]} =~ 'No' ]] && check$e;" |
|
|
|
|
[ "${STREAM_UNLOCK[e]}" = 1 ] && echo -e "[[ ! \${R[*]} =~ 'No' ]] && check$e;" || echo -e "#[[ ! \${R[*]} =~ 'No' ]] && check$e;" |
|
|
|
|
done) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 期望解锁地区 |
|
|
|
|
input_region() { |
|
|
|
|
if [[ -z "$EXPECT" ]]; then |
|
|
|
|
REGION=$(curl -ksm8 https://ip.gs/country-iso 2>/dev/null) |
|
|
|
|
if [ -z "$EXPECT" ]; then |
|
|
|
|
REGION=$(curl -ksm8 -A Mozilla $IP_API | grep -E "country_iso|country_code" | sed 's/.*country_[a-z]\+\":[ ]*\"\([^"]*\).*/\1/g' 2>/dev/null) |
|
|
|
|
reading "\n $(text_eval 13) " EXPECT |
|
|
|
|
until [[ -z $EXPECT || $EXPECT = [Yy] || $EXPECT =~ ^[A-Za-z]{2}$ ]]; do |
|
|
|
|
until [[ -z "$EXPECT" || "$EXPECT" = [Yy] || "$EXPECT" =~ ^[A-Za-z]{2}$ ]]; do |
|
|
|
|
reading "\n $(text_eval 13) " EXPECT |
|
|
|
|
done |
|
|
|
|
[[ -z $EXPECT || $EXPECT = [Yy] ]] && EXPECT="$REGION" |
|
|
|
|
[[ -z "$EXPECT" || "$EXPECT" = [Yy] ]] && EXPECT="$REGION" |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Telegram Bot 日志推送 |
|
|
|
|
input_tg() { |
|
|
|
|
[[ -z $CUSTOM ]] && reading "\n $(text_eval 29) " TOKEN |
|
|
|
|
[[ -n $TOKEN && -z $USERID ]] && reading "\n $(text_eval 30) " USERID |
|
|
|
|
[[ -n $USERID && -z $CUSTOM ]] && reading "\n $(text_eval 31) " CUSTOM |
|
|
|
|
[ -z "$CUSTOM" ] && reading "\n $(text_eval 29) " TOKEN |
|
|
|
|
[[ -n "$TOKEN" && -z "$USERID" ]] && reading "\n $(text_eval 30) " USERID |
|
|
|
|
[[ -n "$USERID" && -z "$CUSTOM" ]] && reading "\n $(text_eval 31) " CUSTOM |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 根据用户选择在线生成解锁程序,放在 /etc/wireguard/unlock.sh |
|
|
|
|
@ -326,7 +333,7 @@ input_region |
|
|
|
|
input_tg |
|
|
|
|
|
|
|
|
|
# 检测 Disney+ 需要用到 python 依赖 |
|
|
|
|
[[ ${STREAM_UNLOCK[1]} = 1 && -z $PYTHON ]] && check_python |
|
|
|
|
[[ "${STREAM_UNLOCK[1]}" = 1 && -z "$PYTHON" ]] && check_python |
|
|
|
|
|
|
|
|
|
# 根据解锁模式写入定时任务或systemd |
|
|
|
|
sh -c "$TASK" |
|
|
|
|
@ -350,7 +357,7 @@ NOT_UNLOCK_STATUS='No 😰' |
|
|
|
|
LMC999=\$(curl -sSLm4 https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh) |
|
|
|
|
RESULT_TITLE=\$(echo "\$LMC999" | grep "result.*netflix.com/title/" | sed "s/.*title\/\([^\"]*\).*/\1/") |
|
|
|
|
REGION_TITLE=\$(echo "\$LMC999" | grep "region.*netflix.com/title/" | sed "s/.*title\/\([^\"]*\).*/\1/") |
|
|
|
|
RESULT_TITLE=\${RESULT_TITLE:-'81215567'}; REGION_TITLE=\${REGION_TITLE:-'80018499'} |
|
|
|
|
RESULT_TITLE=\${RESULT_TITLE:-'81280792'}; REGION_TITLE=\${REGION_TITLE:-'80018499'} |
|
|
|
|
timedatectl set-timezone Asia/Shanghai |
|
|
|
|
|
|
|
|
|
if [[ \$(pgrep -laf ^[/d]*bash.*warp_unlock | awk -F, '{a[\$2]++}END{for (i in a) print i" "a[i]}') -le 2 ]]; then |
|
|
|
|
@ -362,10 +369,10 @@ if [[ \$(pgrep -laf ^[/d]*bash.*warp_unlock | awk -F, '{a[\$2]++}END{for (i in a |
|
|
|
|
|
|
|
|
|
check_ip() { |
|
|
|
|
unset IP_INFO WAN COUNTRY ASNORG |
|
|
|
|
IP_INFO="\$(curl \$NIC https://ip.gs/json 2>/dev/null)" |
|
|
|
|
WAN=\$(expr "\$IP_INFO" : '.*ip\":\"\([^"]*\).*') |
|
|
|
|
COUNTRY=\$(expr "\$IP_INFO" : '.*country\":\"\([^"]*\).*') |
|
|
|
|
ASNORG=\$(expr "\$IP_INFO" : '.*asn_org\":\"\([^"]*\).*') |
|
|
|
|
IP_INFO="\$(curl \$NIC -A Mozilla $IP_API 2>/dev/null)" |
|
|
|
|
WAN=\$(expr "\$IP_INFO" : '.*ip\":[ ]*\"\([^"]*\).*') |
|
|
|
|
COUNTRY=\$(expr "\$IP_INFO" : '.*country\":[ ]*\"\([^"]*\).*') |
|
|
|
|
ASNORG=\$(expr "\$IP_INFO" : '.*'$ISP'\":[ ]*\"\([^"]*\).*') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
warp_restart() { |
|
|
|
|
@ -376,7 +383,7 @@ if [[ \$(pgrep -laf ^[/d]*bash.*warp_unlock | awk -F, '{a[\$2]++}END{for (i in a |
|
|
|
|
((k++)) || true |
|
|
|
|
[[ \$k = 11 ]] && rm -f /opt/warp-go/warp.conf.tmp* && echo -e " Failed to register warp account. Script aborted. " && exit 1 |
|
|
|
|
/opt/warp-go/warp-go --register --config=/opt/warp-go/warp.conf.tmp2 --license=\$(cat /opt/warp-go/License 2>/dev/null) --device-name=\$(cat /opt/warp-go/Device_Name 2>/dev/null) >/dev/null 2>&1 |
|
|
|
|
[[ \$? != 0 ]] && sleep 10 |
|
|
|
|
[[ \$? != 0 ]] && sleep 30 |
|
|
|
|
done |
|
|
|
|
sed -i '1,6!d' /opt/warp-go/warp.conf.tmp2 |
|
|
|
|
tail -n +7 /opt/warp-go/warp.conf.tmp1 >> /opt/warp-go/warp.conf.tmp2 |
|
|
|
|
@ -384,7 +391,7 @@ if [[ \$(pgrep -laf ^[/d]*bash.*warp_unlock | awk -F, '{a[\$2]++}END{for (i in a |
|
|
|
|
/opt/warp-go/warp-go --config=/opt/warp-go/warp.conf.tmp1 --remove >/dev/null 2>&1 |
|
|
|
|
rm -f /opt/warp-go/warp.conf.tmp* |
|
|
|
|
systemctl restart warp-go |
|
|
|
|
sleep 10 |
|
|
|
|
sleep 30 |
|
|
|
|
else |
|
|
|
|
systemctl restart wg-quick@wgcf |
|
|
|
|
sleep 2 |
|
|
|
|
@ -424,27 +431,27 @@ if [[ \$(pgrep -laf ^[/d]*bash.*warp_unlock | awk -F, '{a[\$2]++}END{for (i in a |
|
|
|
|
check1() { |
|
|
|
|
unset PreAssertion assertion disneycookie TokenContent isBanned is403 fakecontent refreshToken disneycontent tmpresult previewcheck isUnabailable region inSupportedLocation |
|
|
|
|
R[1]="" |
|
|
|
|
PreAssertion=\$(curl \$NIC --user-agent "\${UA_Browser}" -s --max-time 10 -X POST "https://global.edge.bamgrid.com/devices" -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -H "content-type: application/json; charset=UTF-8" -d '{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","attributes":{}}' 2>&1) |
|
|
|
|
PreAssertion=\$(curl \$NIC --user-agent "\${UA_Browser}" -s --max-time 10 -X POST "https://disney.api.edge.bamgrid.com/devices" -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -H "content-type: application/json; charset=UTF-8" -d '{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","attributes":{}}' 2>&1) |
|
|
|
|
[[ "\$PreAssertion" == "curl"* ]] && R[1]="\$NOT_UNLOCK_STATUS" |
|
|
|
|
if [[ \${R[1]} != "\$NOT_UNLOCK_STATUS" ]]; then |
|
|
|
|
assertion=\$(echo \$PreAssertion | \$PYTHON -m json.tool 2> /dev/null | grep assertion | cut -f4 -d'"') |
|
|
|
|
PreDisneyCookie=\$(curl \$NIC --max-time 10 "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/cookies" | sed -n '1p') |
|
|
|
|
disneycookie=\$(echo \$PreDisneyCookie | sed "s/DISNEYASSERTION/\${assertion}/g") |
|
|
|
|
TokenContent=\$(curl \$NIC --user-agent "\${UA_Browser}" -s --max-time 10 -X POST "https://global.edge.bamgrid.com/token" -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "\$disneycookie") |
|
|
|
|
isBanned=\$(echo \$TokenContent | \$PYTHON -m json.tool 2> /dev/null | grep 'forbidden-location') |
|
|
|
|
TokenContent=\$(curl \$NIC --user-agent "\${UA_Browser}" -s --max-time 10 -X POST "https://disney.api.edge.bamgrid.com/token" -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "\$disneycookie") |
|
|
|
|
isBanned=\$(echo \$TokenContent | \$PYTHON -m json.tool 2>/dev/null | grep 'forbidden-location') |
|
|
|
|
is403=\$(echo \$TokenContent | grep '403 ERROR') |
|
|
|
|
[[ -n "\$isBanned\$is403" ]] && R[1]="\$NOT_UNLOCK_STATUS" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [[ \${R[1]} != "\$NOT_UNLOCK_STATUS" ]]; then |
|
|
|
|
fakecontent=\$(curl -s --max-time 10 "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/cookies" | sed -n '8p') |
|
|
|
|
refreshToken=\$(echo \$TokenContent | \$PYTHON -m json.tool 2> /dev/null | grep 'refresh_token' | awk '{print \$2}' | cut -f2 -d'"') |
|
|
|
|
refreshToken=\$(echo \$TokenContent | \$PYTHON -m json.tool 2>/dev/null | grep 'refresh_token' | awk '{print \$2}' | cut -f2 -d'"') |
|
|
|
|
disneycontent=\$(echo \$fakecontent | sed "s/ILOVEDISNEY/\${refreshToken}/g") |
|
|
|
|
tmpresult=\$(curl \$NIC --user-agent "\${UA_Browser}" -X POST -sSL --max-time 10 "https://disney.api.edge.bamgrid.com/graph/v1/device/graphql" -H "authorization: ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "\$disneycontent" 2>&1) |
|
|
|
|
previewcheck=\$(curl \$NIC -s -o /dev/null -L --max-time 10 -w '%{url_effective}\n' "https://disneyplus.com" | grep preview) |
|
|
|
|
isUnabailable=\$(echo \$previewcheck | grep 'unavailable') |
|
|
|
|
region=\$(echo \$tmpresult | \$PYTHON -m json.tool 2> /dev/null | grep 'countryCode' | cut -f4 -d'"') |
|
|
|
|
inSupportedLocation=\$(echo \$tmpresult | \$PYTHON -m json.tool 2> /dev/null | grep 'inSupportedLocation' | awk '{print \$2}' | cut -f1 -d',') |
|
|
|
|
isUnabailable=\$(echo \$previewcheck | grep 'unavailable') |
|
|
|
|
region=\$(echo \$tmpresult | \$PYTHON -m json.tool 2>/dev/null | grep 'countryCode' | cut -f4 -d'"') |
|
|
|
|
inSupportedLocation=\$(echo \$tmpresult | \$PYTHON -m json.tool 2>/dev/null | grep 'inSupportedLocation' | awk '{print \$2}' | cut -f1 -d',') |
|
|
|
|
[[ "\$region" == "JP" || ( -n "\$region" && "\$inSupportedLocation" == "true" ) ]] && R[1]="\$UNLOCK_STATUS" || R[1]="\$NOT_UNLOCK_STATUS" |
|
|
|
|
fi |
|
|
|
|
CONTENT="Disney+: \${R[1]}." |
|
|
|
|
@ -453,18 +460,18 @@ if [[ \$(pgrep -laf ^[/d]*bash.*warp_unlock | awk -F, '{a[\$2]++}END{for (i in a |
|
|
|
|
sed -i "2s/.*/\${R[1]}/" /usr/bin/status.log |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
${MODE2[0]} |
|
|
|
|
check_ip |
|
|
|
|
CONTENT='Script runs.' |
|
|
|
|
log_message |
|
|
|
|
UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x6*4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" |
|
|
|
|
$UNLOCK_SELECT |
|
|
|
|
until [[ ! \${R[*]} =~ "\$NOT_UNLOCK_STATUS" ]]; do |
|
|
|
|
unset R |
|
|
|
|
\$RESTART |
|
|
|
|
$UNLOCK_SELECT |
|
|
|
|
done |
|
|
|
|
${MODE2[1]} |
|
|
|
|
${MODE2[0]} |
|
|
|
|
check_ip |
|
|
|
|
CONTENT='Script runs.' |
|
|
|
|
log_message |
|
|
|
|
UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x6*4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" |
|
|
|
|
$UNLOCK_SELECT |
|
|
|
|
until [[ ! \${R[*]} =~ "\$NOT_UNLOCK_STATUS" ]]; do |
|
|
|
|
unset R |
|
|
|
|
\$RESTART |
|
|
|
|
$UNLOCK_SELECT |
|
|
|
|
done |
|
|
|
|
${MODE2[1]} |
|
|
|
|
fi |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
@ -479,6 +486,12 @@ result_output() { |
|
|
|
|
|
|
|
|
|
# 卸载 |
|
|
|
|
uninstall() { |
|
|
|
|
node -v >/dev/null 2>&1 && npm -v >/dev/null 2>&1 && PM2=1 && reading " $(text 36) " REMOVE_DEPS |
|
|
|
|
if [ "$PM2" = 1 ]; then |
|
|
|
|
pm2 delete warp_unlock >/dev/null 2>&1 |
|
|
|
|
pm2 unstartup systemd >/dev/null 2>&1 |
|
|
|
|
[[ "$REMOVE_DEPS" = [Yy] ]] && ${PACKAGE_UNINSTALL[b]} nodejs npm |
|
|
|
|
fi |
|
|
|
|
screen -QX u quit >/dev/null 2>&1 && screen -wipe >/dev/null 2>&1 |
|
|
|
|
type -p wg-quick >/dev/null 2>&1 && systemctl restart wgcf >/dev/null 2>&1 |
|
|
|
|
type -p warp-cli >/dev/null 2>&1 && ( warp-cli --accept-tos delete >/dev/null 2>&1; sleep 1; warp-cli --accept-tos register >/dev/null 2>&1 ) |
|
|
|
|
@ -486,16 +499,15 @@ uninstall() { |
|
|
|
|
kill -9 $(pgrep -f warp_unlock.sh) >/dev/null 2>&1 |
|
|
|
|
rm -f /usr/bin/warp_unlock.sh /root/result.log /usr/bin/status.log /etc/systemd/system/warp_unlock.service |
|
|
|
|
systemctl disable --now warp_unlock >/dev/null 2>&1 |
|
|
|
|
pm2 delete warp_unlock >/dev/null 2>&1 |
|
|
|
|
pm2 unstartup systemd >/dev/null 2>&1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 输出执行结果,如是切换模式则不显示 |
|
|
|
|
[ "$UN" = 1 ] && info "\n $(text 11) \n" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 传参 1/2 |
|
|
|
|
[[ "$@" =~ -[Ee] ]] && L=E |
|
|
|
|
[[ "$@" =~ -[Cc] ]] && L=C |
|
|
|
|
[[ "$*" =~ -[Ee] ]] && L=E |
|
|
|
|
[[ "$*" =~ -[Cc] ]] && L=C |
|
|
|
|
|
|
|
|
|
# 主程序运行 1/2 |
|
|
|
|
statistics_of_run-times |
|
|
|
|
@ -597,8 +609,9 @@ action5() { |
|
|
|
|
[ -n "$UNLOCK_MODE_NOW" ] && uninstall |
|
|
|
|
TASK="" |
|
|
|
|
RESULT_OUTPUT="\n $(text 44) \n" |
|
|
|
|
node -v >/dev/null 2>&1 || ${PACKAGE_INSTALL[b]} nodejs |
|
|
|
|
npm -v >/dev/null 2>&1 || check_dependencies npm |
|
|
|
|
node -v >/dev/null 2>&1 || DEPS+='nodejs' |
|
|
|
|
npm -v >/dev/null 2>&1 || DEPS+=' npm' |
|
|
|
|
[ -n "$DEPS" ] && ( ${PACKAGE_UPDATE[b]}; ${PACKAGE_INSTALL[b]} $DEPS 2>/dev/null ) |
|
|
|
|
npm install -g pm2 |
|
|
|
|
export_unlock_file |
|
|
|
|
pm2 start /usr/bin/warp_unlock.sh |
|
|
|
|
@ -617,7 +630,7 @@ menu() { |
|
|
|
|
red "======================================================================================================================\n" |
|
|
|
|
info " $(text 17): $VERSION $(text 18): $(text 1)\n " |
|
|
|
|
red "======================================================================================================================\n" |
|
|
|
|
[[ -z "$CHOOSE1" ]] && hint " $MENU_SHOW " && reading " $(text 3) " CHOOSE1 |
|
|
|
|
[ -z "$CHOOSE1" ] && hint " $MENU_SHOW " && reading " $(text 3) " CHOOSE1 |
|
|
|
|
case "$CHOOSE1" in |
|
|
|
|
[0-6] ) action$CHOOSE1;; |
|
|
|
|
* ) red " $(text 14) "; sleep 1; menu;; |
|
|
|
|
|