-
Notifications
You must be signed in to change notification settings - Fork 133
/
faviconScan.go
56 lines (53 loc) · 1.44 KB
/
faviconScan.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package plugin
import (
. "github.com/chainreactors/gogo/v2/pkg"
"github.com/chainreactors/logs"
"github.com/chainreactors/parsers"
"github.com/chainreactors/utils/encode"
)
// -v
// 信息收集插件,通过匹配http服务的favicon md5值判断CMS
func faviconScan(result *Result) {
var err error
conn := result.GetHttpConn(RunOpt.Delay)
url := result.GetURL() + "/favicon.ico"
resp, err := conn.Get(url)
if err != nil {
logs.Log.Debugf("request favicon %s %s", url, err.Error())
return
}
logs.Log.Debugf("request favicon %s %d", url, resp.StatusCode)
if resp.StatusCode == 200 {
body := parsers.ReadBody(resp)
md5h := encode.Md5Hash(body)
mmh3h := encode.Mmh3Hash32(body)
logs.Log.Debugf("%s favicon %s %s", url, md5h, mmh3h)
frame := FingerEngine.HashMatch(md5h, mmh3h)
if frame != nil {
result.AddFramework(frame)
return
}
}
if RunOpt.VersionLevel < 2 {
return
}
//sender := func(sendData string) ([]byte, bool) {
// conn := result.GetHttpConn(RunOpt.Delay)
// url := result.GetURL() + sendData
// logs.Log.Debugf("favicon active detect: %s", url)
// resp, err := conn.Get(url)
// if err == nil && resp.StatusCode == 200 {
// return parsers.ReadBody(resp), true
// } else {
// return nil, false
// }
//}
//for _, favicon := range ActiveFavicons {
// frame, ok := fingers.FaviconActiveMatch(favicon, RunOpt.VersionLevel, sender)
// if ok {
// result.AddFramework(frame)
// return
// }
//}
return
}