-
Notifications
You must be signed in to change notification settings - Fork 0
/
evilip.sh
96 lines (80 loc) · 2.36 KB
/
evilip.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# EvilNet DNSBL Search 1.1 (Beta) [EvilIP]
# Check IP is Listed in EvilNET
# Request Removal IP: https://dnsbl.evilnet.org/request-removal
# Search for IP: https://dnsbl.evilnet.org/ip-search
# FAQ: https://dnsbl.evilnet.org/faq
# Created by: y2k
#COLORS
RED="\e[31m"
GREEN="\e[92m"
YELLOW="\e[93m"
WHITE="\e[97m"
NORMAL="\e[39m"
#EvilNET DNSBL URL
DNSBL="rbl.evilnet.org"
#Read IP address
ERROR()
{
echo "$0" ERROR: "$1" >&2
exit 2
}
echo "${RED}"
[ $# -ne 1 ] && ERROR "Please specify a single IP address!"
echo "${WHITE}";
reverse=$(echo "$1" |
sed -ne "s~^\([0-9]\{1,3\}\)\.\([0-9]\{1,3\}\)\.\([0-9]\{1,3\}\)\.\([0-9]\{1,3\}\)$~\4.\3.\2.\1~p")
if [ "x${reverse}" = "x" ] ; then
echo "${RED}";
ERROR " '$1' This is NOT a valid IP address"
echo -e "${WHITE}";
exit 1
fi
HostToIP()
{
if ( echo "$host" | grep -q "[a-zA-Z]" ); then
IP=$(host "$host" | awk '/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {print$NF}')
else
IP="$host"
fi
}
Repeat()
{
printf "%${2}s\n" | sed "s/ /${1}/g"
}
#Reverse HOST from IP
REVERSE_DNS=$(dig +short -x "$1")
Reverse()
{
echo "$1" | awk -F. '{print$4"."$3"."$2"."$1}'
}
#Check if the IP is listed or not in EvilNet DNSBL
Check()
{
result=$(dig +short -t a "$rIP"."$BL")
if [ -n "$result" ]; then
echo "${RED} IS LISTED :("
echo "${NORMAL}" "$BL" "${RED}" "(answer = $result)""${NORMAL}"
grep "$result" rbl.txt
echo "${RED} More info about your IP:" "${NORMAL} https://dnsbl.evilnet.org/your?ipaddress=""$IP"
echo "${RED} Request Removal:" "${NORMAL} https://dnsbl.evilnet.org/request-removal"
else
echo "${GREEN} NOT LISTED :) \t ${NORMAL}" "$BL"
fi
}
if [ -n "$1" ]; then
hosts=$*
fi
if [ -z "$hosts" ]; then
hosts=$(netstat -tn | awk '$4 ~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ && $4 !~ /127.0.0/ {gsub(/:[0-9]+/,"",$4);} END{print$4}')
fi
for host in $hosts; do
HostToIP
rIP=$(Reverse "$IP")
echo; Repeat - 100
echo "${YELLOW}" "Your" IP "Address is:" "${NORMAL}" "$IP" "${YELLOW}" "\t Your" HOST "is:" "${NORMAL}" "${REVERSE_DNS}" "${NORMAL}"
Repeat - 100
for BL in $DNSBL; do
Check
done
done