Skip to content

Commit 560145a

Browse files
authored
Add script to build a list of of environment identifiers based on sub domain names.
1 parent 9e778c6 commit 560145a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# Script to build a list of of environment identifiers based on sub domain names.
3+
## References:
4+
# See https://blog.majestic.com/development/alexa-top-1-million-sites-retired-heres-majestic-million/
5+
# See https://github.com/danielmiessler/SecLists/issues/654
6+
# See https://github.com/danielmiessler/SecLists/pull/671
7+
## Requires jq
8+
#
9+
# Add more top level domain in the expression below
10+
TLD_WANTED_EXPR="\.(lu|be)$"
11+
#
12+
echo "[+] Download Majestic CSV file..."
13+
wget -O majestic.csv https://downloads.majestic.com/majestic_million.csv
14+
echo "[+] Extract wanted domains..."
15+
cat majestic.csv | cut -d',' -f3 | grep -E $TLD_WANTED_EXPR > domains.txt
16+
wc -l domains.txt
17+
echo "[+] Extract sub domains via Certificate Transparency logs (https://crt.sh)..."
18+
while IFS= read -r line
19+
do
20+
printf "\rDomain: %-40s" "$line"
21+
curl -sk "https://crt.sh/?q=$line&output=json" | jq -r ".[].name_value" | cut -d'.' -f1 1>> subdomains.txt 2>/dev/null
22+
done < domains.txt
23+
cat subdomains.txt | sort -u > subdomains.tmp
24+
mv subdomains.tmp subdomains.txt
25+
wc -l subdomains.txt
26+
echo "[+] Extract environment like sub domains..."
27+
grep -Ei "^(de|dv|ts|te|in|st|ho|pr|pp)" subdomains.txt > env-like-subdomains.txt
28+
echo "[i] Manually review the generated file 'env-like-subdomains.txt' for accurate content."
29+
wc -l env-like-subdomains.txt

0 commit comments

Comments
 (0)