Skip to content

Commit 5e405f6

Browse files
committed
fix 指纹识别的问题 #107 2022-09-08
1 parent d76d87c commit 5e405f6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/fingerprint/fgConst.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func MergeReqUrl() {
6060
LoadWebfingerprintEhole()
6161
x1 := GetWebfingerprintEhole()
6262
// 测试的时候下面代码才打开
63-
if "true" == util.GetValByDefault("MyDebug", "false") {
63+
if true || "true" == util.GetValByDefault("MyDebug", "false") {
6464
x1.Fingerprint = []*Fingerprint{}
6565
localFinger = "{}"
6666
log.Println("MyDebug")
@@ -87,6 +87,9 @@ func MergeReqUrl() {
8787
y := y1.(map[string]interface{})
8888
// url 去重复 start
8989
szUrl := Get4K(&y, "url")
90+
if szUrl == "/" || szUrl == "/favicon.ico" {
91+
continue
92+
}
9093
//log.Println("[", szUrl, "]")
9194
if _, ok := oUrl[szUrl]; !ok {
9295
oUrl[szUrl] = struct{}{}
@@ -123,7 +126,7 @@ func MergeReqUrl() {
123126
if nil == err {
124127
eHoleFinger = string(data)
125128
}
126-
FgUrls = urls
129+
FgUrls = append([]string{"/", "/favicon.ico"}, urls...)
127130
}
128131

129132
var FgDictFile string
@@ -136,18 +139,19 @@ func DelTmpFgFile() {
136139

137140
// 这里可以动态加载远程的url指纹数据到 FgData
138141
func init() {
142+
FgData = util.GetVal4File("FgData", FgData)
139143
json.Unmarshal([]byte(FgData), &FGDataMap)
140144
var aN []map[string]interface{}
141145
for _, x := range FGDataMap {
142-
if bD, ok := x["delete"]; ok && false == bD.(bool) {
146+
if bD, ok := x["delete"]; !ok || false == bD.(bool) {
143147
aN = append(aN, x)
144148
}
145149
}
146150
FGDataMap = aN
147151
MergeReqUrl()
148152
var err error
149153
tempInput1, err = ioutil.TempFile("", "dict-in-*")
150-
if nil == err && "" != tempInput1.Name() {
154+
if nil == err {
151155
ioutil.WriteFile(tempInput1.Name(), []byte(strings.Join(FgUrls, "\n")), 0644)
152156
FgDictFile = tempInput1.Name()
153157
} else {

0 commit comments

Comments
 (0)