One of the least glamorous parts of network security is capturing information on Internet hosts that exhibit malicious intent. Here is a script that I’ve created to help automate the process of collecting WHOIS information:
#!/usr/bin/sh # # downloadWHOIS.sh # # This script uses native whois command to return the WHOIS information # of the IP Addresses provided. # # USAGE: # $ ./downloadWHOIS.sh 22.214.171.124 # $ ./downloadWHOIS.sh 126.96.36.199 188.8.131.52 184.108.40.206 etc. # # Set path to save files: path=/Downloads/ # Set filename prefix and/or suffix: prefix= suffix=\_whois.txt for args in "$@" do whois $args > $path$prefix$args$suffix done
I haven’t tested this script in a true Linux environment, but it works fine in Cygwin. (Not my preferred environment, but it’s what I have to work with.)
Have any scripts you’d like to share? I’d like to see what you’ve come up to make your tedious tasks easier to tackle.
I’ve also created a GitHub Gist for this shell script.