Skip to content

Commit

Permalink
added concurrency flag
Browse files Browse the repository at this point in the history
  • Loading branch information
saschamonteiro committed Jul 24, 2024
1 parent 20bc0f6 commit 7fe7289
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

// StartTlsCollect will start the scan for TLS certificates on the specified networks/ports
func StartTlsCollect(cidrAddressList string, portList string, skipNoDnsFound bool, Assets embed.FS, htmlOut string, jsonOut string) {
func StartTlsCollect(cidrAddressList string, portList string, skipNoDnsFound bool, Assets embed.FS, htmlOut string, jsonOut string, concurrent int) {
cidrAdd := strings.Split(cidrAddressList, ",")
allHosts := []string{}
for _, cidrAddress := range cidrAdd {
Expand All @@ -26,7 +26,7 @@ func StartTlsCollect(cidrAddressList string, portList string, skipNoDnsFound boo
g, ctx := errgroup.WithContext(context.Background())
resultChan := make(chan []certs.TlsCert, len(allHosts)*len(ports))
result := make([]certs.TlsCert, 0)
g.SetLimit(128)
g.SetLimit(concurrent)
fmt.Printf("Scanning CIDRs:%v [ports:%s], please wait ", cidrAddressList, portList)
for _, host := range allHosts {
a := host
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ func main() {
skipNoDnsFound := flag.Bool("skipnodns", false, "skip no dns found")
htmlOut := flag.String("html", "", "html output file")
jsonOut := flag.String("json", "", "json output file")
ver := flag.Bool("v", false, fmt.Sprintf("version sha:%s buildtime:%s", sha1ver, buildTime))
concurrent := flag.Int("conc", 128, "concurrent connections")
ver := flag.Bool("v", false, fmt.Sprintf("version (sha:%s buildtime:%s)", sha1ver, buildTime))
flag.Parse()
if *ver {
fmt.Printf("version: %s\n", sha1ver)
fmt.Printf("build time: %s\n", buildTime)
os.Exit(0)
}

app.StartTlsCollect(*cidrAddressList, *portList, *skipNoDnsFound, Assets, *htmlOut, *jsonOut)
app.StartTlsCollect(*cidrAddressList, *portList, *skipNoDnsFound, Assets, *htmlOut, *jsonOut, *concurrent)

}

0 comments on commit 7fe7289

Please sign in to comment.