Skip to content

Instantly share code, notes, and snippets.

@hateshape
Last active July 11, 2022 06:01
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hateshape/a1245dccb03110c4f4827e9647472384 to your computer and use it in GitHub Desktop.
Save hateshape/a1245dccb03110c4f4827e9647472384 to your computer and use it in GitHub Desktop.
#!/bin/bash
curl -s -k -o $1.json "https://api.c99.nl/subdomainfinder?key=XXXXX-XXXXX-XXXXX-XXXXX&domain=$1&json"
jq '.subdomains|.[].subdomain' $1.json > subdomain
jq '.subdomains|.[].ip' $1.json > ips
jq '.subdomains|.[].cloudflare' $1.json > cloudflare
subdomains_len=$(wc -l subdomain | awk '{print $1}')
ips_len=$(wc -l ips | awk '{print $1}')
cloudflare_len=$(wc -l cloudflare | awk '{print $1}')
if [ $(echo $subdomains_len) -eq $(echo $ips_len) ] && [ $(echo $ips_len) -eq $(echo $cloudflare_len) ]; then
paste -d',' subdomain ips cloudflare | sed 's#"##g' > $1-c99-final.txt.tmp
else
echo "You gone done borked something."
fi
sort -k1 -n -t, $1-c99-final.txt.tmp > $1-c99-final.txt
rm subdomain ips cloudflare $1-c99-final.txt.tmp
sed -i -e '1iSubdomain,IP,Cloudflare\' $1-c99-final.txt
cat $1-c99-final.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment