-
Notifications
You must be signed in to change notification settings - Fork 307
/
enscan.go
43 lines (40 loc) · 1011 Bytes
/
enscan.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 (
"github.com/wgpsec/ENScan/common"
"github.com/wgpsec/ENScan/common/gologger"
"github.com/wgpsec/ENScan/common/utils"
"github.com/wgpsec/ENScan/runner"
"log"
"os"
"os/signal"
)
func main() {
var enOptions common.ENOptions
common.Flag(&enOptions)
common.Parse(&enOptions)
var quitSig = make(chan os.Signal, 1)
signal.Notify(quitSig, os.Interrupt, os.Kill)
go func() {
for {
select {
case <-quitSig:
if !enOptions.IsApiMode {
gologger.Error().Msgf("任务未完成退出,将自动保存过程文件!")
enDataList := make(map[string][]map[string]string)
close(runner.EnCh)
if len(runner.EnCh) > 0 {
for ch := range runner.EnCh {
utils.MergeMap(ch, enDataList)
}
err := common.OutFileByEnInfo(enDataList, "进程退出保存文件", "xlsx", "outs")
if err != nil {
gologger.Error().Msgf(err.Error())
}
}
}
log.Fatal("exit.by.signal")
}
}
}()
runner.RunEnumeration(&enOptions)
}