forked from ecstatic-nobel/Analyst-Arsenal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dns_twist.sh
34 lines (30 loc) · 900 Bytes
/
dns_twist.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
#
# Usage: bash dnstwist.sh PATH_TO_DNSTWIST_SCRIPT
#
DNSTWIST_SCRIPT="$1"
if [[ -f "$DNSTWIST_SCRIPT" ]]
then
KEYWORDS=$(
grep -A 1000 -E ^keywords config.yaml | \
grep -B 1000 -E ^queries | \
grep -E "^\s+" | \
tr -d ' ' | \
grep -v \# | \
grep -vE "^\.|^\-"
)
echo "keywords:" > dns_twisted.yaml
echo "$KEYWORDS" | while read -r KEYWORD
do
SCORE=$(echo "$KEYWORD" | sed "s/.*://gi")
KEYWORD=$(echo "$KEYWORD" | grep -oE "'.+'" | tr -d "'")
TWISTED=$(python "$DNSTWIST_SCRIPT" --format idle -t 10 "$KEYWORD".com)
echo "$TWISTED" | \
grep -vE "^xn--|$KEYWORD" | \
sed "s/^/ '/gi" | \
sed "s/$/': $SCORE/gi" >> dns_twisted.yaml
done
sed -i "s/\.com':/':/gi" dns_twisted.yaml
else
file "$DNSTWIST_SCRIPT"
fi