Last active
December 6, 2017 11:50
-
-
Save xyzkab/8f5cd46552bb4fd7d27d59f2680b40b1 to your computer and use it in GitHub Desktop.
sublist3r-domain-output-validator
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 | |
# | |
# simple script get and parse output from sublist3r and get the addresses | |
# will only print sub domain target that exist | |
# | |
# sample output below | |
: ' | |
Bing: sub1.targetdomain.com | |
Baidu: sub2.targetdomain.com | |
DNSdumpster: sub3.targetdomain.com | |
SSL Certificates: sub4.targetdomain.com | |
Virustotal: sub5.targetdomain.com | |
' | |
outfile=$1 | |
if [ -z $outfile ] || [ ! -f $outfile ]; then | |
echo "Please specify sublist3r output file-like" | |
exit 1 | |
fi | |
BIFS=$IFS | |
IFS=$(echo -ne "\n\b") | |
for domain in `cat $outfile | sed 's/: / /g'`; do | |
s=$(echo $domain | awk '{print $1}') | |
d=$(echo $domain | awk '{print $2}') | |
hostresult=$(host $d) | |
if [[ "$hostresult" =~ "not found" ]]; then | |
continue | |
else | |
echo -e "\033[32m[+]\033[0m source: \033[33m$s\033[0m | domain: \033[31m$d\033[0m" | |
while read -r subdomain; do | |
echo -e " \033[32m[+]\033[0m $subdomain" | |
done <<< $hostresult | |
fi | |
done | |
IFS=$BIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment