Skip to content

Commit a33c987

Browse files
committed
1 parent 134b1bc commit a33c987

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

Formula.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class scan4all < Formula
22
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( ͡° ͜ʖ ͡°)..."
33
homepage "https://github.com/GhostTroops/scan4all"
44
url "https://github.com/GhostTroops/scan4all/releases/download/2.9.0/scan4all_2.9.0_macOS_amd64.zip"
5-
sha256 "ccd874a283defad6a0deb11377cb9d6024cb5946b46f61f36008e0afe9db4950"
5+
sha256 "542f26a2cbcbd37318d8cbb6e40607cfbff91f6c3a2ea945e143833c1a6aca19"
66
version "V2.9.0"
77

88
def install

lib/util/checkerImp.go

+17-11
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ var (
1919
)
2020

2121
// 检查器的设计:解耦、规范、统一,各类专注实现自己
22-
// 1、允许未响应header、body、js、css等构建不同的检查器
23-
// 2、每个检查器都有缓存
24-
// 3、避免重复检查
25-
// 4、具有自动释放缓存的机制,程序退出时自动消费(内存缓存)
22+
//
23+
// 1、允许未响应header、body、js、css等构建不同的检查器
24+
// 2、每个检查器都有缓存
25+
// 3、避免重复检查
26+
// 4、具有自动释放缓存的机制,程序退出时自动消费(内存缓存)
2627
type CheckerTools struct {
2728
Name string `json:"name"` // RespHeader,RespBody,RespJs,RespCss,RespTitle,ReqHeader
2829
checkFunc []func(*CheckerTools, ...interface{}) `json:"check_func"` // 注册的检查器
@@ -78,8 +79,10 @@ func (r *CheckerTools) GetBodyStr(a ...interface{}) string {
7879
// 检查
7980
func (r *CheckerTools) Check(parm ...interface{}) {
8081
for _, f := range r.checkFunc {
81-
log.Printf("Check %+v\n", parm)
82-
f(r, parm...)
82+
if nil != f {
83+
log.Printf("Check %+v\n", parm)
84+
f(r, parm...)
85+
}
8386
}
8487
}
8588

@@ -112,12 +115,15 @@ func CheckRespHeader(parm ...interface{}) {
112115
}
113116

114117
// 检查 response 对象
115-
// 1、包括头的检查
116-
// 2、包括body的检查
118+
//
119+
// 1、包括头的检查
120+
// 2、包括body的检查
117121
func CheckResp(szU string, resp ...*http.Response) {
118-
for _, r := range resp {
119-
CheckRespHeader(&r.Header, szU)
120-
GetInstance(RespBody).Check(&r, szU)
122+
if nil != resp && 0 < len(resp) {
123+
for _, r := range resp {
124+
CheckRespHeader(&r.Header, szU)
125+
GetInstance(RespBody).Check(&r, szU)
126+
}
121127
}
122128
}
123129

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ var Version string
2222
/*
2323
go tool pprof -seconds=180 -http=:9999 http://127.0.0.1:6060/debug/pprof/heap
2424
no leak
25+
go tool pprof http://192.168.7.11:6060/debug/pprof/profile
26+
2527
http://localhost:9999/ui/
2628
*/
2729
func main() {

0 commit comments

Comments
 (0)