forked from flyingpot/funcaptcha
-
Notifications
You must be signed in to change notification settings - Fork 18
/
fingerprint.go
63 lines (56 loc) · 1.24 KB
/
fingerprint.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
57
58
59
60
61
62
63
package funcaptcha
import (
"encoding/base64"
"encoding/json"
"fmt"
"strings"
"time"
)
func getF() string {
var res []string
for _, val := range fe {
for _, v := range val {
res = append(res, fmt.Sprintf("%v", v))
}
}
return getMurmur128String(strings.Join(res, "~~~"), 31)
}
func getN() string {
timestamp := fmt.Sprintf("%d", time.Now().UnixNano()/1000000000)
return base64.StdEncoding.EncodeToString([]byte(timestamp))
}
func getWh() string {
return fmt.Sprintf("%s|%s", getWindowHash(), getWindowProtoChainHash())
}
func getFe() string {
fe, _ := json.Marshal(getFeList())
return string(fe)
}
func getFeList() []string {
// var b6 = [];
var feList []string
for _, feMap := range fe {
for k, v := range feMap {
if k == "S" ||
k == "AS" ||
k == "JSF" ||
k == "T" {
v = strings.ReplaceAll(v.(string), ";", ",")
} else if k == "CFP" { // case dH(f_a_iI.X):
v = getCFPHash(cfp)
} else if k == "P" { // case 'P':
v = getP(p)
}
feList = append(feList, fmt.Sprintf("%v:%v", k, v))
}
}
return feList
}
func getP(p string) string {
var pList []string
for _, s := range strings.Split(p, ";") {
split := strings.Split(s, "::")
pList = append(pList, split[0])
}
return strings.Join(pList, ",")
}