-
Notifications
You must be signed in to change notification settings - Fork 545
/
check.sh
5902 lines (5061 loc) · 286 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
VER='1.0.0'
UA_BROWSER="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
UA_SEC_CH_UA='"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"'
UA_ANDROID="Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36"
color_print() {
Font_Black="\033[30m"
Font_Red="\033[31m"
Font_Green="\033[32m"
Font_Yellow="\033[33m"
Font_Blue="\033[34m"
Font_Purple="\033[35m"
Font_SkyBlue="\033[36m"
Font_White="\033[37m"
Font_Suffix="\033[0m"
}
command_exists() {
command -v "$1" > /dev/null 2>&1
}
gen_uuid() {
if [ -f /proc/sys/kernel/random/uuid ]; then
local genuuid=$(cat /proc/sys/kernel/random/uuid)
echo "${genuuid}"
return 0
fi
if command_exists uuidgen; then
local genuuid=$(uuidgen)
echo "${genuuid}"
return 0
fi
if command_exists powershell && [ "$OS_WINDOWS" == 1 ]; then
local genuuid=$(powershell -c "[guid]::NewGuid().ToString()")
echo "${genuuid}"
return 0
fi
return 1
}
gen_random_str() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Length missing.${Font_Suffix}"
exit 1
fi
local randomstr=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c "$1")
echo "${randomstr}"
}
resolve_ip_address() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Domain missing.${Font_Suffix}"
exit 1
fi
if [ -z "$2" ]; then
echo -e "${Font_Red}DNS Record type missing.${Font_Suffix}"
exit 1
fi
local domain="$1"
local recordType="$2"
if command_exists nslookup && [ "$OS_WINDOWS" != 1 ]; then
local nslookupExists=1
fi
if command_exists dig; then
local digExists=1
fi
if [ "$OS_IOS" == 1 ]; then
local nslookupExists=0
local digExists=0
fi
if [ "$nslookupExists" == 1 ]; then
if [ "$recordType" == 'AAAA' ]; then
local result=$(nslookup -q=AAAA "${domain}" | grep -woP "Address: \K[\d:a-f]+")
echo "${result}"
return
else
local result=$(nslookup -q=A "${domain}" | grep -woP "Address: \K[\d.]+")
echo "${result}"
return
fi
fi
if [ "$digExists" == 1 ]; then
if [ "$recordType" == 'AAAA' ]; then
local result=$(dig +short "${domain}" AAAA)
echo "${result}"
return
else
local result=$(dig +short "${domain}" A)
echo "${result}"
return
fi
fi
if [ "$recordType" == 'AAAA' ]; then
local pingArgs='-6 -c 1 -w 1 -W 1'
[ "$OS_ANDROID" == 1 ] && pingArgs='-c 1 -w 1 -W 1'
local result=$(ping6 ${pingArgs} "${domain}" 2>/dev/null | head -n 1 | grep -woP '\s\(\K[\d:a-f]+')
echo "${result}"
return
else
local pingArgs='-4 -c 1 -w 1 -W 1'
[ "$OS_ANDROID" == 1 ] && pingArgs='-c 1 -w 1 -W 1'
local result=$(ping ${pingArgs} "${domain}" 2>/dev/null | head -n 1 | grep -woP '\s\(\K[\d.]+')
echo "${result}"
return
fi
}
validate_proxy() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Param Proxy Address is missing.${Font_Suffix}"
exit 1
fi
local tmpresult=$(echo "$1" | grep -P '^(socks|socks4|socks5|http)://([^:]+:[^@]+@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|(\[[0-9a-fA-F:]+\]|([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|((([0-9a-fA-F]{1,4}:){1,6})|::(([0-9a-fA-F]{1,4}:){1,6}))([0-9a-fA-F]{1,4}))):(0|[1-9][0-9]{0,4})$')
if [ -z "$tmpresult" ]; then
echo -e "${Font_Red}Proxy IP invalid.${Font_Suffix}"
exit 1
fi
local port=$(echo "$1" | grep -woP ':\K[0-9]+$')
if [ "$port" -ge 65535 ]; then
echo -e "${Font_Red}Proxy Port invalid.${Font_Suffix}"
exit 1
fi
}
validate_ip_address() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Param IP Address is missing.${Font_Suffix}"
exit 1
fi
if echo "$1" | awk '{$1=$1; print}' | grep -Eq '^([0-9]{1,3}\.){3}[0-9]{1,3}$'; then
return 4
fi
echo "$1" | awk '{$1=$1; print}' | grep -Eq '^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^(([0-9a-fA-F]{1,4}:){1,7}|:):([0-9a-fA-F]{1,4}:){1,7}|:$|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}$|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}$|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}$|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}$|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}$|([0-9a-fA-F]{1,4}:){1}(:[0-9a-fA-F]{1,4}){1,6}$|:(:[0-9a-fA-F]{1,4}){1,7}$|((([0-9a-fA-F]{1,4}:){1,4}:|:):(([0-9a-fA-F]{1,4}:){0,1}[0-9a-fA-F]{1,4}){1,4})$'
if [ "$?" == 0 ]; then
return 6
fi
return 1
}
validate_intranet() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Param missing.${Font_Suffix}"
fi
# See https://en.wikipedia.org/wiki/Reserved_IP_addresses
local tmpresult=$(echo "$1" | grep -E '(^|\s)(10\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|172\.(1[6-9]|2[0-9]|3[01])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|192\.168\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|100\.([6-9][4-9]|1[0-2][0-7])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|169\.254\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|192\.88\.99\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|192\.0\.(0|2)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|198\.(1[89])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|198\.51\.100\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|203\.0\.113\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|2[23][4-9]\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|233\.252\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])|(24[0-9]|25[0-5])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))(\s|$)')
if [ -z "$tmpresult" ]; then
return 1
fi
return 0
}
validate_region_id() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Param missing.${Font_Suffix}"
exit 1
fi
local regionid="$1"
local result=$(echo "$regionid" | grep -E '^[0-9]$|^1[0-1]$|^99$|^66$')
if [ -z "$result" ]; then
return 1
fi
return 0
}
validate_net_type() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Param missing.${Font_Suffix}"
exit 1
fi
local netType="$1"
local result=$(echo "$netType" | grep -E '^4$|^6$|^0$')
if [ -z "$result" ]; then
echo -e "${Font_Red}Invalid Network Type.${Font_Suffix}"
exit 1
fi
return 0
}
check_proxy_connectivity() {
local result1=$(curl $USE_NIC $USE_PROXY -s 'https://ip.sb' --user-agent "${UA_BROWSER}" )
local result2=$(curl $USE_NIC $USE_PROXY -s 'https://1.0.0.1/cdn-cgi/trace' --user-agent "${UA_BROWSER}")
if [ -n "$result1" ] && [ -n "$result2" ]; then
return 0
fi
return 1
}
check_net_connctivity() {
if [ -z "$1" ]; then
echo -e "${Font_Red}Param missing.${Font_Suffix}"
exit 1
fi
if [ "$1" == 4 ]; then
local result1=$(curl -4 ${CURL_OPTS} -fs 'http://www.msftconnecttest.com/connecttest.txt' -w '%{http_code}' -o /dev/null --user-agent "${UA_BROWSER}")
if [ "$result1" == '200' ]; then
return 0
fi
fi
if [ "$1" == 6 ]; then
local result2=$(curl -6 ${CURL_OPTS} -fs 'http://ipv6.msftconnecttest.com/connecttest.txt' -w '%{http_code}' -o /dev/null --user-agent "${UA_BROWSER}")
if [ "$result2" == '200' ]; then
return 0
fi
fi
return 1
}
check_os_type() {
OS_TYPE=''
local ifLinux=$(uname -a | grep -i 'linux')
local ifFreeBSD=$(uname -a | grep -i 'freebsd')
local ifTermux=$(echo "$PWD" | grep -i 'termux')
local ifMacOS=$(uname -a | grep -i 'Darwin')
local ifMinGW=$(uname -a | grep -i 'MINGW')
local ifCygwin=$(uname -a | grep -i 'CYGWIN')
local ifAndroid=$(uname -a | grep -i 'android')
local ifiSh=$(uname -a | grep -i '\-ish')
if [ -n "$ifLinux" ] && [ -z "$ifAndroid" ] && [ -z "$ifiSh" ]; then
OS_TYPE='linux'
OS_LINUX=1
return
fi
if [ -n "$ifTermux" ]; then
OS_TYPE='termux'
OS_TERMUX=1
OS_ANDROID=1
return
fi
if [ -n "$ifMacOS" ]; then
OS_TYPE='macos'
OS_MACOS=1
return
fi
if [ -n "$ifMinGW" ]; then
OS_TYPE='msys'
OS_WINDOWS=1
return
fi
if [ -n "$ifCygwin" ]; then
OS_TYPE='cygwin'
OS_WINDOWS=1
return
fi
if [ -n "$ifFreeBSD" ]; then
OS_TYPE='freebsd'
OS_FREEBSD=1
return
fi
if [ -n "$ifAndroid" ]; then
OS_TYPE='android'
OS_ANDROID=1
return
fi
if [ -n "$ifiSh" ]; then
OS_TYPE='ish'
OS_IOS=1
return
fi
echo -e "${Font_Red}Unsupported OS Type.${Font_Suffix}"
exit 1
}
check_dependencies() {
CURL_SSL_CIPHERS_OPT=''
if [ "$OS_TYPE" == 'linux' ]; then
source /etc/os-release
if [ -z "$ID" ]; then
echo -e "${Font_Red}Unsupported Linux OS Type.${Font_Suffix}"
exit 1
fi
case "$ID" in
debian|devuan|kali)
OS_NAME='debian'
PKGMGR='apt'
;;
ubuntu)
OS_NAME='ubuntu'
PKGMGR='apt'
;;
centos|fedora|rhel|almalinux|rocky|amzn)
OS_NAME='rhel'
PKGMGR='dnf'
;;
arch|archarm)
OS_NAME='arch'
PKGMGR='pacman'
;;
alpine)
OS_NAME='alpine'
PKGMGR='apk'
;;
*)
OS_NAME="$ID"
PKGMGR='apt'
;;
esac
fi
if [ -z $(echo 'e' | grep -P 'e' 2>/dev/null) ]; then
echo -e "${Font_Red}command 'grep' function is incomplete, please install the full version first.${Font_Suffix}"
exit 1
fi
if ! command_exists curl; then
echo -e "${Font_Red}command 'curl' is missing, please install it first.${Font_Suffix}"
exit 1
fi
if ! gen_uuid >/dev/null; then
echo -e "${Font_Red}command 'uuidgen' is missing, please install it first.${Font_Suffix}"
exit 1
fi
if ! command_exists openssl; then
echo -e "${Font_Red}command 'openssl' is missing, please install it first.${Font_Suffix}"
exit 1
fi
if [ "$OS_MACOS" == 1 ]; then
if ! command_exists md5sum; then
echo -e "${Font_Red}command 'md5sum' is missing, please install it first.${Font_Suffix}"
exit 1
fi
if ! command_exists sha256sum; then
echo -e "${Font_Red}command 'sha256sum' is missing, please install it first.${Font_Suffix}"
exit 1
fi
fi
if [ "$OS_NAME" == 'debian' ] || [ "$OS_NAME" == 'ubuntu' ]; then
local os_version=$(echo "$VERSION_ID" | tr -d '.')
if [ "$os_version" == "2004" ] || [ "$os_version" == "10" ] || [ "$os_version" == "11" ]; then
CURL_SSL_CIPHERS_OPT='-k --ciphers DEFAULT@SECLEVEL=1'
fi
fi
if command_exists usleep; then
USE_USLEEP=1
fi
}
process() {
local iface=''
local xip=''
local proxy=''
USE_NIC=''
NETWORK_TYPE=''
LANGUAGE=''
X_FORWARD=''
USE_PROXY=''
while [ $# -gt 0 ]; do
case "$1" in
-I | --interface)
local iface="$2"
USE_NIC="--interface $2"
shift
;;
-M | --network-type)
local netType="$2"
shift
;;
-E | --language)
LANGUAGE="$2"
shift
;;
-X | --x-forwarded-for)
local xip="$2"
shift
;;
-P | --proxy)
local proxy="$2"
shift
;;
-R | --region)
local regionid="$2"
shift
;;
*)
echo -e "${Font_Red}Unknown error while processing options.${Font_Suffix}"
exit 1
;;
esac
shift
done
if [ -z "$iface" ]; then
USE_NIC=''
fi
if [ -z "$xip" ]; then
X_FORWARD=''
fi
if [ -n "$xip" ]; then
local xip=$(echo "$xip" | awk '{$1=$1; print}')
validate_ip_address "$xip"
local result="$?"
if [ "$result" == 4 ] || [ "$result" == 6 ]; then
X_FORWARD="--header X-Forwarded-For:$xip"
fi
fi
if [ -z "$proxy" ]; then
USE_PROXY=''
fi
if [ -n "$proxy" ]; then
local proxy=$(echo "$proxy" | awk '{$1=$1; print}')
if validate_proxy "$proxy"; then
USE_PROXY="-x $proxy"
fi
fi
if [ -z "$netType" ]; then
NETWORK_TYPE=''
fi
if [ -n "$netType" ]; then
local netType=$(echo "$netType" | awk '{$1=$1; print}')
if validate_net_type "$netType"; then
NETWORK_TYPE="$netType"
fi
fi
if [ -z "$LANGUAGE" ]; then
LANGUAGE='zh'
fi
if [ -n "$regionid" ]; then
if validate_region_id "$regionid"; then
REGION_ID="$regionid"
fi
fi
CURL_OPTS="$USE_NIC $USE_PROXY $X_FORWARD ${CURL_SSL_CIPHERS_OPT} --max-time 10 --retry 3 --retry-max-time 20"
}
delay() {
if [ -z $1 ]; then
exit 1
fi
local val=$1
if [ "$USE_USLEEP" == 1 ]; then
usleep $(awk 'BEGIN{print '$val' * 1000000}')
return 0
fi
sleep $val
return 0
}
count_run_times() {
local tmpresult=$(curl ${CURL_OPTS} -s "https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fcheck.unclock.media&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=visit&edge_flat=false")
TODAY_RUN_TIMES=$(echo "$tmpresult" | tail -3 | head -n 1 | awk '{print $5}')
TOTAL_RUN_TIMES=$(($(echo "$tmpresult" | tail -3 | head -n 1 | awk '{print $7}') + 2527395))
}
download_extra_data() {
MEDIA_COOKIE=$(curl ${CURL_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/cookies")
IATACODE=$(curl ${CURL_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/reference/IATACode.txt")
IATACODE2=$(curl ${CURL_OPTS} -s "https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/reference/IATACode2.txt")
if [ -z "$MEDIA_COOKIE" ] || [ -z "$IATACODE" ] || [ -z "$IATACODE2" ]; then
echo -e "${Font_Red}Extra data download failed.${Font_Suffix}"
delay 3
fi
}
get_ip_info() {
LOCAL_IP_ASTERISK=''
LOCAL_ISP=''
local local_ip=$(curl ${CURL_DEFAULT_OPTS} -s https://api64.ipify.org --user-agent "${UA_BROWSER}")
local get_local_isp=$(curl ${CURL_DEFAULT_OPTS} -s "https://api.ip.sb/geoip/${local_ip}" -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' --user-agent "${UA_BROWSER}")
if [ -z "$local_ip" ]; then
echo -e "${Font_Red}Failed to Query IP Address.${Font_Suffix}"
fi
if [ -z "$get_local_isp" ]; then
echo -e "${Font_Red}Failed to Query IP Info.${Font_Suffix}"
fi
validate_ip_address "$local_ip"
local resp="$?"
if [ "$resp" == 4 ]; then
LOCAL_IP_ASTERISK=$(awk -F"." '{print $1"."$2".*.*"}' <<<"${local_ip}")
fi
if [ "$resp" == 6 ]; then
LOCAL_IP_ASTERISK=$(awk -F":" '{print $1":"$2":"$3":*:*"}' <<<"${local_ip}")
fi
LOCAL_ISP=$(echo "$get_local_isp" | grep 'organization' | cut -f4 -d '"')
}
show_region() {
echo -e "${Font_Yellow} ---${1}---${Font_Suffix}"
}
function GameTest_Steam() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Steam Currency:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://store.steampowered.com/app/761830' --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Steam Currency:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep 'priceCurrency' | cut -d '"' -f4)
if [ -z "$result" ]; then
echo -n -e "\r Steam Currency:\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n"
return
fi
echo -n -e "\r Steam Currency:\t\t\t${Font_Green}${result}${Font_Suffix}\n"
}
# 流媒体解锁测试-动画疯
function MediaUnlockTest_BahamutAnime() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://ani.gamer.com.tw/ajax/getdeviceid.php' --cookie-jar bahamut_cookie.txt --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
rm -f bahamut_cookie.txt
return
fi
local tempdeviceid=$(echo "$tmpresult" | grep -woP '"deviceid"\s{0,}:\s{0,}"\K[^"]+')
# I Was Reincarnated as the 7th Prince
local sn='37783'
local tmpresult1=$(curl ${CURL_DEFAULT_OPTS} -sL "https://ani.gamer.com.tw/ajax/token.php?adID=89422&sn=${sn}&device=${tempdeviceid}" -b bahamut_cookie.txt --user-agent "${UA_BROWSER}")
local tmpresult2=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://ani.gamer.com.tw/' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: zh-CN,zh;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-model: ""' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-ch-ua-platform-version: "15.0.0"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -b bahamut_cookie.txt --user-agent "${UA_BROWSER}")
rm -f bahamut_cookie.txt
if [ -z "$tmpresult1" ] || [ -z "$tmpresult2" ]; then
echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}Failed (Network Connection 1)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult1" | grep 'animeSn')
if [ -z "$result" ]; then
echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
local region=$(echo "$tmpresult2" | grep -woP 'data-geo="\K[^"]+')
if [ -n "$region" ]; then
echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n"
return
fi
echo -n -e "\r Bahamut Anime:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n"
}
# 流媒体解锁测试-哔哩哔哩大陆限定
function MediaUnlockTest_BilibiliChinaMainland() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local randsession=$(gen_uuid | md5sum | head -c 32)
# 尝试获取成功的结果
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL "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" --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1)
case "$result" in
'0') echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'-10403') echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r BiliBili China Mainland Only:\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
# 流媒体解锁测试-哔哩哔哩港澳台限定
function MediaUnlockTest_BilibiliHKMCTW() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local randsession=$(gen_uuid | md5sum | head -c 32)
# 尝试获取成功的结果
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL "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" --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1)
case "$result" in
'0') echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Green}Yes${Font_Suffix}\n" ;;
'-10403') echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r BiliBili Hongkong/Macau/Taiwan:\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
# 流媒体解锁测试-哔哩哔哩台湾限定
function MediaUnlockTest_BilibiliTW() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local randsession=$(gen_uuid | md5sum | head -c 32)
# 尝试获取成功的结果
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL "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" --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep -woP '"code"\s{0,}:\s{0,}\K[-\d]+' | head -n 1)
case "$result" in
'0') echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'-10403') echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r Bilibili Taiwan Only:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function MediaUnlockTest_AbemaTV() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Abema.TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://api.abema.io/v1/ip/check?device=android' --user-agent "${UA_ANDROID}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Abema.TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local region=$(echo "$tmpresult" | grep -woP '"isoCountryCode"\s{0,}:\s{0,}"\K[^"]+')
if [ -z "$region" ]; then
echo -n -e "\r Abema.TV:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
if [ "$region" == 'JP' ]; then
echo -n -e "\r Abema.TV:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n"
else
echo -n -e "\r Abema.TV:\t\t\t\t${Font_Yellow}Oversea Only (Region: ${region})${Font_Suffix}\n"
fi
}
function GameTest_PCRJP() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api-priconne-redive.cygames.jp/' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}")
case "$result" in
'000') echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;;
'404') echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Green}Yes${Font_Suffix}\n" ;;
'403') echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r Princess Connect Re:Dive Japan:\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function GameTest_UMAJP() {
local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api-umamusume.cygames.jp/' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}")
case "$result" in
'000') echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;;
'404') echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'403') echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r Pretty Derby Japan:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function GameTest_Kancolle() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'http://203.104.209.7/kcscontents/twitter/maintenance_info.html' -w %{http_code} -o /dev/null --user-agent "${UA_ANDROID}")
# curl 'http://203.104.209.7/kcscontents/twitter/maintenance_info.html' \
# -H 'Accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
# -H 'Accept-Language: en-US,en;q=0.9' \
# -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' \
# --insecure
case "$result" in
'000') echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;;
'200') echo -n -e "\r Kancolle Japan:\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'403') echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r Kancolle Japan:\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function MediaUnlockTest_Lemino() {
local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://if.lemino.docomo.ne.jp/v1/user/delivery/watch/ready' -w %{http_code} -o /dev/null -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.9' -H 'content-type: application/json' -H 'origin: https://lemino.docomo.ne.jp' -H 'referer: https://lemino.docomo.ne.jp/' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'x-service-token: f365771afd91452fa279863f240c233d' -H 'x-trace-id: 556db33f-d739-4a82-84df-dd509a8aa179' --data-raw '{"inflow_flows":[null,"crid://plala.iptvf.jp/group/b100ce3"],"play_type":1,"key_download_only":null,"quality":null,"groupcast":null,"avail_status":"1","terminal_type":3,"test_account":0,"content_list":[{"kind":"main","service_id":null,"cid":"00lm78dz30","lid":"a0lsa6kum1","crid":"crid://plala.iptvf.jp/vod/0000000000_00lm78dymn","preview":0,"trailer":0,"auto_play":0,"stop_position":0}]}' --user-agent "${UA_BROWSER}")
case "$result" in
'000') echo -n -e "\r Lemino:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;;
'200') echo -n -e "\r Lemino:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'403') echo -n -e "\r Lemino:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r Lemino:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
MediaUnlockTest_AnimeFesta() {
local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://api-animefesta.iowl.jp/v1/titles/1305' -w %{http_code} -o /dev/null -H 'Origin: https://animefesta.iowl.jp' -H 'Priority: u=1, i' -H 'Referer: https://animefesta.iowl.jp/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H 'X-Requested-With: XMLHttpRequest' --user-agent "${UA_BROWSER}")
case "$result" in
'000') echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;;
'200') echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'403') echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r AnimeFesta:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function MediaUnlockTest_mora() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local result=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://mora.jp/buy?__requestToken=1713764407153&returnUrl=https%3A%2F%2Fmora.jp%2Fpackage%2F43000087%2FTFDS01006B00Z%2F%3Ffmid%3DTOPRNKS%26trackMaterialNo%3D31168909&fromMoraUx=false&deleteMaterial=' -w %{http_code} -o /dev/null -H 'host: mora.jp' --user-agent "${UA_BROWSER}")
case "$result" in
'000') echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n" ;;
'200') echo -n -e "\r Mora:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
'403') echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
'500') echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
*) echo -n -e "\r Mora:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function MediaUnlockTest_BBCiPLAYER() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://open.live.bbc.co.uk/mediaselector/6/select/version/2.0/mediaset/pc/vpid/bbc_one_london/format/json/jsfunc/JS_callbacks0' --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local isBlocked=$(echo "$tmpresult" | grep -i 'geolocation')
local isOK=$(echo "$tmpresult" | grep -i 'vs-hls-push-uk')
if [ -z "$isBlocked" ] && [ -z "$isOK" ]; then
echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n"
return
fi
if [ -n "$isBlocked" ]; then
echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
if [ -n "$isOK" ]; then
echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n"
return
fi
echo -n -e "\r BBC iPLAYER:\t\t\t\t${Font_Red}Failed (Error: Unknown)${Font_Suffix}\n"
}
function MediaUnlockTest_Netflix() {
# LEGO Ninjago
local result1=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.netflix.com/title/81280792' -w %{http_code} -o /dev/null -H 'host: www.netflix.com' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' --user-agent "${UA_BROWSER}")
# Breaking bad
local result2=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://www.netflix.com/title/70143836' -w %{http_code} -o /dev/null -H 'host: www.netflix.com' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' --user-agent "${UA_BROWSER}")
if [ "${result1}" == '000' ] || [ "$result2" == '000' ]; then
echo -n -e "\r Netflix:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
if [ "$result1" == '404' ] && [ "$result2" == '404' ]; then
echo -n -e "\r Netflix:\t\t\t\t${Font_Yellow}Originals Only${Font_Suffix}\n"
return
fi
if [ "$result1" == '403' ] || [ "$result2" == '403' ]; then
echo -n -e "\r Netflix:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
if [ "$result1" == '200' ] || [ "$result2" == '200' ]; then
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://www.netflix.com/' -H 'accept-language: en-US,en;q=0.9' -H "sec-ch-ua: ${UA_SEC_CH_UA}" -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' --user-agent "${UA_BROWSER}")
local region=$(echo "$tmpresult" | grep -woP '"requestCountry":{"id":"\K\w\w' | head -n 1)
echo -n -e "\r Netflix:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n"
return
fi
echo -n -e "\r Netflix:\t\t\t\t\t${Font_Red}Failed (Error: ${result1}_${result2})${Font_Suffix}\n"
}
function MediaUnlockTest_DisneyPlus() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tempresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://disney.api.edge.bamgrid.com/devices' -X POST -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -H "content-type: application/json; charset=UTF-8" -d '{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","attributes":{}}' --user-agent "${UA_BROWSER}")
if [ -z "$tempresult" ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local is403=$(echo "$tempresult" | grep -i '403 ERROR')
if [ -n "$is403" ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No (IP Banned By Disney+)${Font_Suffix}\n"
return
fi
local assertion=$(echo "$tempresult" | grep -woP '"assertion"\s{0,}:\s{0,}"\K[^"]+')
if [ -z "$assertion" ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}Failed (Error: PAGE ERROR)${Font_Suffix}\n"
return
fi
local preDisneyCookie=$(echo "$MEDIA_COOKIE" | sed -n '1p')
local disneyCookie=$(echo "$preDisneyCookie" | sed "s/DISNEYASSERTION/${assertion}/g")
local tokenContent=$(curl ${CURL_DEFAULT_OPTS} -s 'https://disney.api.edge.bamgrid.com/token' -X POST -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "${disneyCookie}" --user-agent "${UA_BROWSER}")
local isBlocked=$(echo "$tokenContent" | grep -i 'forbidden-location')
local is403=$(echo "$tokenContent" | grep -i '403 ERROR')
if [ -n "$isBlocked" ] || [ -n "$is403" ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No (IP Banned By Disney+ 1)${Font_Suffix}\n"
return
fi
local fakeContent=$(echo "$MEDIA_COOKIE" | sed -n '8p')
local refreshToken=$(echo "$tokenContent" | grep -woP '"refresh_token"\s{0,}:\s{0,}"\K[^"]+')
local disneyContent=$(echo "$fakeContent" | sed "s/ILOVEDISNEY/${refreshToken}/g")
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://disney.api.edge.bamgrid.com/graph/v1/device/graphql' -X POST -H "authorization: ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -d "${disneyContent}" --user-agent "${UA_BROWSER}")
local previewcheck=$(curl ${CURL_DEFAULT_OPTS} -sL 'https://disneyplus.com' -w '%{url_effective}\n' -o /dev/null --user-agent "${UA_BROWSER}")
local isUnavailable=$(echo "$previewcheck" | grep -E 'preview|unavailable')
local region=$(echo "$tmpresult" | grep -woP '"countryCode"\s{0,}:\s{0,}"\K[^"]+')
local inSupportedLocation=$(echo "$tmpresult" | grep -woP '"inSupportedLocation"\s{0,}:\s{0,}\K(false|true)')
if [ -z "$region" ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
if [ "$region" == 'JP' ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Green}Yes (Region: JP)${Font_Suffix}\n"
return
fi
if [ -n "$isUnavailable" ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
if [ "$inSupportedLocation" == 'false' ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Yellow}Available For [Disney+ ${region}] Soon${Font_Suffix}\n"
return
fi
if [ "$inSupportedLocation" == 'true' ]; then
echo -n -e "\r Disney+:\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n"
return
fi
echo -n -e "\r Disney+:\t\t\t\t${Font_Red}Failed (Error: ${inSupportedLocation}_${region})${Font_Suffix}\n"
}
function MediaUnlockTest_Dazn() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://startup.core.indazn.com/misl/v5/Startup' -X POST -H "Content-Type: application/json" -d '{"LandingPageKey":"generic","languages":"en-US,en","Platform":"web","PlatformAttributes":{},"Manufacturer":"","PromoCode":"","Version":"2"}' --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep -woP '"isAllowed"\s{0,}:\s{0,}\K(false|true)')
local region=$(echo "$tmpresult" | grep -woP '"GeolocatedCountry"\s{0,}:\s{0,}"\K[^"]+' | tr a-z A-Z)
case "$result" in
'false') echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
'true') echo -n -e "\r Dazn:\t\t\t\t\t${Font_Green}Yes (Region: ${region})${Font_Suffix}\n" ;;
*) echo -n -e "\r Dazn:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function MediaUnlockTest_HuluJP() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -fsL 'https://id.hulu.jp/' -w '%{http_code}_TAG_%{url_effective}\n' -o /dev/null -H 'Accept: */*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: none' -H 'Sec-GPC: 1' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: document' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: none' -H 'Sec-Fetch-User: ?1' -H 'Priority: u=1' --user-agent "${UA_BROWSER}")
local httpCode=$(echo "$tmpresult" | awk -F'_TAG_' '{print $1}')
if [ "$httpCode" == '000' ]; then
echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local urlEffective=$(echo "$tmpresult" | awk -F'_TAG_' '{print $2}')
local isBlocked=$(echo "$urlEffective" | grep 'restrict')
if [ -n "$isBlocked" ]; then
echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
if [ "$httpCode" == '200' ]; then
echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n"
return
fi
if [ "$httpCode" == '403' ]; then
echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
echo -n -e "\r Hulu Japan:\t\t\t\t${Font_Red}Failed (Error: ${httpCode})${Font_Suffix}\n"
}
function MediaUnlockTest_MyTVSuper() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://www.mytvsuper.com/api/auth/getSession/self/' --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep -woP '"country_code"\s{0,}:\s{0,}"\K[^"]+')
if [ "$result" == 'HK' ]; then
echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Green}Yes${Font_Suffix}\n"
return
else
echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}No${Font_Suffix}\n"
return
fi
echo -n -e "\r MyTVSuper:\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n"
}
function MediaUnlockTest_NowE() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://webtvapi.nowe.com/16/1/getVodURL' -X POST -H "Content-Type: application/json" -d '{"contentId":"202403181904703","contentType":"Vod","pin":"","deviceName":"Browser","deviceId":"w-663bcc51-913c-913c-913c-913c913c","deviceType":"WEB","secureCookie":null,"callerReferenceNo":"W17151951620081575","profileId":null,"mupId":null}' --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi
local result=$(echo "$tmpresult" | grep -woP '"responseCode"\s{0,}:\s{0,}"\K[^"]+')
case "$result" in
'GEO_CHECK_FAIL') echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}No${Font_Suffix}\n" ;;
'SUCCESS') echo -n -e "\r Now E:\t\t\t\t\t${Font_Green}Yes${Font_Suffix}\n" ;;
*) echo -n -e "\r Now E:\t\t\t\t\t${Font_Red}Failed (Error: ${result})${Font_Suffix}\n" ;;
esac
}
function MediaUnlockTest_ViuTV() {
if [ "${USE_IPV6}" == 1 ]; then
echo -n -e "\r Viu.TV:\t\t\t\t${Font_Red}IPv6 Is Not Currently Supported${Font_Suffix}\n"
return
fi
local tmpresult=$(curl ${CURL_DEFAULT_OPTS} -s 'https://api.viu.now.com/p8/3/getLiveURL' -X POST -H "Content-Type: application/json" -d '{"callerReferenceNo":"20210726112323","contentId":"099","contentType":"Channel","channelno":"099","mode":"prod","deviceId":"29b3cb117a635d5b56","deviceType":"ANDROID_WEB"}' --user-agent "${UA_BROWSER}")
if [ -z "$tmpresult" ]; then
echo -n -e "\r Viu.TV:\t\t\t\t${Font_Red}Failed (Network Connection)${Font_Suffix}\n"
return
fi