Created
September 26, 2022 08:41
-
-
Save ocixe/8cf2a5c5bada83eeb81ff81a90a55cbc to your computer and use it in GitHub Desktop.
Check HTTP Status
This file contains 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
down_par(){ | |
while ! command -v ./parallel &> /dev/null | |
do | |
# printf "\rDownloading Parallel" | |
wget -q http://git.savannah.gnu.org/cgit/parallel.git/plain/src/parallel -O parallel | |
chmod 755 parallel | |
printf "will cite" | ./parallel --citation &> /dev/null | |
done | |
} | |
fast_search(){ | |
host=$1 | |
if [[ $host =~ http[s]? ]]; then | |
url="$host" | |
else | |
url="http://$host" | |
fi | |
temp_http_header=$(mktemp) | |
temp_http_response=$(mktemp) | |
code=$(curl -L -s $url --insecure -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.100' --connect-timeout 15 --max-time 15 --write-out '%{http_code}' --dump-header $temp_http_header -o $temp_http_response) | |
result=$(grep -E $pattern $temp_http_header $temp_http_response -oah | sort -u |paste -d, -s) | |
echo "$host - $temp_http_header\n" | |
rm -f $temp_http_header | |
rm -f $temp_http_response | |
echo "$code|$url|$result">>result.txt | |
echo "$code|$url|$result" | |
} | |
down_par | |
export -f fast_search | |
./parallel -j 0 -a hosts.txt fast_search {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment