forked from projectdiscovery/httpx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.go
41 lines (34 loc) · 972 Bytes
/
example.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
package main
import (
"fmt"
"log"
"github.com/projectdiscovery/goflags"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
"github.com/projectdiscovery/httpx/runner"
)
func main() {
gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose) // increase the verbosity (optional)
options := runner.Options{
Methods: "GET",
InputTargetHost: goflags.StringSlice{"scanme.sh", "projectdiscovery.io", "localhost"},
//InputFile: "./targetDomains.txt", // path to file containing the target domains list
OnResult: func(r runner.Result) {
// handle error
if r.Err != nil {
fmt.Printf("[Err] %s: %s\n", r.Input, r.Err)
return
}
fmt.Printf("%s %s %d\n", r.Input, r.Host, r.StatusCode)
},
}
if err := options.ValidateOptions(); err != nil {
log.Fatal(err)
}
httpxRunner, err := runner.New(&options)
if err != nil {
log.Fatal(err)
}
defer httpxRunner.Close()
httpxRunner.RunEnumeration()
}