From 5ff8b781c8f686729a9adfe3488715d2b918a110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E8=88=9E=E8=80=85?= Date: Mon, 13 Nov 2023 11:28:58 +0800 Subject: [PATCH] Update WebScan.go --- WebScan/WebScan.go | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/WebScan/WebScan.go b/WebScan/WebScan.go index 0a9452f..99bacd6 100644 --- a/WebScan/WebScan.go +++ b/WebScan/WebScan.go @@ -3,14 +3,13 @@ package WebScan import ( "embed" "fmt" + "github.com/shadow1ng/fscan/WebScan/lib" + "github.com/shadow1ng/fscan/common" "net/http" "os" "path/filepath" "strings" "sync" - - "github.com/shadow1ng/fscan/WebScan/lib" - "github.com/shadow1ng/fscan/common" ) //go:embed pocs @@ -18,23 +17,23 @@ var Pocs embed.FS var once sync.Once var AllPocs []*lib.Poc -func WebScan(info common.HostInfo, flags common.Flags) { - once.Do(func() { initpoc(flags.PocPath) }) - var pocinfo = flags.Pocinfo +func WebScan(info *common.HostInfo) { + once.Do(initpoc) + var pocinfo = common.Pocinfo buf := strings.Split(info.Url, "/") pocinfo.Target = strings.Join(buf[:3], "/") if pocinfo.PocName != "" { - Execute(pocinfo, flags) + Execute(pocinfo) } else { for _, infostr := range info.Infostr { pocinfo.PocName = lib.CheckInfoPoc(infostr) - Execute(pocinfo, flags) + Execute(pocinfo) } } } -func Execute(PocInfo common.PocInfo, flags common.Flags) { +func Execute(PocInfo common.PocInfo) { req, err := http.NewRequest("GET", PocInfo.Target, nil) if err != nil { errlog := fmt.Sprintf("[-] webpocinit %v %v", PocInfo.Target, err) @@ -49,11 +48,11 @@ func Execute(PocInfo common.PocInfo, flags common.Flags) { } req.Header.Set("Connection", "close") pocs := filterPoc(PocInfo.PocName) - lib.CheckMultiPoc(req, pocs, flags) + lib.CheckMultiPoc(req, pocs, common.PocNum) } -func initpoc(pocPath string) { - if pocPath == "" { +func initpoc() { + if common.PocPath == "" { entries, err := Pocs.ReadDir("pocs") if err != nil { fmt.Printf("[-] init poc error: %v", err) @@ -68,7 +67,7 @@ func initpoc(pocPath string) { } } } else { - err := filepath.Walk(pocPath, + err := filepath.Walk(common.PocPath, func(path string, info os.FileInfo, err error) error { if err != nil || info == nil { return err