Created
April 26, 2019 18:52
-
-
Save noraj/86df35096aa250ead4f7b3a6e6eb09de 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
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 | |
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
ASCII video demo: https://asciinema.org/a/243061
article: https://rawsec.ml/en/crawl-web-page-domains-resolve-ips/