From e1c0334f72e00f5eed98af985da3d0879210e260 Mon Sep 17 00:00:00 2001 From: pingc0y Date: Sat, 9 Sep 2023 22:01:45 +0800 Subject: [PATCH] =?UTF-8?q?2023/9/9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ cmd/cmd.go | 2 +- crawler/run.go | 46 ++++++++++++++++++++++++++++++++++++++++++++-- util/utils.go | 13 +++++++------ 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a276fd4..a06a378 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,10 @@ go build -ldflags "-s -w" -o ./URLFinder-macos-arm64 ## 更新说明 +2023/9/9 +修复 -ff 重复验证问题 +修复 自动识别协议bug + 2023/9/2 修复 子目录定位bug diff --git a/cmd/cmd.go b/cmd/cmd.go index 78b01cf..eeb8c29 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -7,7 +7,7 @@ import ( "os" ) -var Update = "2023.9.2" +var Update = "2023.9.9" var XUpdate string var ( diff --git a/crawler/run.go b/crawler/run.go index 4b53e93..baa0cc2 100644 --- a/crawler/run.go +++ b/crawler/run.go @@ -139,7 +139,7 @@ func Run() { if cmd.U == "" { cmd.U = line } - start(line) + startFF(line) fmt.Println("----------------------------------------") } @@ -147,6 +147,7 @@ func Run() { break } } + ValidateFF() Res() return } @@ -155,6 +156,48 @@ func Run() { start(cmd.U) Res() } +func startFF(u string) { + fmt.Println("Target URL: " + u) + config.Wg.Add(1) + config.Ch <- 1 + go Spider(u, 1) + config.Wg.Wait() + config.Progress = 1 + fmt.Printf("\r\nSpider OK \n") +} + +func ValidateFF() { + result.ResultUrl = util.RemoveRepeatElement(result.ResultUrl) + result.ResultJs = util.RemoveRepeatElement(result.ResultJs) + if cmd.S != "" { + fmt.Printf("Start %d Validate...\n", len(result.ResultUrl)+len(result.ResultJs)) + fmt.Printf("\r ") + JsFuzz() + //验证JS状态 + for i, s := range result.ResultJs { + config.Wg.Add(1) + config.Jsch <- 1 + go JsState(s.Url, i, result.ResultJs[i].Source) + } + //验证URL状态 + for i, s := range result.ResultUrl { + config.Wg.Add(1) + config.Urlch <- 1 + go UrlState(s.Url, i) + } + config.Wg.Wait() + + time.Sleep(1 * time.Second) + fmt.Printf("\r ") + fmt.Printf("\rValidate OK \n\n") + + if cmd.Z != 0 { + UrlFuzz() + time.Sleep(1 * time.Second) + } + } + AddSource() +} func start(u string) { fmt.Println("Target URL: " + u) @@ -194,7 +237,6 @@ func start(u string) { } } AddSource() - } func Res() { diff --git a/util/utils.go b/util/utils.go index 0090c79..9f8feb7 100644 --- a/util/utils.go +++ b/util/utils.go @@ -110,18 +110,19 @@ func GetProtocol(domain string) string { if strings.HasPrefix(domain, "http") { return domain } - response, err := http.Get("http://" + domain) - if err != nil { + + response, err := http.Get("https://" + domain) + if err == nil { + return "https://" + domain + } + response, err = http.Get("http://" + domain) + if err == nil { return "http://" + domain } defer response.Body.Close() if response.TLS == nil { return "http://" + domain } - response, err = http.Get("https://" + domain) - if err != nil { - return "https://" + domain - } return "" }