Skip to content

Instantly share code, notes, and snippets.

@bl4de
Forked from noraj/crawl-extract-resolve.sh
Created May 8, 2019 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bl4de/dc593527da503afb148b95281423e7e8 to your computer and use it in GitHub Desktop.
Save bl4de/dc593527da503afb148b95281423e7e8 to your computer and use it in GitHub Desktop.
crawl a web page, extract all domains and resolve them to IP addresses with bash and common GNU/Linux tools
#!/bin/bash
url='rawsec.ml'
domains=$(curl $url -s | grep -E 'https?://[^"]*' | cut -d '/' -f 3 | cut -d '"' -f 1 | uniq)
filename='/tmp/temporary_ips.txt'
for domain in $domains
do
dig +noall +answer $domain | awk '/\sA\s/ {print $5}' >> $filename
done
cat $filename | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment