大神论坛

找回密码
快速注册
查看: 629 | 回复: 0

[原创] appleid 爬虫之 - X-APPLE-HC/X-Apple-I-FD-Client-Info 算法 实现

主题

帖子

0

积分

初入江湖

UID
583
积分
0
精华
威望
0 点
违规
大神币
68 枚
注册时间
2023-09-16 15:07
发表于 2023-10-14 16:30
本帖最后由 wa_j 于 2023-10-14 16:30 编辑

前端时间帮朋友搞了个 appleid 自动注册的脚本,
有俩个需要逆向的参数, 这里给大家分享出来

时间紧迫, 过程我就 忽略了, 只贴结果.

X-APPLE-HC

hashcash 是一个有趣的算法, 根据给定的 bit 位, 循环计算 hash , 直到 二进制下的 前 bit 位 都为 0,从而得到 counter , 返回结果.

要求的 bit 越长,计算的时间就越长.

'X-APPLE-HC': '1:12:20231006073858:c0684bd8bf7b40b08559dd9970aba269::5126',
def calculate_hc(version, bits, date, challenge):
counter = 0
while True:
hc = ":".join([str(version), str(bits), str(date), challenge, f":{counter}"])
hashed_hc = hashlib.sha1(hc.encode()).digest()
binary_hc = bin(int.from_bytes(hashed_hc, 'big'))[2:].zfill(len(hashed_hc) * 8)
if binary_hc[:bits] == '0' * bits:
return hc
counter += 1

print(calculate_hc(version, bits, date, challenge))
解释一下逻辑:

version = 1; # 版本号,一般固定
bits = 10; # bit 位数,页面上可以取到,一般为 10-12
date = '20230929145813'; # 时间
ext = ''; # 额外数据,可空
challenge = '026dc2cf95c934a0de466fb84765ff75'; # 页面上可以取到

result = {version}:{bits}:{date}:{challenge}:{ext}:{counter}
counter 从 0 开始递增循环, 直到 result 经过 sha1 之后转二进制, 前 {bits} 位 都为0, 则返回计算结果
eg: '1:11:20230828054038:ec0f5c7d49d74fc5f0edf5cb0b0960ff::4824'

X-Apple-I-FD-Client-Info

这个东西看着像是浏览器的指纹信息, 运算过程依赖浏览器的 ua信息, 以及 插件信息等.  实现 依赖 .js 文件, 走页面上把相关 js 抽出来, 可以直接用 浏览器运算,
也可以用 python 的 js 解析库来运算,如果用 python 解析等话, 需要声明下 window/navigator 这俩对象,eg:

'X-Apple-I-FD-Client-Info': '{
"U":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0",
"L":"en-US",
"Z":"GMT+00:00",
"V":"1.1",
"F":"Fla44j1e3NlY5BNlY5BSmHACVZXnN92g.ogjOENVPv.2dI_AIQjvEodUW2vqBBNmkaikkL3s0mcK8rU9zIpUauz3Y25BNlY5cklY5BqNAE.lTjV.CyL"
}',
e = {
exports: {},
i: 788,
l: false,
}
t = {}

console.log(window)
console.log(navigator)

var tmp = {
"U": navigator.userAgent,
"L": navigator.language,
"Z": "GMT+08:00",
"V": "1.1",
}

function get_tmp() {
return JSON.stringify(tmp)
}
function get_data(e) {
var t, n = {};
if (n.U = tmp.U,
n.L = tmp.L ? tmp.L : tmp.L ? tmp.L : "",
"number" != typeof (t = (new Date).getTimezoneOffset()) || null === t)
t = "";
else {
var r = Math.abs(parseInt(t / 60, 10))
, a = Math.abs(t % 60);
t = "GMT" + (0 < t ? "-" : "+") + (10 > r ? "0" + r : r) + ":" + (10 > a ? "0" + a : a)
}
t = tmp.Z
return n.Z = t,
n.V = "1.1",
null != e && (n.F = e),
JSON.stringify(n)
}

function n(e) {
try {
if (navigator.plugins && navigator.plugins.length)
for (var t = 0; t < navigator.plugins.length; t++) {
var n = navigator.plugins[t];
if (n.name.indexOf(e) >= 0)
return n.name + (n.description ? "|" + n.description : "")
}
} catch (e) {
}
return ""
}

function r(e) {
try {
debugger
if (!e)
return a();
var t;
e: {
var n;
try {
n = document.getElementById(e)
} catch (e) {
}
if (null == n)
try {
n = document.getElementsByName(e)[0]
} catch (e) {
}
if (null == n)
for (var r = 0; r < document.forms.length; r++)
for (var i = document.forms[r], o = 0; o < i.elements.length; o++) {
var s = i[o];
if (s.name === e || s.id === e) {
t = s;
break e
}
}
t = n
}
if (null !== t)
try {
t.value = a()
} catch (e) {
t.value = escape(e.message)
}
} catch (e) {
}
}

function a(e) {
var t = new Date,
r = new Date,
a = [l("TF1"), l("020"), function () {
return ScriptEngineMajorVersion()
}
,
function () {
return ScriptEngineMinorVersion()
}
,
function () {
return ScriptEngineBuildVersion()
}
,
function () {
return c("{7790769C-0471-11D2-AF11-00C04FA35D02}")
}
,
function () {
return c("{89820200-ECBD-11CF-8B85-00AA005B4340}")
}
,
function () {
return c("{283807B5-2C60-11D0-A31D-00AA00B92C03}")
}
,
function () {
return c("{4F216970-C90C-11D1-B5C7-0000F8051515}")
}
,
function () {
return c("{44BBA848-CC51-11CF-AAFA-00AA00B6015C}")
}
,
function () {
return c("{9381D8F2-0288-11D0-9501-00AA00B911A5}")
}
,
function () {
return c("{4F216970-C90C-11D1-B5C7-0000F8051515}")
}
,
function () {
return c("{5A8D6EE0-3E18-11D0-821E-444553540000}")
}
,
function () {
return c("{89820200-ECBD-11CF-8B85-00AA005B4383}")
}
,
function () {
return c("{08B0E5C0-4FCB-11CF-AAA5-00401C608555}")
}
,
function () {
return c("{45EA75A0-A269-11D1-B5BF-0000F8051515}")
}
,
function () {
return c("{DE5AED00-A4BF-11D1-9948-00C04F98BBC9}")
}
,
function () {
return c("{22D6F312-B0F6-11D0-94AB-0080C74C7E95}")
}
,
function () {
return c("{44BBA842-CC51-11CF-AAFA-00AA00B6015B}")
}
,
function () {
return c("{3AF36230-A269-11D1-B5BF-0000F8051515}")
}
,
function () {
return c("{44BBA840-CC51-11CF-AAFA-00AA00B6015C}")
}
,
function () {
return c("{CC2A9BA0-3BDD-11D0-821E-444553540000}")
}
,
function () {
return c("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}")
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return s(["navigator.productSub", "navigator.appMinorVersion"])
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return s(["navigator.oscpu", "navigator.cpuClass"])
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return s(["navigator.language", "navigator.userLanguage"])
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return 0 !== Math.abs(h - v)
}
,
function () {
return o(t)
}
,
function () {
return "@UTC@"
}
,
function () {
var e = 0;
return e = 0,
o(t) && (e = Math.abs(h - v)),
-(t.getTimezoneOffset() + e) / 60
}
,
function () {
return new Date(2005, 5, 7, 21, 33, 44, 888).toLocaleString()
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return m.Acrobat
}
,
function () {
return m.Flash
}
,
function () {
return m.QuickTime
}
,
function () {
return m["Java Plug-in"]
}
,
function () {
return m.Director
}
,
function () {
return m.Office
}
,
function () {
return "@CT@"
}
,
function () {
return h
}
,
function () {
return v
}
,
function () {
return t.toLocaleString()
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return n("Acrobat")
}
,
function () {
return n("Adobe SVG")
}
,
function () {
return n("Authorware")
}
,
function () {
return n("Citrix ICA")
}
,
function () {
return n("Director")
}
,
function () {
return n("Flash")
}
,
function () {
return n("MapGuide")
}
,
function () {
return n("MetaStream")
}
,
function () {
return n("PDFViewer")
}
,
function () {
return n("QuickTime")
}
,
function () {
return n("RealOne")
}
,
function () {
return n("RealPlayer Enterprise")
}
,
function () {
return n("RealPlayer Plugin")
}
,
function () {
return n("Seagate Software Report")
}
,
function () {
return n("Silverlight")
}
,
function () {
return n("Windows Media")
}
,
function () {
return n("iPIX")
}
,
function () {
return n("nppdf.so")
}
,
function () {
var e = document.createElement("span");
e.innerHTML = " ",
e.style.position = "absolute",
e.style.left = "-9999px",
document.body.appendChild(e);
var t = e.offsetHeight;
return document.body.removeChild(e),
t
}
,
g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(),
function () {
return "5.6.1-0"
}
,
g()];
!function () {
for (var e = ["Acrobat", "Flash", "QuickTime", "Java Plug-in", "Director",
"Office"], t = 0; t < e.length; t++) {
var n = e[t],
r = m,
a = n,
i = n;
n = "";
try {
if (navigator.plugins && navigator.plugins.length) {
var o = RegExp(i + ".* ([0-9._]+)");
for (i = 0; i < navigator.plugins.length; i++) {
var s = o.exec(navigator.plugins[i].name);
null === s && (s = o.exec(navigator.plugins[i].description)),
s && (n = s[1])
}
} else if (window.ActiveXObject && y[i])
try {
var c = new ActiveXObject(y[i][0]);
n = y[i][1](c)
} catch (e) {
n = ""
}
} catch (e) {
n = e.message
}
r[a] = n
}
}();
for (var u = "", f = 0; f < a.length; f++) {
var b;
e && (u += i(a[f].toString(), '"', "'", !0),
u += "=");
try {
b = a[f](this)
} catch (e) {
b = ""
}
u += e ? b : escape(b),
u += ";",
e && (u += "\\n")
}
return u = i(u, escape("@UTC@"), (new Date).getTime()),
u = i(u, escape("@CT@"), (new Date).getTime() - r.getTime()),
p && d ? d(u) : u
}

function i(e, t, n, r) {
"boolean" != typeof r && (r = !1);
for (var a, i = !0;
(a = e.indexOf(t)) >= 0 && (r || i);)
e = e.substr(0, a) + n + e.substr(a + t.length),
i = !1;
return e
}

function o(e) {
var t = Math.min(h, v);
return 0 !== Math.abs(h - v) && e.getTimezoneOffset() === t
}

function s(e) {
for (var t = 0; t < e.length; t++)
try {
var n = (e[t],
"");
if (n)
return n
} catch (e) {
}
return ""
}

function c(e) {
var t = "";
try {
void 0 !== f.a.getComponentVersion && (t = f.a.getComponentVersion(e,
"ComponentID"))
} catch (n) {
e = (e = n.message.length) > 40 ? 40 : e,
t = escape(n.message.substr(0, e))
}
return t
}

function l(e) {
return function () {
return e
}
}

function u(e) {
function t(e) {
for (r = r << e[0] | e[1],
a += e[0]; a >= 6;)
e = r >> a - 6 & 63,
n += x.substring(e, e + 1),
r ^= e << (a -= 6)
}

var n = "",
r = 0,
a = 0;
t([6, (7 & e.length) << 3 | 0]),
t([6, 56 & e.length | 1]);
for (var i = 0; i < e.length; i++) {
if (null == b[e.charCodeAt(i)])
return;
t(b[e.charCodeAt(i)])
}
return t(b[0]),
a > 0 && t([6 - a, 0]),
n
}

function d(e) {
for (var t = u, n = e, r = 0; w[r]; r++)
n = n.split(w[r]).join(String.fromCharCode(r + 1));
if (null == (t = t(n)))
return e;
for (n = 65535,
r = 0; r < e.length; r++)
n = 65535 & (n >>> 8 | n << 8),
n ^= 255 & e.charCodeAt(r),
n ^= (255 & n) >> 4,
n ^= n << 12 & 65535,
n ^= (255 & n) << 5 & 65535;
return n &= 65535,
e = "",
e += x.charAt(n >>> 12),
e += x.charAt(n >>> 6 & 63),
t += e += x.charAt(63 & n)
}

t = (e = t || {}).ctx || window;
var p = !e.hasOwnProperty("compress") || e.compress,
f = {},
h = new Date(2005, 0, 15).getTimezoneOffset(),
v = new Date(2005, 6, 15).getTimezoneOffset(),
m = [],
g = l(""),
y = {
Flash: ["ShockwaveFlash.ShockwaveFlash", function (e) {
return e.getVariable("$version")
}
],
Director: ["SWCtl.SWCtl", function (e) {
return e.ShockwaveVersion("")
}
]
};
try {
f.a = document.createElement("span"),
void 0 !== f.a.addBehavior && f.a.addBehavior("#default#clientCaps")
} catch (e) {
}
m = {};
var b = {
1: [4, 15],
110: [8, 239],
74: [8, 238],
57: [7, 118],
56: [7, 117],
71: [8, 233],
25: [8, 232],
101: [5, 28],
104: [7, 111],
4: [7, 110],
105: [6, 54],
5: [7, 107],
109: [7, 106],
103: [9, 423],
82: [9, 422],
26: [8, 210],
6: [7, 104],
46: [6, 51],
97: [6, 50],
111: [6, 49],
7: [7, 97],
45: [7, 96],
59: [5, 23],
15: [7, 91],
11: [8, 181],
72: [8, 180],
27: [8, 179],
28: [8, 178],
16: [7, 88],
88: [10, 703],
113: [11, 1405],
89: [12, 2809],
107: [13, 5617],
90: [14, 11233],
42: [15, 22465],
64: [16, 44929],
0: [16, 44928],
81: [9, 350],
29: [8, 174],
118: [8, 173],
30: [8, 172],
98: [8, 171],
12: [8, 170],
99: [7, 84],
117: [6, 41],
112: [6, 40],
102: [9, 319],
68: [9, 318],
31: [8, 158],
100: [7, 78],
84: [6, 38],
55: [6, 37],
17: [7, 73],
8: [7, 72],
9: [7, 71],
77: [7, 70],
18: [7, 69],
65: [7, 68],
48: [6, 33],
116: [6, 32],
10: [7, 63],
121: [8, 125],
78: [8, 124],
80: [7, 61],
69: [7, 60],
119: [7, 59],
13: [8, 117],
79: [8, 116],
19: [7, 57],
67: [7, 56],
114: [6, 27],
83: [6, 26],
115: [6, 25],
14: [6, 24],
122: [8, 95],
95: [8, 94],
76: [7, 46],
24: [7, 45],
37: [7, 44],
50: [5, 10],
51: [5, 9],
108: [6, 17],
22: [7, 33],
120: [8, 65],
66: [8, 64],
21: [7, 31],
106: [7, 30],
47: [6, 14],
53: [5, 6],
49: [5, 5],
86: [8, 39],
85: [8, 38],
23: [7, 18],
75: [7, 17],
20: [7, 16],
2: [5, 3],
73: [8, 23],
43: [9, 45],
87: [9, 44],
70: [7, 10],
3: [6, 4],
52: [5, 1],
54: [5, 0]
},
w = ["%20", ";;;", "%3B", "%2C", "und", "fin", "ed;", "%28", "%29", "%3A",
"/53", "ike", "Web", "0;", ".0", "e;", "on", "il", "ck", "01", "in", "Mo",
"fa", "00", "32", "la", ".1", "ri", "it", "%u", "le"],
x = ".0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
f.appidmsform = r,
f.f1b5 = d,
t.appidmsparm = f,
p && (t = navigator.userAgent.toLowerCase(),
"Gecko" === navigator.product && parseInt(t.substring(t.indexOf("rv:") + 3,
t.indexOf(")", t.indexOf("rv:") + 3)).split(".")[0]) <= 2 && r())

function dev(e, t) {
(function () {
var e = !1;
!function (t) {
function n(e) {
try {
if (navigator.plugins && navigator.plugins.length)
for (var t = 0; t < navigator.plugins.length; t++) {
var n = navigator.plugins[t];
if (n.name.indexOf(e) >= 0)
return n.name + (n.description ? "|" + n.description : "")
}
} catch (e) {
}
return ""
}

function r(e) {
try {
if (!e)
return a();
var t;
e: {
var n;
try {
n = document.getElementById(e)
} catch (e) {
}
if (null == n)
try {
n = document.getElementsByName(e)[0]
} catch (e) {
}
if (null == n)
for (var r = 0; r < document.forms.length; r++)
for (var i = document.forms[r], o = 0; o < i.elements.length; o++) {
var s = i[o];
if (s.name === e || s.id === e) {
t = s;
break e
}
}
t = n
}
if (null !== t)
try {
t.value = a()
} catch (e) {
t.value = escape(e.message)
}
} catch (e) {
}
}

function a(e) {
var t = new Date,
r = new Date,
a = [l("TF1"), l("020"), function () {
return ScriptEngineMajorVersion()
}
,
function () {
return ScriptEngineMinorVersion()
}
,
function () {
return ScriptEngineBuildVersion()
}
,
function () {
return c("{7790769C-0471-11D2-AF11-00C04FA35D02}")
}
,
function () {
return c("{89820200-ECBD-11CF-8B85-00AA005B4340}")
}
,
function () {
return c("{283807B5-2C60-11D0-A31D-00AA00B92C03}")
}
,
function () {
return c("{4F216970-C90C-11D1-B5C7-0000F8051515}")
}
,
function () {
return c("{44BBA848-CC51-11CF-AAFA-00AA00B6015C}")
}
,
function () {
return c("{9381D8F2-0288-11D0-9501-00AA00B911A5}")
}
,
function () {
return c("{4F216970-C90C-11D1-B5C7-0000F8051515}")
}
,
function () {
return c("{5A8D6EE0-3E18-11D0-821E-444553540000}")
}
,
function () {
return c("{89820200-ECBD-11CF-8B85-00AA005B4383}")
}
,
function () {
return c("{08B0E5C0-4FCB-11CF-AAA5-00401C608555}")
}
,
function () {
return c("{45EA75A0-A269-11D1-B5BF-0000F8051515}")
}
,
function () {
return c("{DE5AED00-A4BF-11D1-9948-00C04F98BBC9}")
}
,
function () {
return c("{22D6F312-B0F6-11D0-94AB-0080C74C7E95}")
}
,
function () {
return c("{44BBA842-CC51-11CF-AAFA-00AA00B6015B}")
}
,
function () {
return c("{3AF36230-A269-11D1-B5BF-0000F8051515}")
}
,
function () {
return c("{44BBA840-CC51-11CF-AAFA-00AA00B6015C}")
}
,
function () {
return c("{CC2A9BA0-3BDD-11D0-821E-444553540000}")
}
,
function () {
return c("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}")
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return s(["navigator.productSub", "navigator.appMinorVersion"])
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return s(["navigator.oscpu", "navigator.cpuClass"])
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return s(["navigator.language", "navigator.userLanguage"])
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return 0 !== Math.abs(h - v)
}
,
function () {
return o(t)
}
,
function () {
return "@UTC@"
}
,
function () {
var e = 0;
return e = 0,
o(t) && (e = Math.abs(h - v)),
-(t.getTimezoneOffset() + e) / 60
}
,
function () {
return new Date(2005, 5, 7, 21, 33, 44, 888).toLocaleString()
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return m.Acrobat
}
,
function () {
return m.Flash
}
,
function () {
return m.QuickTime
}
,
function () {
return m["Java Plug-in"]
}
,
function () {
return m.Director
}
,
function () {
return m.Office
}
,
function () {
return "@CT@"
}
,
function () {
return h
}
,
function () {
return v
}
,
function () {
return t.toLocaleString()
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return ""
}
,
function () {
return n("Acrobat")
}
,
function () {
return n("Adobe SVG")
}
,
function () {
return n("Authorware")
}
,
function () {
return n("Citrix ICA")
}
,
function () {
return n("Director")
}
,
function () {
return n("Flash")
}
,
function () {
return n("MapGuide")
}
,
function () {
return n("MetaStream")
}
,
function () {
return n("PDFViewer")
}
,
function () {
return n("QuickTime")
}
,
function () {
return n("RealOne")
}
,
function () {
return n("RealPlayer Enterprise")
}
,
function () {
return n("RealPlayer Plugin")
}
,
function () {
return n("Seagate Software Report")
}
,
function () {
return n("Silverlight")
}
,
function () {
return n("Windows Media")
}
,
function () {
return n("iPIX")
}
,
function () {
return n("nppdf.so")
}
,
function () {
var e = document.createElement("span");
e.innerHTML = " ",
e.style.position = "absolute",
e.style.left = "-9999px",
document.body.appendChild(e);
var t = e.offsetHeight;
return document.body.removeChild(e),
t
}
,
g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(), g(),
function () {
return "5.6.1-0"
}
,
g()];
!function () {
for (var e = ["Acrobat", "Flash", "QuickTime", "Java Plug-in", "Director",
"Office"], t = 0; t < e.length; t++) {
var n = e[t],
r = m,
a = n,
i = n;
n = "";
try {
if (navigator.plugins && navigator.plugins.length) {
var o = RegExp(i + ".* ([0-9._]+)");
for (i = 0; i < navigator.plugins.length; i++) {
var s = o.exec(navigator.plugins[i].name);
null === s && (s = o.exec(navigator.plugins[i].description)),
s && (n = s[1])
}
} else if (window.ActiveXObject && y[i])
try {
var c = new ActiveXObject(y[i][0]);
n = y[i][1](c)
} catch (e) {
n = ""
}
} catch (e) {
n = e.message
}
r[a] = n
}
}();
for (var u = "", f = 0; f < a.length; f++) {
var b;
e && (u += i(a[f].toString(), '"', "'", !0),
u += "=");
try {
b = a[f](this)
} catch (e) {
b = ""
}
u += e ? b : escape(b),
u += ";",
e && (u += "\\n")
}
return u = i(u, escape("@UTC@"), (new Date).getTime()),
u = i(u, escape("@CT@"), (new Date).getTime() - r.getTime()),
p && d ? d(u) : u
}

function i(e, t, n, r) {
"boolean" != typeof r && (r = !1);
for (var a, i = !0;
(a = e.indexOf(t)) >= 0 && (r || i);)
e = e.substr(0, a) + n + e.substr(a + t.length),
i = !1;
return e
}

function o(e) {
var t = Math.min(h, v);
return 0 !== Math.abs(h - v) && e.getTimezoneOffset() === t
}

function s(e) {
for (var t = 0; t < e.length; t++)
try {
var n = (e[t],
"");
if (n)
return n
} catch (e) {
}
return ""
}

function c(e) {
var t = "";
try {
void 0 !== f.a.getComponentVersion && (t = f.a.getComponentVersion(e,
"ComponentID"))
} catch (n) {
e = (e = n.message.length) > 40 ? 40 : e,
t = escape(n.message.substr(0, e))
}
return t
}

function l(e) {
return function () {
return e
}
}

function u(e) {
function t(e) {
for (r = r << e[0] | e[1],
a += e[0]; a >= 6;)
e = r >> a - 6 & 63,
n += x.substring(e, e + 1),
r ^= e << (a -= 6)
}

var n = "",
r = 0,
a = 0;
t([6, (7 & e.length) << 3 | 0]),
t([6, 56 & e.length | 1]);
for (var i = 0; i < e.length; i++) {
if (null == b[e.charCodeAt(i)])
return;
t(b[e.charCodeAt(i)])
}
return t(b[0]),
a > 0 && t([6 - a, 0]),
n
}

function d(e) {
for (var t = u, n = e, r = 0; w[r]; r++)
n = n.split(w[r]).join(String.fromCharCode(r + 1));
if (null == (t = t(n)))
return e;
for (n = 65535,
r = 0; r < e.length; r++)
n = 65535 & (n >>> 8 | n << 8),
n ^= 255 & e.charCodeAt(r),
n ^= (255 & n) >> 4,
n ^= n << 12 & 65535,
n ^= (255 & n) << 5 & 65535;
return n &= 65535,
e = "",
e += x.charAt(n >>> 12),
e += x.charAt(n >>> 6 & 63),
t += e += x.charAt(63 & n)
}

t = (e = t || {}).ctx || window;
var p = !e.hasOwnProperty("compress") || e.compress,
f = {},
h = new Date(2005, 0, 15).getTimezoneOffset(),
v = new Date(2005, 6, 15).getTimezoneOffset(),
m = [],
g = l(""),
y = {
Flash: ["ShockwaveFlash.ShockwaveFlash", function (e) {
return e.getVariable("$version")
}
],
Director: ["SWCtl.SWCtl", function (e) {
return e.ShockwaveVersion("")
}
]
};
try {
f.a = document.createElement("span"),
void 0 !== f.a.addBehavior && f.a.addBehavior("#default#clientCaps")
} catch (e) {
}
m = {};
var b = {
1: [4, 15],
110: [8, 239],
74: [8, 238],
57: [7, 118],
56: [7, 117],
71: [8, 233],
25: [8, 232],
101: [5, 28],
104: [7, 111],
4: [7, 110],
105: [6, 54],
5: [7, 107],
109: [7, 106],
103: [9, 423],
82: [9, 422],
26: [8, 210],
6: [7, 104],
46: [6, 51],
97: [6, 50],
111: [6, 49],
7: [7, 97],
45: [7, 96],
59: [5, 23],
15: [7, 91],
11: [8, 181],
72: [8, 180],
27: [8, 179],
28: [8, 178],
16: [7, 88],
88: [10, 703],
113: [11, 1405],
89: [12, 2809],
107: [13, 5617],
90: [14, 11233],
42: [15, 22465],
64: [16, 44929],
0: [16, 44928],
81: [9, 350],
29: [8, 174],
118: [8, 173],
30: [8, 172],
98: [8, 171],
12: [8, 170],
99: [7, 84],
117: [6, 41],
112: [6, 40],
102: [9, 319],
68: [9, 318],
31: [8, 158],
100: [7, 78],
84: [6, 38],
55: [6, 37],
17: [7, 73],
8: [7, 72],
9: [7, 71],
77: [7, 70],
18: [7, 69],
65: [7, 68],
48: [6, 33],
116: [6, 32],
10: [7, 63],
121: [8, 125],
78: [8, 124],
80: [7, 61],
69: [7, 60],
119: [7, 59],
13: [8, 117],
79: [8, 116],
19: [7, 57],
67: [7, 56],
114: [6, 27],
83: [6, 26],
115: [6, 25],
14: [6, 24],
122: [8, 95],
95: [8, 94],
76: [7, 46],
24: [7, 45],
37: [7, 44],
50: [5, 10],
51: [5, 9],
108: [6, 17],
22: [7, 33],
120: [8, 65],
66: [8, 64],
21: [7, 31],
106: [7, 30],
47: [6, 14],
53: [5, 6],
49: [5, 5],
86: [8, 39],
85: [8, 38],
23: [7, 18],
75: [7, 17],
20: [7, 16],
2: [5, 3],
73: [8, 23],
43: [9, 45],
87: [9, 44],
70: [7, 10],
3: [6, 4],
52: [5, 1],
54: [5, 0]
},
w = ["%20", ";;;", "%3B", "%2C", "und", "fin", "ed;", "%28", "%29", "%3A",
"/53", "ike", "Web", "0;", ".0", "e;", "on", "il", "ck", "01", "in", "Mo",
"fa", "00", "32", "la", ".1", "ri", "it", "%u", "le"],
x = ".0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
f.appidmsform = r,
f.f1b5 = d,
t.appidmsparm = f,
p && (t = navigator.userAgent.toLowerCase(),
"Gecko" === navigator.product && parseInt(t.substring(t.indexOf("rv:") + 3,
t.indexOf(")", t.indexOf("rv:") + 3)).split(".")[0]) <= 2 && r())
}(),
window.dcHelper = new function () {
this.setData = function (e) {
var t;
e: {
if (null == (t = document.getElementById(e)))
null != (n = document.getElementsByName(e)) && 0 < n.length &&
(t = n[0]);
if (null == t)
for (var n = 0, r = document.forms.length; n < r; n++)
for (var a = 0, i = document.forms[n], o = i.elements.length; a <
o; a++) {
var s = i[a];
if (s.name === e) {
t = s;
break e
}
}
}
null != t && (n = null,
"undefined" != typeof appidmsparm && null !== appidmsparm && (
appidmsparm.appidmsform(e),
null !== t.value && (n = t.value)),
t.value = this.getData(n))
},
this.getData = function (e) {
var t, n = {};
if (n.U = navigator.userAgent,
n.L = window.navigator.language ? window.navigator.language :
navigator.browserLanguage ? navigator.browserLanguage : "",
"number" != typeof (t = (new Date).getTimezoneOffset()) || null ===
t)
t = "";
else {
var r = Math.abs(parseInt(t / 60, 10)),
a = Math.abs(t % 60);
t = "GMT" + (0 < t ? "-" : "+") + (10 > r ? "0" + r : r) + ":" + (
10 > a ? "0" + a : a)
}
return n.Z = t,
n.V = "1.1",
null != e && (n.F = e),
JSON.stringify(n)
}
}
}).call(window)
}
def generate_client_info():
# pip3 install PyExecJS
import execjs
with open('dev.js', 'r') as f:
code = f.read()
code = 'var window = {};var navigator = {userAgent: "' + user_agent + '", language:"' + language + '"};' + code
ctx = execjs.compile(code)
client_id = ctx.call('r', False)
logger.info(f"client is {client_id}")
return json.dumps({
"U": user_agent,
"L": language,
"Z": "GMT+08:00",
"V": "1.1",
"F": client_id
})

注:若转载请注明来源(本贴地址)与作者信息。

返回顶部