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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fingerprint_1 = require("./fingerprint");
const murmur_1 = require("./murmur");
const crypt_1 = require("./crypt");
const DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36";
let apiBreakers = {
v1: {
3: {
default: (c) => c,
method_1: (c) => ({ x: c.y, y: c.x }),
method_2: (c) => ({ x: c.x, y: (c.y + c.x) * c.x }),
method_3: (c) => ({ a: c.x, b: c.y }),
method_4: (c) => [c.x, c.y],
method_5: (c) => [c.y, c.x].map((v) => Math.sqrt(v)),
},
4: {
default: (c) => c
}
},
v2: {
3: {
value: {
alpha: (c) => ({ x: c.x, y: (c.y + c.x) * c.x, px: c.px, py: c.py }),
beta: (c) => ({ x: c.y, y: c.x, py: c.px, px: c.py }),
gamma: (c) => ({ x: c.y + 1, y: -c.x, px: c.px, py: c.py }),
delta: (c) => ({ x: c.y + 0.25, y: c.x + 0.5, px: c.px, py: c.py }),
epsilon: (c) => ({ x: c.x * 0.5, y: c.y * 5, px: c.px, py: c.py }),
zeta: (c) => ({ x: c.x + 1, y: c.y + 2, px: c.px, py: c.py }),
method_1: (c) => ({ x: c.x, y: c.y, px: c.px, py: c.py }),
method_2: (c) => ({ x: c.y, y: (c.y + c.x) * c.x, px: c.px, py: c.py }),
method_3: (c) => ({ x: Math.sqrt(c.x), y: Math.sqrt(c.y), px: c.px, py: c.py }),
},
key: {
alpha: (c) => [c.y, c.px, c.py, c.x],
beta: (c) => JSON.stringify({ x: c.x, y: c.y, px: c.px, py: c.py }),
gamma: (c) => [c.x, c.y, c.px, c.py].join(" "),
delta: (c) => [1, c.x, 2, c.y, 3, c.px, 4, c.py],
epsilon: (c) => ({ answer: { x: c.x, y: c.y, px: c.px, py: c.py } }),
zeta: (c) => [c.x, [c.y, [c.px, [c.py]]]],
method_1: (c) => ({ a: c.x, b: c.y, px: c.px, py: c.py }),
method_2: (c) => [c.x, c.y],
method_3: (c) => [c.y, c.x],
}
},
4: {
value: {
// @ts-ignore
alpha: (c) => ({ index: String(c.index) + 1 - 2 }),
beta: (c) => ({ index: -c.index }),
gamma: (c) => ({ index: 3 * (3 - c.index) }),
delta: (c) => ({ index: 7 * c.index }),
epsilon: (c) => ({ index: 2 * c.index }),
zeta: (c) => ({ index: c.index ? 100 / c.index : c.index }),
va: (c) => ({ index: c.index + 3 }),
vb: (c) => ({ index: -c.index }),
vc: (c) => ({ index: 10 - c.index }),
vd: (c) => ({ index: 3 * c.index }),
},
key: {
alpha: (c) => [Math.round(100 * Math.random()), c.index, Math.round(100 * Math.random())],
beta: (c) => ({ size: 50 - c.index, id: c.index, limit: 10 * c.index, req_timestamp: Date.now() }),
gamma: (c) => c.index,
delta: (c) => ({ index: c.index }),
epsilon: (c) => {
const arr = [];
const len = Math.round(5 * Math.random()) + 1;
const rand = Math.round(Math.random() * len);
for (let i = 0; i < len; i++) {
arr.push(i === rand ? c.index : Math.round(10 * Math.random()));
}
arr.push(rand);
return arr;
},
zeta: (c) => Array(Math.round(5 * Math.random()) + 1).concat(c.index),
ka: (c) => c.index,
kb: (c) => [c.index],
kc: (c) => ({ guess: c.index }),
}
}
}
};
function tileToLoc(tile) {
let xClick = (tile % 3) * 100 + (tile % 3) * 3 + 3 + 10 + Math.floor(Math.random() * 80);
let yClick = Math.floor(tile / 3) * 100 + Math.floor(tile / 3) * 3 + 3 + 10 + Math.floor(Math.random() * 80);
return {
x: xClick,
y: yClick,
px: xClick / 300,
py: yClick / 200,
};
}
function constructFormData(data) {
return Object.keys(data)
.filter((v) => data[v] !== undefined)
.map((k) => `${k}=${encodeURIComponent(data[k])}`)
.join("&");
}
function random() {
return Array(32)
.fill(0)
.map(() => "0123456789abcdef"[Math.floor(Math.random() * 16)])
.join("");
}
function getTimestamp() {
const time = (new Date()).getTime().toString();
const value = `${time.substring(0, 7)}00${time.substring(7, 13)}`;
return { cookie: `timestamp=${value};path=/;secure;samesite=none`, value };
}
function getBda(userAgent, opts) {
let fp = fingerprint_1.default.getFingerprint();
let fe = fingerprint_1.default.prepareFe(fp);
let bda = [
{ key: "api_type", value: "js" },
{ key: "p", value: 1 },
{ key: "f", value: (0, murmur_1.default)(fingerprint_1.default.prepareF(fingerprint_1.default), 31) },
{
key: "n",
value: Buffer.from(Math.round(Date.now() / (1000 - 0)).toString()).toString("base64"),
},
{ key: "wh", value: `${random()}|${random()}` },
{
"key": "enhanced_fp",
"value": fingerprint_1.default.getEnhancedFingerprint(fp, userAgent, opts)
},
{ key: "fe", value: fe },
{ key: "ife_hash", value: (0, murmur_1.default)(fe.join(", "), 38) },
{ key: "cs", value: 1 },
{
key: "jsbd",
value: JSON.stringify({
HL: 4,
DT: "",
NWD: "false",
DOTO: 1,
DMTO: 1,
}),
},
];
let time = new Date().getTime() / 1000;
let key = userAgent + Math.round(time - (time % 21600));
let s = JSON.stringify(bda);
let encrypted = crypt_1.default.encrypt(s, key);
return Buffer.from(encrypted).toString("base64");
}
function solveBreaker(v2, breaker = "default", gameType, value) {
if (!v2 && typeof breaker === "string")
return (apiBreakers.v1[gameType][breaker || "default"] || ((v) => v))(value);
if (typeof breaker !== "string") {
let b = apiBreakers.v2[gameType];
let v = breaker.value.reduce((acc, cur) => {
if (b.value[cur])
return b.value[cur](acc);
else
return cur;
}, value);
return b.key[breaker.key](v);
}
else {
return value;
}
}
exports.default = {
DEFAULT_USER_AGENT,
tileToLoc,
constructFormData,
getBda,
apiBreakers,
getTimestamp,
random,
solveBreaker
};
|