Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
Create openai.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
missuo authored Feb 9, 2023
1 parent ecc8c6a commit 5264c26
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions openai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
PLAIN='\033[0m'

SUPPORT_COUNTRY=(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 )
echo "OpenAI Access Checker v0.0.1"
echo
if [[ $(curl -sS https://chat.openai.com/ -I | grep "text/plain") != "" ]]
then
echo "IP is Block"
else
iso2_code=$(curl -sS https://chat.openai.com/cdn-cgi/trace | grep "loc=" | awk -F= '{print $2}')
if [[ "${SUPPORT_COUNTRY[@]}" =~ "${iso2_code}" ]];
then
echo -e "${GREEN}Your IP supports access to OpenAI.${PLAIN} Region: ${iso2_code}"
else
echo -e "Region: ${iso2_code}. ${RED}Not support OpenAI at this time.${PLAIN}"
fi
fi
echo
echo "Made by Vincent."
echo "https://github.com/missuo/OpenAI-Checker"

0 comments on commit 5264c26

Please sign in to comment.