Created
July 21, 2024 16:00
-
-
Save MParvin/8be83fb0cc5fae92d035ef78a6b95c9c to your computer and use it in GitHub Desktop.
Check shecan pro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Checking resolv.conf" | |
python3 -c ' | |
import subprocess | |
shecan_ips = ("178.22.122.101" "185.51.200.1") | |
resolver_list = [] | |
with open("/etc/resolv.conf", "r") as f: | |
for line in f.readlines(): | |
if line.startswith("nameserver"): | |
resolver_list.append(line.split()[1]) | |
for ip in resolver_list: | |
if not ip in shecan_ips: | |
print("Error: Resolver is not in Shecan IPs") | |
exit(1) | |
' | |
echo "resolv.conf is OK" | |
echo "---------------------------------------" | |
echo "Checking shecan.ir with dig command" | |
dig check.shecan.ir > /dev/null || (echo "shecan doesn't work" && exit 1) | |
echo "dig check.shecan.ir is OK" | |
echo "---------------------------------------" | |
echo "Checking fail.shecan.ir with dig command" | |
echo "This step of check will take a few seconds, please wait..." | |
dig fail.shecan.ir > /dev/null && (echo "shecan works" && exit 1) | |
echo "dig fail.shecan.ir is OK" | |
echo "---------------------------------------" | |
echo "Checking diff between ifconfig.me and ip9.ir" | |
diff <(curl -SsLo- https://ifconfig.me) <(curl -SsLo- ip9.ir) > /dev/null && (echo "ifconfig.me and ip9.ir are not the same" && exit 1) | |
echo "Shecan works on ifconfig.me" | |
echo "---------------------------------------" | |
echo "Showing your IP address" | |
echo "Your IP in IP9.ir is: $(curl -SsLo- ip9.ir)" | |
echo "Your IP in shecan.ir is: $(curl -SsLo- https://shecan.ir/ip)" | |
echo "Your IP in icanhazip.com is: $(curl -SsLo- https://icanhazip.com)" | |
echo "Your IP in ifconfig.me is: $(curl -SsLo- https://ifconfig.me)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment