Skip to content

Instantly share code, notes, and snippets.

@hxlxmjxbbxs
Forked from streaak/hunterio.sh
Created May 14, 2022 20:29
Show Gist options
  • Save hxlxmjxbbxs/7350dfb3aa4ae1a56025ea940f40b8a1 to your computer and use it in GitHub Desktop.
Save hxlxmjxbbxs/7350dfb3aa4ae1a56025ea940f40b8a1 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