#!/bin/bash
BL="0"
sed -i '/^$/d' sitelist.txt
sed -i 's/ .*$//' sitelist.txt
sed -i 's/ //g' sitelist.txt
LINE=$(wc -l < sitelist.txt)
for (( i = 1; i <= $LINE; ++i ))
do
SITE=$(sed "${i}q;d" sitelist.txt)
curl -L -m 3 $SITE -o tmpfile.txt
EXIT="$?"
grep "airtel.in/dot/" -q tmpfile.txt
EXIT1="$?"
echo
echo
echo
if [[ "$EXIT1" == "0" ]]; then
BL=$((BL + 1))
cat << _site_ >> blocked.txt
$SITE
_site_
echo "$SITE seems to be blocked"
elif [[ "$EXIT" =~ ^(5|6|7|28|35|47|52)$ ]]; then
curl -L -m 2 $SITE
EXIT="$?"
if [[ "$EXIT" =~ ^(5|6|7|28|35|47|52)$ ]]; then
BL=$((BL + 1))
cat << _site_ >> blocked.txt
$SITE
_site_
echo "$SITE seems to be blocked"
fi
else
cat << _sitefree_ >> not-blocked.txt
$SITE
_sitefree_
fi
done
echo
echo
rm tmpfile.txt
echo "$BL out of $LINE Websites found blocked, Please open blocked.txt and not-blocked.txt for respective lists"