屏蔽go内部库报错日志

This commit is contained in:
shadow1ng 2023-12-25 17:57:28 +08:00
parent 276b446e0c
commit 19d969acd2
2 changed files with 6 additions and 5 deletions

View File

@ -9,11 +9,10 @@ import (
"github.com/shadow1ng/fscan/common" "github.com/shadow1ng/fscan/common"
"golang.org/x/net/proxy" "golang.org/x/net/proxy"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"io/ioutil"
"log"
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
"os"
"strings" "strings"
"time" "time"
) )
@ -35,7 +34,7 @@ func Inithttp() {
} }
err := InitHttpClient(common.PocNum, common.Proxy, time.Duration(common.WebTimeout)*time.Second) err := InitHttpClient(common.PocNum, common.Proxy, time.Duration(common.WebTimeout)*time.Second)
if err != nil { if err != nil {
log.Fatal(err) panic(err)
} }
} }
@ -247,7 +246,7 @@ func SelectPoc(Pocs embed.FS, pocname string) []string {
func LoadPocbyPath(fileName string) (*Poc, error) { func LoadPocbyPath(fileName string) (*Poc, error) {
p := &Poc{} p := &Poc{}
data, err := ioutil.ReadFile(fileName) data, err := os.ReadFile(fileName)
if err != nil { if err != nil {
fmt.Printf("[-] load poc %s error3: %v\n", fileName, err) fmt.Printf("[-] load poc %s error3: %v\n", fileName, err)
return nil, err return nil, err

View File

@ -4,6 +4,8 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/fatih/color" "github.com/fatih/color"
"io"
"log"
"os" "os"
"strings" "strings"
"sync" "sync"
@ -13,7 +15,6 @@ import (
var Num int64 var Num int64
var End int64 var End int64
var Results = make(chan *string) var Results = make(chan *string)
var Start = true
var LogSucTime int64 var LogSucTime int64
var LogErrTime int64 var LogErrTime int64
var WaitTime int64 var WaitTime int64
@ -28,6 +29,7 @@ type JsonText struct {
} }
func init() { func init() {
log.SetOutput(io.Discard)
LogSucTime = time.Now().Unix() LogSucTime = time.Now().Unix()
go SaveLog() go SaveLog()
} }