diff options
-rwxr-xr-x | dnsbl-check.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dnsbl-check.sh b/dnsbl-check.sh index 9e202b6..1a7c547 100755 --- a/dnsbl-check.sh +++ b/dnsbl-check.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Script to check if specified IP is on common known dns blacklists -# Copyright (C) 2018 Aaron Ball <nullspoon@oper.io +# Copyright (C) 2018 Aaron Ball <nullspoon@oper.io> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,6 +52,7 @@ main() { local rev # IP address, reversed for dns lookup (dig) local resp # Response from dns query local dnsbls # Array of dns blacklist endpoints + local found # Number of times the ip was found in blacklists if [ -z "${ip}" ]; then printf "IP address required\n" @@ -87,6 +88,7 @@ main() { printf "Checking %s\n" "${ip}" printf "Reverse DNS: %s\n\n" "$(dig @${NS} +short -x ${ip})" + found=0 for bl in ${dnsbls[@]}; do # I can dig it resp="$(dig @${NS} +short -t a ${rev}${bl})" @@ -95,8 +97,11 @@ main() { printf "%bNot found%b\n" "${CGREEN}" "${CRESET}" else printf "%bFound%b\n" "${CRED}" "${CRESET}" + found=$((found + 1)) fi done + + printf "\nFound %s on %d lists\n" "${ip}" "${found}" } main ${@} |