From ccfac88005ab098d291173a58850d73dadd920ec Mon Sep 17 00:00:00 2001 From: hktalent <18223385+hktalent@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:10:56 +0800 Subject: [PATCH] fixed #125 #148 #151 #153 #159 2023-12-21 --- Formula.rb | 2 +- lib/util/checkerImp.go | 28 +++++++++++++++++----------- main.go | 2 ++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Formula.rb b/Formula.rb index 3b70f47e4..c727f5f5a 100644 --- a/Formula.rb +++ b/Formula.rb @@ -2,7 +2,7 @@ class scan4all < Formula desc "Official repository vuls Scan: 15000+PoCs; 23 kinds of application password crack; 7000+Web fingerprints; 146 protocols and 90000+ rules Port scanning; Fuzz, HW, awesome BugBounty( ͡° ͜ʖ ͡°)..." homepage "https://github.com/GhostTroops/scan4all" url "https://github.com/GhostTroops/scan4all/releases/download/2.9.0/scan4all_2.9.0_macOS_amd64.zip" - sha256 "ccd874a283defad6a0deb11377cb9d6024cb5946b46f61f36008e0afe9db4950" + sha256 "542f26a2cbcbd37318d8cbb6e40607cfbff91f6c3a2ea945e143833c1a6aca19" version "V2.9.0" def install diff --git a/lib/util/checkerImp.go b/lib/util/checkerImp.go index f19090b62..7485020de 100644 --- a/lib/util/checkerImp.go +++ b/lib/util/checkerImp.go @@ -19,10 +19,11 @@ var ( ) // 检查器的设计:解耦、规范、统一,各类专注实现自己 -// 1、允许未响应header、body、js、css等构建不同的检查器 -// 2、每个检查器都有缓存 -// 3、避免重复检查 -// 4、具有自动释放缓存的机制,程序退出时自动消费(内存缓存) +// +// 1、允许未响应header、body、js、css等构建不同的检查器 +// 2、每个检查器都有缓存 +// 3、避免重复检查 +// 4、具有自动释放缓存的机制,程序退出时自动消费(内存缓存) type CheckerTools struct { Name string `json:"name"` // RespHeader,RespBody,RespJs,RespCss,RespTitle,ReqHeader checkFunc []func(*CheckerTools, ...interface{}) `json:"check_func"` // 注册的检查器 @@ -78,8 +79,10 @@ func (r *CheckerTools) GetBodyStr(a ...interface{}) string { // 检查 func (r *CheckerTools) Check(parm ...interface{}) { for _, f := range r.checkFunc { - log.Printf("Check %+v\n", parm) - f(r, parm...) + if nil != f { + log.Printf("Check %+v\n", parm) + f(r, parm...) + } } } @@ -112,12 +115,15 @@ func CheckRespHeader(parm ...interface{}) { } // 检查 response 对象 -// 1、包括头的检查 -// 2、包括body的检查 +// +// 1、包括头的检查 +// 2、包括body的检查 func CheckResp(szU string, resp ...*http.Response) { - for _, r := range resp { - CheckRespHeader(&r.Header, szU) - GetInstance(RespBody).Check(&r, szU) + if nil != resp && 0 < len(resp) { + for _, r := range resp { + CheckRespHeader(&r.Header, szU) + GetInstance(RespBody).Check(&r, szU) + } } } diff --git a/main.go b/main.go index 6a9d899ee..ee5a975cb 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,8 @@ var Version string /* go tool pprof -seconds=180 -http=:9999 http://127.0.0.1:6060/debug/pprof/heap no leak +go tool pprof http://192.168.7.11:6060/debug/pprof/profile + http://localhost:9999/ui/ */ func main() {