Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -eq 0 ]; then
- echo "You must provide at least one ASN (multiple should be separated by space)."
- exit 0
- fi
- result=""
- re='^[0-9]+$' # simple regex to make sure that each ASN is a number
- for arg in "$@"; do
- if [[ $arg =~ $re ]]; then
- temp=$(whois -h whois.radb.net -- "-i origin AS${arg}" | grep -Eo "([0-9.]+){4}/[0-9]+")
- result="$result $temp"
- fi
- done
- for res in $result; do
- echo -e " deny $res;"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement