|
9 | 9 | "github.com/hktalent/goSqlite_gorm/lib/scan/Const" |
10 | 10 | "github.com/hktalent/goSqlite_gorm/pkg/models" |
11 | 11 | "log" |
| 12 | + "mime" |
12 | 13 | "net/url" |
| 14 | + "path/filepath" |
13 | 15 | "regexp" |
14 | 16 | "strings" |
15 | 17 | "sync" |
@@ -158,6 +160,8 @@ type FuzzData struct { |
158 | 160 | Req *util.Page |
159 | 161 | } |
160 | 162 |
|
| 163 | +var r001 = regexp.MustCompile(`\.(aac)|(abw)|(arc)|(avif)|(avi)|(azw)|(bin)|(bmp)|(bz)|(bz2)|(cda)|(csh)|(css)|(csv)|(doc)|(docx)|(eot)|(epub)|(gz)|(gif)|(ico)|(ics)|(jar)|(jpeg)|(jpg)|(js)|(json)|(jsonld)|(mid)|(midi)|(mjs)|(mp3)|(mp4)|(mpeg)|(mpkg)|(odp)|(ods)|(odt)|(oga)|(ogv)|(ogx)|(opus)|(otf)|(png)|(pdf)|(php)|(ppt)|(pptx)|(rar)|(rtf)|(sh)|(svg)|(tar)|(tif)|(tiff)|(ts)|(ttf)|(txt)|(vsd)|(wav)|(weba)|(webm)|(webp)|(woff)|(woff2)|(xhtml)|(xls)|(xlsx)|(xml)|(xul)|(zip)|(3gp)|(3g2)|(7z)$`) |
| 164 | + |
161 | 165 | // 重写了fuzz:优化流程、优化算法、修复线程安全bug、增加智能功能 |
162 | 166 | // 两次 ioutil.ReadAll(resp.Body),第二次就会 Read返回EOF error |
163 | 167 | func FileFuzz(u string, indexStatusCode int, indexContentLength int, indexbody string) ([]string, []string) { |
@@ -213,6 +217,9 @@ func FileFuzz(u string, indexStatusCode int, indexContentLength int, indexbody s |
213 | 217 | if strings.HasPrefix(url404req.Protocol, "HTTP/2") || strings.HasPrefix(url404req.Protocol, "HTTP/3") { |
214 | 218 | MaxErrorTimes = int32(len(filedic)) |
215 | 219 | } |
| 220 | + if c1 := util.GetClient(u, map[string]interface{}{"Timeout": 15 * time.Second, "ErrLimit": MaxErrorTimes}); nil != c1 { |
| 221 | + util.PutClientCc(u, c1) |
| 222 | + } |
216 | 223 | //defer func() { |
217 | 224 | // close(ch) |
218 | 225 | // close(async_data) |
@@ -304,6 +311,18 @@ func FileFuzz(u string, indexStatusCode int, indexContentLength int, indexbody s |
304 | 311 | } else if lst200.Body == req.Body { // 无意义的 200 |
305 | 312 | continue |
306 | 313 | } |
| 314 | + if oU1, err := url.Parse(szUrl); nil == err { |
| 315 | + a50 := r001.FindStringSubmatch(oU1.Path) |
| 316 | + if 0 < len(a50) { |
| 317 | + s2 := mime.TypeByExtension(filepath.Ext(a50[0])) |
| 318 | + ct := (*req).Header.Get("Content-Type") |
| 319 | + if "" != ct && "" != s2 && strings.Contains(ct, s2) { |
| 320 | + continue |
| 321 | + } |
| 322 | + } |
| 323 | + } |
| 324 | + |
| 325 | + mime.TypeByExtension(".jpg") |
307 | 326 | //log.Printf("%d : %s \n", req.StatusCode, szUrl) |
308 | 327 | } |
309 | 328 | go util.CheckHeader(req.Header, u) |
|
0 commit comments