forked from GhostTroops/scan4all
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
63 lines (59 loc) · 1.56 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"embed"
"fmt"
"github.com/hktalent/scan4all/pkg"
naaburunner "github.com/hktalent/scan4all/pkg/naabu/v2/pkg/runner"
"github.com/projectdiscovery/gologger"
"io"
"log"
"net/http"
_ "net/http/pprof"
"runtime"
)
//go:embed config/*
var config embed.FS
func init() {
pkg.Init2(&config)
}
func main() {
defer func() {
log.Println("start close cache, StopCPUProfile... ")
pkg.Cache1.Close()
//if "true" == pkg.GetVal("autoRmCache") {
// os.RemoveAll(pkg.GetVal(pkg.CacheName))
//}
}()
options := naaburunner.ParseOptions()
if options.Debug {
// debug 优化时启用///////////////////////
go func() {
fmt.Println("debug info: \nopen http://127.0.0.1:6060/debug/pprof/")
http.ListenAndServe(":6060", nil)
}()
//////////////////////////////////////////*/
}
if false == options.Debug && false == options.Verbose {
// disable standard logger (ref: https://github.com/golang/go/issues/19895)
log.SetFlags(0)
log.SetOutput(io.Discard)
}
pkg.G_Options = options
if runtime.GOOS == "windows" {
options.NoColor = true
}
naabuRunner, err := naaburunner.NewRunner(options)
if err != nil {
gologger.Fatal().Msgf("naaburunner.NewRunner Could not create runner: %s\n", err)
}
gologger.Info().Msg("Port scan starting....")
err = naabuRunner.RunEnumeration()
if err != nil {
gologger.Fatal().Msgf("Could not run enumeration: %s\n", err)
}
gologger.Info().Msg("Port scan over,web scan starting")
err = naabuRunner.Httpxrun()
if err != nil {
gologger.Fatal().Msgf("naabuRunner.Httpxrun Could not run httpRunner: %s\n", err)
}
}