优化报错处理

This commit is contained in:
shadow1ng
2024-05-11 16:04:02 +08:00
parent 19d969acd2
commit 1d9b6528dd
5 changed files with 30 additions and 19 deletions
+2 -2
View File
@@ -40,8 +40,8 @@ func PortScan(hostslist []string, ports string, timeout int64) []string {
sort.Ints(probePorts)
}
workers := common.Threads
Addrs := make(chan Addr, len(hostslist)*len(probePorts))
results := make(chan string, len(hostslist)*len(probePorts))
Addrs := make(chan Addr, 100)
results := make(chan string, 100)
var wg sync.WaitGroup
//接收结果
+5
View File
@@ -112,6 +112,11 @@ func AddScan(scantype string, info common.HostInfo, ch *chan struct{}, wg *sync.
}
func ScanFunc(name *string, info *common.HostInfo) {
defer func() {
if err := recover(); err != nil {
fmt.Printf("[-] %v:%v scan error: %v\n", info.Host, info.Ports, err)
}
}()
f := reflect.ValueOf(PluginList[*name])
in := []reflect.Value{reflect.ValueOf(info)}
f.Call(in)