-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebsite_Status_Checker.sh
More file actions
67 lines (65 loc) · 1.7 KB
/
Website_Status_Checker.sh
File metadata and controls
67 lines (65 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
pyfiglet --color blue "WEB-STATUS"
sleep 0.6
check_status() {
url=$1
# Send an HTTP request and extract only the status code
status_code=$(curl -o /dev/null -s -w "%{http_code}" "$url")
# Interpret the status code
case $status_code in
200)
echo "$url is UP"
;;
301|302)
echo "$url is UP (Redirected)"
;;
403)
echo "$url is DOWN (Forbidden: Access is denied)"
;;
404)
echo "$url is DOWN (Not Found: The URL does not exist)"
;;
500)
echo "$url is DOWN (Internal Server Error: Server encountered an error)"
;;
503)
echo "$url is DOWN (Service Unavailable: Server is temporarily down)"
;;
*)
echo "$url is DOWN (HTTP Status: $status_code - Unknown Issue)"
;;
esac
}
echo -e "[*] select the option\n1)single website-check\n2)bulk website-check"
echo "You Have Entered"
read option
case $option in
1)
echo "[*] ENTER URL OF THE WEBSITE"
read webone
check_status "$webone"
;;
2)
echo " "
echo "[*] please make sure the websites url in your file is in the form of line by line"
sleep 0.5
echo "[*]ENTER FILE-LOCATION"
read location
if [ -f "$location" ];
then
while IFS= read -r url;
do
check_status "$url"
done < "$location"
else
echo "[#] File not found.please check the file path and try again."
fi
;;
*)
echo " "
echo "[#] invalid"
echo "[#] please read the instructions from read-me"
sleep 0.2
echo "[#]quiting"
exit 1
esac