0
0
Fork 0
mirror of https://github.com/Screetsec/TheFatRat.git synced 2023-12-14 02:02:58 +01:00

Internet detection

A Different approach to check  internet
This commit is contained in:
peterpt 2017-11-24 09:34:52 +00:00 committed by GitHub
parent 995c8a907d
commit c9300e9619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

43
fatrat
View file

@ -1435,25 +1435,36 @@ echo -e $okegreen [✔]::[Terminal]: local ;
fi
sleep 0.5
#Checking internet connection by pinging hostname (google)
#case ping hostname fails then run chknet function
ping -c 1 google.com > /dev/null 2>&1
png="$?"
if [ $png == "0" ]
then
echo -e $okegreen [✔]::[Internet Connection]: CONNECTED!;
sleep 0.5
cont
elif [ $png == "1" ]
then
echo -e $yellow [✔]::[Internet Connection]: LOCAL ONLY!;
chknet
elif [ $png == "2" ]
then
echo -e $red [✔]::[Internet Connection]: OFFLINE!;
#Checking internet connection by connecting to google over http
#case fails then run chknet function (ping)
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e $red [ X ]::[Internet Connection]: OFFLINE!;
chknet
sleep 1
else
echo -e $green [ ✔ ]::[Internet Connection]: CONNECTED!;
sleep 1
cont
fi
#ping -c 1 google.com > /dev/null 2>&1
#png="$?"
# if [ $png == "0" ]
#then
# echo -e $okegreen [✔]::[Internet Connection]: CONNECTED!;
# sleep 0.5
# cont
#elif [ $png == "1" ]
#then
# echo -e $yellow [✔]::[Internet Connection]: LOCAL ONLY!;
# chknet
#elif [ $png == "2" ]
#then
#echo -e $red [✔]::[Internet Connection]: OFFLINE!;
#chknet
#fi
function Stop() {
#Stoped Service postgresql & apache
if [ "$distro" = "Kali" ]; then