mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-13 21:02:44 +08:00
Update WebScan.go
This commit is contained in:
parent
468381fb18
commit
5ff8b781c8
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user