Skip to content

Commit 4b65d59

Browse files
committed
fixed #57 2022-08-01
1 parent 4bb2511 commit 4b65d59

File tree

6 files changed

+29
-39
lines changed

6 files changed

+29
-39
lines changed

lib/util/Const.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ var PocCheck_pipe = make(chan *PocCheck, 64)
9494
// 1、需要认证
9595
// 2、shiro
9696
func CheckHeader(header *http.Header, szUrl string) {
97-
Wg.Add(1)
98-
go func() {
99-
defer Wg.Done()
97+
DoSyncFunc(func() {
10098
if nil != header {
10199
a1 := []string{}
102100
if v := (*header)["www-Authenticate"]; 0 < len(v) {
@@ -111,5 +109,5 @@ func CheckHeader(header *http.Header, szUrl string) {
111109
PocCheck_pipe <- &PocCheck{Wappalyzertechnologies: &a1, URL: szUrl, FinalURL: szUrl, Checklog4j: false}
112110
}
113111
}
114-
}()
112+
})
115113
}

lib/util/util.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import (
1010
"net/http"
1111
"net/http/cookiejar"
1212
"net/url"
13-
"os"
1413
"reflect"
15-
"runtime"
1614
"sort"
1715
"strings"
1816
"time"
@@ -285,9 +283,9 @@ func CloseAll() {
285283
Cache1 = nil
286284
}
287285

288-
if runtime.GOOS == "windows" || GetValAsBool("autoRmCache") {
289-
os.RemoveAll(GetVal(CacheName))
290-
}
286+
//if runtime.GOOS == "windows" || GetValAsBool("autoRmCache") {
287+
// os.RemoveAll(GetVal(CacheName))
288+
//}
291289
Close()
292290
CloseCache()
293291
}

pkg/httpx/runner/runner.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,6 @@ retry:
13241324
}
13251325
return nn
13261326
}
1327-
util.Wg.Add(1)
13281327
//通过wFingerprint获取到的指纹进行检测gopoc check
13291328
poctechnologies1 = pocs_go.POCcheck(technologies, ul, finalURL, false)
13301329
Vullist = append(Vullist, poctechnologies1...)
@@ -1337,7 +1336,6 @@ retry:
13371336
filefuzzTechnologies = SliceRemoveDuplicates(filefuzzTechnologies)
13381337
// 取差集合
13391338
filefuzzTechnologies = difference(filefuzzTechnologies, technologies)
1340-
util.Wg.Add(1)
13411339
poctechnologies2 = pocs_go.POCcheck(filefuzzTechnologies, ul, finalURL, true) //通过敏感文件扫描获取到的指纹进行检测gopoc check
13421340
Vullist = append(Vullist, poctechnologies2...)
13431341
for _, technology := range filefuzzTechnologies {

pkg/hydra/doNmapResult.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,14 @@ func DoParseXml(s string, bf *bytes.Buffer) {
125125
// 处理使用者自己扫描的结果
126126
func DoNmapWithFile(s string, bf *bytes.Buffer) bool {
127127
if strings.HasSuffix(strings.ToLower(s), ".xml") {
128-
util.Wg.Add(1)
129-
go func() {
130-
defer util.Wg.Done()
128+
util.DoSyncFunc(func() {
131129
b, err := ioutil.ReadFile(s)
132130
if nil == err && 0 < len(b) {
133131
DoParseXml(string(b), bf)
134132
} else {
135133
log.Println("DoNmapWithFile: ", err)
136134
}
137-
}()
135+
})
138136
return true
139137
}
140138
return false

pkg/naabu/v2/pkg/runner/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func (r *Runner) RunEnumeration() error {
225225
}
226226

227227
if r.options.Stream {
228-
go r.Load() //nolint
228+
r.Load() //nolint
229229
} else {
230230
err := r.Load()
231231
if err != nil {

pocs_go/go_poc_check.go

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@ import (
2727
"net/url"
2828
"os"
2929
"strings"
30-
"time"
3130
)
3231

3332
// 需优化:相同都目标,相同都检测只做一次
3433
func POCcheck(wappalyzertechnologies []string, URL string, finalURL string, checklog4j bool) []string {
35-
if nil != util.Wg {
36-
defer util.Wg.Done()
37-
}
3834
if util.TestRepeat(wappalyzertechnologies, URL, finalURL, checklog4j) {
3935
return []string{}
4036
}
@@ -271,39 +267,41 @@ func POCcheck(wappalyzertechnologies []string, URL string, finalURL string, chec
271267
}
272268

273269
func init() {
270+
if os.Getenv("NoPOC") == "true" {
271+
//close(util.PocCheck_pipe) // 这行会在 NoPOC该标志开启时,其他进程无法传递过来而出错
272+
return
273+
}
274274
util.RegInitFunc(func() {
275275
// 异步启动一个线程处理检测,避免
276-
util.Wg.Add(1)
277276
go func() {
278-
defer util.Wg.Done()
279-
nMax := 120 // 等xxx秒都没有消息进入就退出
280-
nCnt := 0
277+
//nMax := 120 // 等xxx秒都没有消息进入就退出
278+
//nCnt := 0
281279
for {
282280
select {
283281
case <-util.Ctx_global.Done():
282+
close(util.PocCheck_pipe)
284283
return
285284
case x1, ok := <-util.PocCheck_pipe:
286285
if nil == x1 || !ok {
287286
log.Println("go_poc_checkout is over")
288287
return
289288
}
290-
nCnt = 0
289+
//nCnt = 0
291290
log.Printf("<-lib.PocCheck_pipe: %+v %s", *x1.Wappalyzertechnologies, x1.URL)
292-
util.Wg.Add(1)
293-
go POCcheck(*x1.Wappalyzertechnologies, x1.URL, x1.FinalURL, x1.Checklog4j)
291+
util.DoSyncFunc(func() {
292+
func(x99 *util.PocCheck) {
293+
POCcheck(*x99.Wappalyzertechnologies, x99.URL, x99.FinalURL, x99.Checklog4j)
294+
}(x1)
295+
})
294296
default:
295-
if os.Getenv("NoPOC") == "true" {
296-
//close(util.PocCheck_pipe) // 这行会在 NoPOC该标志开启时,其他进程无法传递过来而出错
297-
return
298-
}
299-
var f01 float32 = float32(nCnt) / float32(nMax) * float32(100)
300-
fmt.Printf(" Asynchronous go PoCs detection task %%%0.2f ....\r", f01)
301-
<-time.After(time.Duration(1) * time.Second)
302-
nCnt += 1
303-
if nMax <= nCnt {
304-
close(util.PocCheck_pipe)
305-
return
306-
}
297+
//var f01 float32 = float32(nCnt) / float32(nMax) * float32(100)
298+
//fmt.Printf(" Asynchronous go PoCs detection task %%%0.2f ....\r", f01)
299+
//<-time.After(time.Duration(1) * time.Second)
300+
//nCnt += 1
301+
//if nMax <= nCnt {
302+
// close(util.PocCheck_pipe)
303+
// return
304+
//}
307305
}
308306
}
309307
}()

0 commit comments

Comments
 (0)