Created
May 24, 2018 03:06
-
-
Save menzow/fbf0d1065b4fa03d68de8649bc13e582 to your computer and use it in GitHub Desktop.
JSON whois cli [https://jsonwhois.io/] [bash]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# dependencies: jq, curl, bash | |
# Usage: ./whois.sh example.com | |
# Caches lookups in /var/cache/whois | |
# Sign up for api key here: https://jsonwhois.io/register | |
domain="$1" | |
cache_dir='/var/cache/whois' | |
cache_entry="$cache_dir/$domain" | |
json_whois_api_key="YOUR_API_KEY" | |
[[ ! -d "$cache_dir" ]] && mkdir -p "/var/cache/whois" | |
if [[ -f "$cache_entry" ]]; then | |
jq '.' "$cache_entry" | |
exit; | |
fi | |
curl -s "https://api.jsonwhois.io/whois/domain?key=$json_whois_api_key&domain=$domain" | jq '.' - | tee "$cache_entry" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment