-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
48 lines (38 loc) · 826 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
44
45
46
47
48
package main
import (
"fmt"
"os"
"sync"
"github.com/kenjoe41/h1scope/pkg/hackerone"
"github.com/kenjoe41/h1scope/pkg/options"
)
func main() {
flags := options.ScanFlag()
if flags.Username == "" || flags.Apikey == "" {
fmt.Fprintln(os.Stderr, "H1 Username and API key are needed.")
options.Usage()
os.Exit(1)
}
programsChan := make(chan string)
outputChan := make(chan string)
var outputWG sync.WaitGroup
outputWG.Add(1)
go func() {
defer outputWG.Done()
for scopeAsset := range outputChan {
fmt.Println(scopeAsset)
}
}()
if flags.Handle != "" {
err := hackerone.GetProgramScope(outputChan, flags)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
} else {
hackerone.GetProgramsScope(programsChan, outputChan, flags)
}
go func() {
outputWG.Wait()
close(outputChan)
}()
}