diff options
author | Aaron Ball <nullspoon@oper.io> | 2018-11-19 11:39:49 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2018-11-19 11:39:49 -0700 |
commit | 0fa06ca7a4af70bb9a92a806bfb67e7f39ae4a16 (patch) | |
tree | f5c1badbbb84feab5ab16bf238e88d9641d2f09f | |
parent | 1c9ef1f8a936d71c19ff07149e97e443923fc7fd (diff) | |
download | dnsbl-check-0fa06ca7a4af70bb9a92a806bfb67e7f39ae4a16.tar.gz dnsbl-check-0fa06ca7a4af70bb9a92a806bfb67e7f39ae4a16.tar.xz |
Add "found" counter
Now it prints "Found $ip on $found lists" just before script exits.
-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 ${@} |