Skip to content

Commit 74733d6

Browse files
committed
Add flags to enable or disable specific sources with all sources enabled by default
1 parent 4e95d87 commit 74733d6

File tree

1 file changed

+58
-11
lines changed

1 file changed

+58
-11
lines changed

main.go

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,43 @@ import (
1616

1717
func main() {
1818
var subsOnly bool
19+
20+
var (
21+
useCertSpotter bool
22+
useHackerTarget bool
23+
useThreatCrowd bool
24+
useCrtSh bool
25+
useFacebook bool
26+
useVirusTotal bool
27+
useFindSubDomains bool
28+
useUrlscan bool
29+
useBufferOverrun bool
30+
)
31+
1932
flag.BoolVar(&subsOnly, "subs-only", false, "Only include subdomains of search domain")
33+
flag.BoolVar(&useCertSpotter, "use-certspotter", true, "Enable CertSpotter source")
34+
flag.BoolVar(&useHackerTarget, "use-hackertarget", true, "Enable HackerTarget source")
35+
flag.BoolVar(&useThreatCrowd, "use-threatcrowd", true, "Enable ThreatCrowd source")
36+
flag.BoolVar(&useCrtSh, "use-crtsh", true, "Enable CrtSh source")
37+
flag.BoolVar(&useFacebook, "use-facebook", true, "Enable Facebook source")
38+
flag.BoolVar(&useVirusTotal, "use-virustotal", true, "Enable VirusTotal source")
39+
flag.BoolVar(&useFindSubDomains, "use-findsubdomains", true, "Enable FindSubDomains source")
40+
flag.BoolVar(&useUrlscan, "use-urlscan", true, "Enable Urlscan source")
41+
flag.BoolVar(&useBufferOverrun, "use-bufferoverrun", true, "Enable BufferOverrun source")
2042
flag.Parse()
2143

44+
useSources := map[string]bool{
45+
"certspotter": useCertSpotter,
46+
"hackertarget": useHackerTarget,
47+
"threatcrowd": useThreatCrowd,
48+
"crtsh": useCrtSh,
49+
"facebook": useFacebook,
50+
"virustotal": useVirusTotal,
51+
"findsubdomains": useFindSubDomains,
52+
"urlscan": useUrlscan,
53+
"bufferoverrun": useBufferOverrun,
54+
}
55+
2256
var domains io.Reader
2357
domains = os.Stdin
2458

@@ -27,17 +61,30 @@ func main() {
2761
domains = strings.NewReader(domain)
2862
}
2963

30-
sources := []fetchFn{
31-
fetchCertSpotter,
32-
fetchHackerTarget,
33-
fetchThreatCrowd,
34-
fetchCrtSh,
35-
fetchFacebook,
36-
//fetchWayback, // A little too slow :(
37-
fetchVirusTotal,
38-
fetchFindSubDomains,
39-
fetchUrlscan,
40-
fetchBufferOverrun,
64+
var sources []fetchFn
65+
for source, enabled := range useSources {
66+
if enabled {
67+
switch source {
68+
case "certspotter":
69+
sources = append(sources, fetchCertSpotter)
70+
case "hackertarget":
71+
sources = append(sources, fetchHackerTarget)
72+
case "threatcrowd":
73+
sources = append(sources, fetchThreatCrowd)
74+
case "crtsh":
75+
sources = append(sources, fetchCrtSh)
76+
case "facebook":
77+
sources = append(sources, fetchFacebook)
78+
case "virustotal":
79+
sources = append(sources, fetchVirusTotal)
80+
case "findsubdomains":
81+
sources = append(sources, fetchFindSubDomains)
82+
case "urlscan":
83+
sources = append(sources, fetchUrlscan)
84+
case "bufferoverrun":
85+
sources = append(sources, fetchBufferOverrun)
86+
}
87+
}
4188
}
4289

4390
out := make(chan string)

0 commit comments

Comments
 (0)