Skip to content

Instantly share code, notes, and snippets.

@bbhunter
Forked from streaak/hunterio.sh
Created August 25, 2020 14:50
Show Gist options
  • Save bbhunter/9d9fbfab8c76905fa2dd1ad0ce26fe4e to your computer and use it in GitHub Desktop.
Save bbhunter/9d9fbfab8c76905fa2dd1ad0ce26fe4e to your computer and use it in GitHub Desktop.
Script to gather emails from Hunter.io API
#!/bin/bash
total=$(curl -s "https://api.hunter.io/v2/email-count?domain=$1" | jq -r '.data.total')
echo "Total is $total"
if [ "$total" != "0" ]; then
for (( i=0; i<=$total; i+=100 ))
do
echo "offset $i"
curl -s "https://api.hunter.io/v2/domain-search?domain=$1&api_key=KEYHERE&limit=100&offset=$i" | jq -r '.data.emails[].value' >> hunter_emails.txt
done
sort -uo hunter_emails.txt hunter_emails.txt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment