Skip to content

Instantly share code, notes, and snippets.

@mnathani
Created August 27, 2017 06:11
Show Gist options
  • Save mnathani/b118e5d197a9b377bb853d66ca73b7b1 to your computer and use it in GitHub Desktop.
Save mnathani/b118e5d197a9b377bb853d66ca73b7b1 to your computer and use it in GitHub Desktop.
Double Whois Sections
#!/usr/bin/env bash
res1=$(date +%s.%N)
FNAME=$(date +%s)
#OUTPUT="$(dig "$1")"
#WHOIS="$(whois "$1")"
dig "$1" > /tmp/investigate/$FNAME_dig.txt &
whois "$1" > /tmp/investigate/$FNAME_whois.txt &
wait
echo "<pre>"
cat /tmp/investigate/$FNAME_dig.txt
echo "</pre>"
echo "<h2>Whois Output for" $1 "</h2>"
echo "<pre>"
cat /tmp/investigate/$FNAME_whois.txt
echo "</pre>"
res2=$(date +%s.%N)
dt=$(echo "$res2 - $res1" | bc)
dd=$(echo "$dt/86400" | bc)
dt2=$(echo "$dt-86400*$dd" | bc)
dh=$(echo "$dt2/3600" | bc)
dt3=$(echo "$dt2-3600*$dh" | bc)
dm=$(echo "$dt3/60" | bc)
ds=$(echo "$dt3-60*$dm" | bc)
printf "Total runtime: %d:%02d:%02d:%02.4f\n" $dd $dh $dm $ds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment