-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkingirak.sh
executable file
·74 lines (58 loc) · 1.26 KB
/
kingirak.sh
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
68
69
70
71
72
73
74
#!/bin/bash
set -eo pipefail; [[ -z $TRACE ]] || set -x
usage() {
cat >&2 <<-EOF
*****************************
*****************************
*** KİNGIRAK ***
*****************************
*****************************
Hedefe ait IP blogunda 80.port üzerinden kontroller sağlar.
./tara.sh alanadı
Contact @m_altinkaynak
EOF
exit 128
}
die() {
echo >&2 "$@"
exit 1
}
bold() {
echo -e "\e[1m$1\e[0m"
}
get() {
local result
result=$(
curl --connect-timeout 1 \
--max-time 1 \
--header "Connection: keep-alive" \
-s -D - "$1" -o /dev/null |
awk 'NR==1{print $2}'
)
if [[ $result =~ ^-?[0-9]+$ ]] ;
then
echo >&2 "$(bold "$result") Sayfa bulundu."
else
echo "Sayfa bulunamadı."
fi
}
resolv() {
local addr
addr=$(host "$1" 2>/dev/null || true)
echo "$addr" | awk 'NR == 1 { print $4 }'
}
main() {
[[ $# -ne 0 ]] || usage
local domain=$1
local addr
local ip
local desc
local octets
addr=$(resolv "$domain")
IFS='.' read -r -a octets <<<"$addr"
echo >&2 "$(bold "$addr") ip adresine sahip $(bold "$domain") taranıyor."
for ip in ${octets[0]}.${octets[1]}.${octets[2]}.{0..255}; do
printf '%s %s %s\n' "$ip" "$(get "$ip")"
done
}
[[ "${BASH_SOURCE[0]}" != "$0" ]] || main "$@"