Created
September 30, 2020 00:03
-
-
Save coderholic/6942cb1daeb66d0c9fc90b4fd32fb09c to your computer and use it in GitHub Desktop.
Bulk hostname resolution with the IPinfo.io bulk endpoint
This file contains hidden or 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 | |
sed 's/$/\/hostname/' | parallel --jobs=12 --pipe -N1000 \ | |
"curl -s -XPOST -H 'Content-Type: text/plain' --data-binary @- 'ipinfo.io/batch?token=$TOKEN&filter=1'" | \ | |
grep '"' | sed 's|/hostname||' | cut -d'"' -f2,4 | tr '"' '\t' |
Nope, nothing needs changing (hostname selects the hostname field). You invoke like:
echo "8.8.8.8" | ipinfo_resolv.sh
Thanks For your reply!
I am confused , between the script and the host command, which tells you exactly the same thing.
What am I missing ?
Yeah it does give you exactly the same output as host
. The difference is speed. If you want to lookup 1 IP (or maybe even 10) host is fine. By using the https://ipinfo.io API to do this you can lookup a whole /14 (262,144 IPs) in under 30 seconds. With host
that'd take over an hour. See https://twitter.com/coderholic/status/1311098613334831107 for context.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hostname should be changed target.com . Right?