-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathcheck.sh
218 lines (197 loc) · 8.74 KB
/
check.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/sh
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
SKYBLUE='\033[0;36m'
PLAIN='\033[0m'
BrowserUA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36"
function Next() {
printf "%-60s\n" "-" | sed 's/\s/-/g'
}
function About() {
echo ""
echo " ========================================================= "
echo " \ Check.sh Script / "
echo " \ v1.0.0 (2023-03-19) / "
echo " \ https://1024.day / "
echo " ========================================================= "
echo ""
echo ""
}
function Install_oth(){
if [ -f "/usr/bin/apt-get" ]; then
apt-get update -y
apt-get install -y wget curl tar unzip
else
yum update -y
yum install -y epel-release
yum install -y wget curl tar unzip
fi
}
function UnlockNetflixTest() {
local result1=$(curl --user-agent "${BrowserUA}" -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/81280792" 2>&1)
if [[ "$result1" == "404" ]];then
echo -e " Netflix : ${YELLOW}Originals Only${PLAIN}" | tee -a $log
elif [[ "$result1" == "403" ]];then
echo -e " Netflix : ${RED}No${PLAIN}" | tee -a $log
elif [[ "$result1" == "200" ]];then
local region=`tr [:lower:] [:upper:] <<< $(curl --user-agent "${BrowserUA}" -fs --max-time 10 --write-out %{redirect_url} --output /dev/null "https://www.netflix.com/title/80018499" | cut -d '/' -f4 | cut -d '-' -f1)` ;
if [[ ! -n "$region" ]];then
region="US";
fi
echo -e " Netflix : ${GREEN}Yes (Region: ${region})${PLAIN}" | tee -a $log
elif [[ "$result1" == "000" ]];then
echo -e " Netflix : ${RED}Network connection failed${PLAIN}" | tee -a $log
fi
}
function UnlockYouTubePremiumTest() {
local tmpresult=$(curl --max-time 10 -sS -H "Accept-Language: en" "https://www.youtube.com/premium" 2>&1 )
local region=$(curl --user-agent "${BrowserUA}" -sL --max-time 10 "https://www.youtube.com/premium" | grep "countryCode" | sed 's/.*"countryCode"//' | cut -f2 -d'"')
if [ -n "$region" ]; then
sleep 0
else
isCN=$(echo $tmpresult | grep 'www.google.cn')
if [ -n "$isCN" ]; then
region=CN
else
region=US
fi
fi
if [[ "$tmpresult" == "curl"* ]];then
echo -e " YouTube Premium : ${RED}Network connection failed${PLAIN}" | tee -a $log
return;
fi
local result=$(echo $tmpresult | grep 'Premium is not available in your country')
if [ -n "$result" ]; then
echo -e " YouTube Premium : ${RED}No${PLAIN} ${PLAIN}${GREEN} (Region: $region)${PLAIN}" | tee -a $log
return;
fi
local result=$(echo $tmpresult | grep 'YouTube and YouTube Music ad-free')
if [ -n "$result" ]; then
echo -e " YouTube Premium : ${GREEN}Yes (Region: $region)${PLAIN}" | tee -a $log
return;
else
echo -e " YouTube Premium : ${RED}Failed${PLAIN}" | tee -a $log
fi
}
function UnlockBilibiliTest() {
#Test Mainland
local randsession="$(cat /dev/urandom | head -n 32 | md5sum | head -c 32)";
local result=$(curl --user-agent "${BrowserUA}" -fsSL --max-time 10 "https://api.bilibili.com/pgc/player/web/playurl?avid=82846771&qn=0&type=&otype=json&ep_id=307247&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" 2>&1);
if [[ "$result" != "curl"* ]]; then
result="$(echo "${result}" | grep '"code"' | awk -F 'code":' '{print $2}' | awk -F ',' '{print $1}')";
if [ "${result}" = "0" ]; then
echo -e " BiliBili China : ${GREEN}Yes (Region: Mainland Only)${PLAIN}" | tee -a $log
return;
fi
else
echo -e " BiliBili China : ${RED}Network connection failed${PLAIN}" | tee -a $log
return;
fi
#Test Hongkong/Macau/Taiwan
randsession="$(cat /dev/urandom | head -n 32 | md5sum | head -c 32)";
result=$(curl --user-agent "${BrowserUA}" -fsSL --max-time 10 "https://api.bilibili.com/pgc/player/web/playurl?avid=18281381&cid=29892777&qn=0&type=&otype=json&ep_id=183799&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" 2>&1);
if [[ "$result" != "curl"* ]]; then
result="$(echo "${result}" | grep '"code"' | awk -F 'code":' '{print $2}' | awk -F ',' '{print $1}')";
if [ "${result}" = "0" ]; then
echo -e " BiliBili China : ${GREEN}Yes (Region: HongKong/Macau/Taiwan Only)${PLAIN}" | tee -a $log
return;
fi
else
echo -e " BiliBili China : ${RED}Network connection failed${PLAIN}" | tee -a $log
return;
fi
#Test Taiwan
randsession="$(cat /dev/urandom | head -n 32 | md5sum | head -c 32)";
result=$(curl --user-agent "${BrowserUA}" -fsSL --max-time 10 "https://api.bilibili.com/pgc/player/web/playurl?avid=50762638&cid=100279344&qn=0&type=&otype=json&ep_id=268176&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" 2>&1);
if [[ "$result" != "curl"* ]]; then
result="$(echo "${result}" | grep '"code"' | awk -F 'code":' '{print $2}' | awk -F ',' '{print $1}')";
if [ "${result}" = "0" ]; then
echo -e " BiliBili China : ${GREEN}Yes (Region: Taiwan Only)${PLAIN}" | tee -a $log
return;
fi
else
echo -e " BiliBili China : ${RED}Network connection failed${PLAIN}" | tee -a $log
return;
fi
echo -e " BiliBili China : ${RED}No${PLAIN}" | tee -a $log
}
function UnlockTiktokTest() {
local result=$(curl --user-agent "${BrowserUA}" -fsSL --max-time 10 "https://www.tiktok.com/" 2>&1);
if [[ "$result" != "curl"* ]]; then
result="$(echo ${result} | grep 'region' | awk -F 'region":"' '{print $2}' | awk -F '"' '{print $1}')";
if [ -n "$result" ]; then
if [[ "$result" == "The #TikTokTraditions"* ]] || [[ "$result" == "This LIVE isn't available"* ]]; then
echo -e " TikTok : ${RED}No${PLAIN}" | tee -a $log
else
echo -e " TikTok : ${GREEN}Yes (Region: ${result})${PLAIN}" | tee -a $log
fi
else
echo -e " TikTok : ${RED}Failed${PLAIN}" | tee -a $log
return
fi
else
echo -e " TikTok : ${RED}Network connection failed${PLAIN}" | tee -a $log
fi
}
function UnlockiQiyiIntlTest() {
curl --user-agent "${BrowserUA}" -s -I --max-time 10 "https://www.iq.com/" >/tmp/iqiyi
if [ $? -eq 1 ]; then
echo -e " iQIYI International : ${RED}Network connection failed${PLAIN}" | tee -a $log
return
fi
local result="$(cat /tmp/iqiyi | grep 'mod=' | awk '{print $2}' | cut -f2 -d'=' | cut -f1 -d';')";
rm -f /tmp/iqiyi
if [ -n "$result" ]; then
if [[ "$result" == "ntw" ]]; then
result=TW
echo -e " iQIYI International : ${GREEN}Yes (Region: ${result})${PLAIN}" | tee -a $log
return
else
result=$(echo $result | tr [:lower:] [:upper:])
echo -e " iQIYI International : ${GREEN}Yes (Region: ${result})${PLAIN}" | tee -a $log
return
fi
else
echo -e " iQIYI International : ${RED}Failed${PLAIN}" | tee -a $log
return
fi
}
function UnlockChatGPTTest() {
if [[ $(curl --max-time 10 -sS https://chat.openai.com/ -I | grep "text/plain") != "" ]]
then
echo -e " ChatGPT : ${RED}IP is BLOCKED${PLAIN}" | tee -a $log
return
fi
local countryCode="$(curl --max-time 10 -sS https://chat.openai.com/cdn-cgi/trace | grep "loc=" | awk -F= '{print $2}')";
if [ $? -eq 1 ]; then
echo -e " ChatGPT : ${RED}Network connection failed${PLAIN}" | tee -a $log
return
fi
if [ -n "$countryCode" ]; then
support_countryCodes=(T1 XX AL DZ AD AO AG AR AM AU AT AZ BS BD BB BE BZ BJ BT BA BW BR BG BF CV CA CL CO KM CR HR CY DK DJ DM DO EC SV EE FJ FI FR GA GM GE DE GH GR GD GT GN GW GY HT HN HU IS IN ID IQ IE IL IT JM JP JO KZ KE KI KW KG LV LB LS LR LI LT LU MG MW MY MV ML MT MH MR MU MX MC MN ME MA MZ MM NA NR NP NL NZ NI NE NG MK NO OM PK PW PA PG PE PH PL PT QA RO RW KN LC VC WS SM ST SN RS SC SL SG SK SI SB ZA ES LK SR SE CH TH TG TO TT TN TR TV UG AE US UY VU ZM BO BN CG CZ VA FM MD PS KR TW TZ TL GB)
if [[ "${support_countryCodes[@]}" =~ "${countryCode}" ]]; then
echo -e " ChatGPT : ${GREEN}Yes (Region: ${countryCode})${PLAIN}" | tee -a $log
return
else
echo -e " ChatGPT : ${RED}No${PLAIN}" | tee -a $log
return
fi
else
echo -e " ChatGPT : ${RED}Failed${PLAIN}" | tee -a $log
return
fi
}
function StreamingMediaUnlockTest(){
Install_oth
clear
About
UnlockNetflixTest
UnlockYouTubePremiumTest
UnlockBilibiliTest
UnlockTiktokTest
UnlockiQiyiIntlTest
UnlockChatGPTTest
}
StreamingMediaUnlockTest
Next