Skip to content

Commit efbefc6

Browse files
committed
add dnsx;1、fuzz、及所有请求输出限制为800k,避免被反制、进行内存攻击导致程序崩溃
2、修复naabu、nmap扫描后使用ip继续走后续流程,导致无法正确访问目标的bug,https通常是限定只能域名访问的 2022-10-11
1 parent 181848a commit efbefc6

File tree

30 files changed

+105385
-99
lines changed

30 files changed

+105385
-99
lines changed

br.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
go build -o scan4all main.go
2-
./scan4all -host http://192.168.0.109 -o xxx.csv -v
2+
./scan4all -host https://www.sina.com.cn/ -o xxx.csv -v
33

brute/filefuzz.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func init() {
140140
util.SendEngineLog(evt, Const.ScanType_WebDirScan, filePaths, fileFuzzTechnologies)
141141
})
142142

143+
// 注册一个
143144
})
144145
}
145146

@@ -208,7 +209,7 @@ func FileFuzz(u string, indexStatusCode int, indexContentLength int, indexbody s
208209
var async_data = make(chan *FuzzData, util.Fuzzthreads*2)
209210
var async_technologies = make(chan []string, util.Fuzzthreads*2)
210211
// 字典长度的 30% 的错误
211-
var MaxErrorTimes int32 = int32(float32(len(filedic)) * 0.3)
212+
var MaxErrorTimes int32 = int32(util.GetValAsInt("MaxErrorTimes", 50)) //int32(float32(len(filedic)) * 0.005)
212213
if strings.HasPrefix(url404req.Protocol, "HTTP/2") || strings.HasPrefix(url404req.Protocol, "HTTP/3") {
213214
MaxErrorTimes = int32(len(filedic))
214215
}
@@ -228,7 +229,10 @@ func FileFuzz(u string, indexStatusCode int, indexContentLength int, indexbody s
228229
case <-ctx2.Done():
229230
return
230231
case <-t001.C:
231-
fmt.Printf("(ok/total:%5d/%5d) (errs/limitErr:%3d/%3d) %s\r", nCnt, len(filedic), errorTimes, MaxErrorTimes, u)
232+
fmt.Printf("file fuzz(ok/total:%5d/%5d) (errs/limitErr:%3d/%3d) %s\r", nCnt, len(filedic), errorTimes, MaxErrorTimes, u)
233+
if errorTimes >= MaxErrorTimes {
234+
stop()
235+
}
232236
case x1, ok := <-async_data:
233237
if ok {
234238
if lst200 == nil || x1.Req.Resqonse.Body != lst200.Body {
@@ -293,11 +297,6 @@ func FileFuzz(u string, indexStatusCode int, indexContentLength int, indexbody s
293297
szUrl = u + payload[1:]
294298
}
295299
//log.Printf("start fuzz: [%s]", szUrl)
296-
client := util.GetClient(szUrl)
297-
if nil != client {
298-
client.ErrCount = 0
299-
client.ErrLimit = 999999
300-
}
301300
if fuzzPage, req, err := reqPage(szUrl); err == nil && nil != req && 0 < len(req.Body) {
302301
if 200 == req.StatusCode {
303302
if nil == lst200 {

brute/fuzzAI.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func StudyErrPageAI(req *util.Response, page *util.Page, fingerprintsTag string)
8686
}
8787
// 学些匹配,不重复再记录
8888
if bRst, _ := CheckRepeat(data); !bRst {
89-
util.Create[ErrPage](data)
89+
util.Create[ErrPage](*data)
9090
}
9191
}
9292
})
@@ -125,7 +125,7 @@ func CheckIsErrPageAI(req *util.Response, page *util.Page) bool {
125125
for _, x := range page404Title {
126126
// 异常页面标题检测成功
127127
if 0 < len(data.Title) && (util.StrContains(x, data.Title) || util.StrContains(data.Title, x)) || 0 < len(data.Body) && util.StrContains(data.Body, x) {
128-
util.Create[ErrPage](data)
128+
util.Create[ErrPage](*data)
129129
return true
130130
}
131131
u01, err := url.Parse(strings.TrimSpace(*page.Url))

config/config.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"LimitReader": 819200,
23
"OnClient": true,
34
"ScanPoolSize":5000,
45
"JndiAddress": "https://rcejndi.51pwn.com",
@@ -64,10 +65,10 @@
6465
"HydraUser": "",
6566
"HydraPass": "",
6667
"UrlPrecise": true,
67-
"ParseSSl": true,
68-
"EnableSubfinder": true,
68+
"ParseSSl": false,
69+
"EnableSubfinder": false,
6970
"EnableHoneyportDetection": true,
70-
"EnableKsubdomain": true,
71+
"EnableKsubdomain": false,
7172
"KsubdomainRegxp": "([0-9a-zA-Z\\-]+\\.[0-9a-zA-Z\\-]+)$",
7273
"naabu_dns": {},
7374
"naabu": {"TopPorts": "1000","ScanAllIPS": true,"Threads": 50,"EnableProgressBar": false},
@@ -79,6 +80,7 @@
7980
"Severities": [5,4,3],
8081
"RateLimit": 150,
8182
"ExcludeTags": ["fuzz"],
83+
"ExcludedTemplates": ["config/nuclei-templates/token-spray"],
8284
"BulkSize":64,
8385
"TemplateThreads": 64,
8486
"HeadlessBulkSize": 10,

0 commit comments

Comments
 (0)