-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 865 Bytes
/
main.go
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
package main
import (
"os"
"sync"
"github.com/rtfmkiesel/drivebyte/pkg/logger"
"github.com/rtfmkiesel/drivebyte/pkg/options"
"github.com/rtfmkiesel/drivebyte/pkg/runner"
"github.com/rtfmkiesel/drivebyte/pkg/webdiscovery"
)
func main() {
opt, err := options.Parse()
if err != nil {
logger.Error(err.Error())
os.Exit(1)
}
chanUrls := make(chan string)
wgUrls := new(sync.WaitGroup)
chanScreenshots := make(chan string)
wgScreenshots := new(sync.WaitGroup)
for i := 0; i < opt.Workers; i++ {
go runner.Urls(wgUrls, chanUrls, chanScreenshots, opt)
wgUrls.Add(1)
}
for i := 0; i < opt.Workers; i++ {
go runner.Screenshots(wgScreenshots, chanScreenshots, opt)
wgScreenshots.Add(1)
}
for _, url := range webdiscovery.Generate(opt) {
chanUrls <- url
}
close(chanUrls)
wgUrls.Wait()
close(chanScreenshots)
wgScreenshots.Wait()
}