refactor: 调整扫描逻辑

This commit is contained in:
ZacharyZcR
2025-01-04 14:04:41 +08:00
parent 75aeee5215
commit af06345aa5
7 changed files with 205 additions and 46 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/shadow1ng/fscan/Common"
"github.com/shadow1ng/fscan/WebScan/lib"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
@@ -65,6 +66,18 @@ func WebScan(info *Common.HostInfo) {
func Execute(PocInfo Common.PocInfo) {
Common.LogDebug(fmt.Sprintf("开始执行POC检测目标: %s", PocInfo.Target))
// 确保URL格式正确
if !strings.HasPrefix(PocInfo.Target, "http://") && !strings.HasPrefix(PocInfo.Target, "https://") {
PocInfo.Target = "http://" + PocInfo.Target
}
// 验证URL格式
_, err := url.Parse(PocInfo.Target)
if err != nil {
Common.LogError(fmt.Sprintf("无效的URL格式 %v: %v", PocInfo.Target, err))
return
}
// 创建基础HTTP请求
req, err := http.NewRequest("GET", PocInfo.Target, nil)
if err != nil {