mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-14 05:12:36 +08:00
Update WebScan.go
This commit is contained in:
parent
468381fb18
commit
5ff8b781c8
@ -3,14 +3,13 @@ package WebScan
|
|||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/shadow1ng/fscan/WebScan/lib"
|
||||||
|
"github.com/shadow1ng/fscan/common"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/shadow1ng/fscan/WebScan/lib"
|
|
||||||
"github.com/shadow1ng/fscan/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed pocs
|
//go:embed pocs
|
||||||
@ -18,23 +17,23 @@ var Pocs embed.FS
|
|||||||
var once sync.Once
|
var once sync.Once
|
||||||
var AllPocs []*lib.Poc
|
var AllPocs []*lib.Poc
|
||||||
|
|
||||||
func WebScan(info common.HostInfo, flags common.Flags) {
|
func WebScan(info *common.HostInfo) {
|
||||||
once.Do(func() { initpoc(flags.PocPath) })
|
once.Do(initpoc)
|
||||||
var pocinfo = flags.Pocinfo
|
var pocinfo = common.Pocinfo
|
||||||
buf := strings.Split(info.Url, "/")
|
buf := strings.Split(info.Url, "/")
|
||||||
pocinfo.Target = strings.Join(buf[:3], "/")
|
pocinfo.Target = strings.Join(buf[:3], "/")
|
||||||
|
|
||||||
if pocinfo.PocName != "" {
|
if pocinfo.PocName != "" {
|
||||||
Execute(pocinfo, flags)
|
Execute(pocinfo)
|
||||||
} else {
|
} else {
|
||||||
for _, infostr := range info.Infostr {
|
for _, infostr := range info.Infostr {
|
||||||
pocinfo.PocName = lib.CheckInfoPoc(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)
|
req, err := http.NewRequest("GET", PocInfo.Target, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errlog := fmt.Sprintf("[-] webpocinit %v %v", PocInfo.Target, err)
|
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")
|
req.Header.Set("Connection", "close")
|
||||||
pocs := filterPoc(PocInfo.PocName)
|
pocs := filterPoc(PocInfo.PocName)
|
||||||
lib.CheckMultiPoc(req, pocs, flags)
|
lib.CheckMultiPoc(req, pocs, common.PocNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initpoc(pocPath string) {
|
func initpoc() {
|
||||||
if pocPath == "" {
|
if common.PocPath == "" {
|
||||||
entries, err := Pocs.ReadDir("pocs")
|
entries, err := Pocs.ReadDir("pocs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("[-] init poc error: %v", err)
|
fmt.Printf("[-] init poc error: %v", err)
|
||||||
@ -68,7 +67,7 @@ func initpoc(pocPath string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := filepath.Walk(pocPath,
|
err := filepath.Walk(common.PocPath,
|
||||||
func(path string, info os.FileInfo, err error) error {
|
func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil || info == nil {
|
if err != nil || info == nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user