Created
November 4, 2016 14:12
-
-
Save Da-Juan/e7bbecc87f45a4e487c6709e5d06f182 to your computer and use it in GitHub Desktop.
Get IPs from a file containing URLs
This file contains 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 | |
for i in $(sed -r 's@^http[s]?://([[:alnum:].]+)[/]?$@\1@' $1); do | |
echo "=== $i ===" | |
echo $i | egrep -q "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | |
if [ $? -eq 0 ]; then | |
echo $i | |
else | |
host -t A $i | grep address | awk '{print $4}'| sort | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment