forked from haccer/subjack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanio.sh
60 lines (53 loc) · 1.5 KB
/
scanio.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Usage : ./scanio.sh <version number> <file>
# Example : ./scanio.sh 20171006 cname_list.txt
# Gathering data from scans.io and parsing it into a file called cname,
echo "[+] Downloading Project Sonar (This may take a while)."
wget https://scans.io/data/rapid7/sonar.fdns_v2/$1-fdns.json.gz
echo "[+] Grabbing CNAME records."
zcat $1-fdns.json.gz | grep 'type":"cname' | awk -F'":"' '{print $3, $5}' | \
awk -F'"' '{print $1, $3}' | sed -e s/" type "/" "/g >> cname_scanio
# List of cnames we're going to grep for.
declare -a arr=(
"\.cloudfront.net"
"\.s3-website"
"\.s3.amazonaws.com"
"w.amazonaws.com"
"1.amazonaws.com"
"2.amazonaws.com"
"s3-external"
"s3-accelerate.amazonaws.com"
"\.herokuapp.com"
"\.herokussl.com"
"\.herokudns.com"
"\.wordpress.com"
"\.pantheonsite.io"
"domains.tumblr.com"
"\.wpengine.com"
"\.desk.com"
"\.zendesk.com"
"\.github.io"
"\.global.fastly.net"
"\.helpjuice.com"
"\.helpscoutdocs.com"
"\.ghost.io"
"cargocollective.com"
"redirect.feedpress.me"
"\.freshdesk.com"
"\.myshopify.com"
"\.statuspage.io"
"\.uservoice.com"
"\.surge.sh"
)
#Joining elements together.
function join_by { local IFS="$1"; shift; echo "$*"; }
DOMAINS=$(join_by '|' "${arr[@]}")
# Grepping cnames from array.
echo "[+] Sorting CNAME records."
grep -E "${DOMAINS}" cname_scanio >> cname_db
# Sorting cname list
echo "[+] Cleaning up."
cat cname_db | awk '{print $1}' | sort | uniq >> $2
# Clean up.
rm cname_db cname_scanio
echo "[+] Finished."