Skip to content

Commit 12cc70c

Browse files
author
Jack Li
committed
automate the token generation process
1 parent 272c539 commit 12cc70c

File tree

4 files changed

+1075
-0
lines changed

4 files changed

+1075
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const jsdom = require("jsdom");
2+
const { JSDOM } = jsdom;
3+
const { window } = new JSDOM("<!DOCTYPE html>");

ticketscraping/js/injector.js

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
/* THE CODE BELOW SHOULD BE INJECTED TO THE JS FILE
2+
AT https://epsf.ticketmaster.com/eps-d
3+
IN ORDER TO OBTAIN A REESE84 TOKEN FROM THE SERVER */
4+
5+
/**
6+
* Reference: https://epsf.ticketmaster.com/eps-d
7+
*/
8+
const reese84HashObj = {
9+
hash: function (_0x32cda0) {
10+
_0x32cda0 = unescape(encodeURIComponent(_0x32cda0));
11+
for (
12+
var _0x354dff = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6],
13+
_0x184815 =
14+
(_0x32cda0 += String['fromCharCode'](0x80))['length'] / 0x4 + 0x2,
15+
_0x4f0814 = Math['ceil'](_0x184815 / 0x10),
16+
_0xb67cd8 = new Array(_0x4f0814),
17+
_0x3db23f = 0x0;
18+
_0x3db23f < _0x4f0814;
19+
_0x3db23f++
20+
) {
21+
_0xb67cd8[_0x3db23f] = new Array(0x10);
22+
for (var _0x4d1d12 = 0x0; _0x4d1d12 < 0x10; _0x4d1d12++)
23+
_0xb67cd8[_0x3db23f][_0x4d1d12] =
24+
(_0x32cda0['charCodeAt'](0x40 * _0x3db23f + 0x4 * _0x4d1d12) <<
25+
0x18) |
26+
(_0x32cda0['charCodeAt'](0x40 * _0x3db23f + 0x4 * _0x4d1d12 + 0x1) <<
27+
0x10) |
28+
(_0x32cda0['charCodeAt'](0x40 * _0x3db23f + 0x4 * _0x4d1d12 + 0x2) <<
29+
0x8) |
30+
_0x32cda0['charCodeAt'](0x40 * _0x3db23f + 0x4 * _0x4d1d12 + 0x3);
31+
}
32+
(_0xb67cd8[_0x4f0814 - 0x1][0xe] =
33+
(0x8 * (_0x32cda0['length'] - 0x1)) / Math['pow'](0x2, 0x20)),
34+
(_0xb67cd8[_0x4f0814 - 0x1][0xe] = Math['floor'](
35+
_0xb67cd8[_0x4f0814 - 0x1][0xe]
36+
)),
37+
(_0xb67cd8[_0x4f0814 - 0x1][0xf] =
38+
(0x8 * (_0x32cda0['length'] - 0x1)) & 0xffffffff);
39+
var _0x4964ee,
40+
_0x1f8408,
41+
_0x393864,
42+
_0x4e34f7,
43+
_0x2bdc40,
44+
_0x725508 = 0x67452301,
45+
_0x69fa2d = 0xefcdab89,
46+
_0xc2205d = 0x98badcfe,
47+
_0x4d6fc6 = 0x10325476,
48+
_0x531366 = 0xc3d2e1f0,
49+
_0xe1407f = new Array(0x50);
50+
for (_0x3db23f = 0x0; _0x3db23f < _0x4f0814; _0x3db23f++) {
51+
for (var _0x19ef55 = 0x0; _0x19ef55 < 0x10; _0x19ef55++)
52+
_0xe1407f[_0x19ef55] = _0xb67cd8[_0x3db23f][_0x19ef55];
53+
for (_0x19ef55 = 0x10; _0x19ef55 < 0x50; _0x19ef55++)
54+
_0xe1407f[_0x19ef55] = reese84HashObj['ROTL'](
55+
_0xe1407f[_0x19ef55 - 0x3] ^
56+
_0xe1407f[_0x19ef55 - 0x8] ^
57+
_0xe1407f[_0x19ef55 - 0xe] ^
58+
_0xe1407f[_0x19ef55 - 0x10],
59+
0x1
60+
);
61+
(_0x4964ee = _0x725508),
62+
(_0x1f8408 = _0x69fa2d),
63+
(_0x393864 = _0xc2205d),
64+
(_0x4e34f7 = _0x4d6fc6),
65+
(_0x2bdc40 = _0x531366);
66+
for (_0x19ef55 = 0x0; _0x19ef55 < 0x50; _0x19ef55++) {
67+
var _0x1f693f = Math['floor'](_0x19ef55 / 0x14),
68+
_0x1e561e =
69+
(reese84HashObj['ROTL'](_0x4964ee, 0x5) +
70+
reese84HashObj['f'](_0x1f693f, _0x1f8408, _0x393864, _0x4e34f7) +
71+
_0x2bdc40 +
72+
_0x354dff[_0x1f693f] +
73+
_0xe1407f[_0x19ef55]) &
74+
0xffffffff;
75+
(_0x2bdc40 = _0x4e34f7),
76+
(_0x4e34f7 = _0x393864),
77+
(_0x393864 = reese84HashObj['ROTL'](_0x1f8408, 0x1e)),
78+
(_0x1f8408 = _0x4964ee),
79+
(_0x4964ee = _0x1e561e);
80+
}
81+
(_0x725508 = (_0x725508 + _0x4964ee) & 0xffffffff),
82+
(_0x69fa2d = (_0x69fa2d + _0x1f8408) & 0xffffffff),
83+
(_0xc2205d = (_0xc2205d + _0x393864) & 0xffffffff),
84+
(_0x4d6fc6 = (_0x4d6fc6 + _0x4e34f7) & 0xffffffff),
85+
(_0x531366 = (_0x531366 + _0x2bdc40) & 0xffffffff);
86+
}
87+
return (
88+
reese84HashObj['toHexStr'](_0x725508) +
89+
reese84HashObj['toHexStr'](_0x69fa2d) +
90+
reese84HashObj['toHexStr'](_0xc2205d) +
91+
reese84HashObj['toHexStr'](_0x4d6fc6) +
92+
reese84HashObj['toHexStr'](_0x531366)
93+
);
94+
},
95+
f: function (_0x4a2ab7, _0x15ec48, _0x2f0b8e, _0x6ffd09) {
96+
switch (_0x4a2ab7) {
97+
case 0x0:
98+
return (_0x15ec48 & _0x2f0b8e) ^ (~_0x15ec48 & _0x6ffd09);
99+
case 0x1:
100+
case 0x3:
101+
return _0x15ec48 ^ _0x2f0b8e ^ _0x6ffd09;
102+
case 0x2:
103+
return (
104+
(_0x15ec48 & _0x2f0b8e) ^
105+
(_0x15ec48 & _0x6ffd09) ^
106+
(_0x2f0b8e & _0x6ffd09)
107+
);
108+
}
109+
},
110+
ROTL: function (_0x11e783, _0x3f2f62) {
111+
return (_0x11e783 << _0x3f2f62) | (_0x11e783 >>> (0x20 - _0x3f2f62));
112+
},
113+
toHexStr: function (_0x125300) {
114+
for (var _0x39e29d = '', _0xa51676 = 0x7; _0xa51676 >= 0x0; _0xa51676--)
115+
_0x39e29d += ((_0x125300 >>> (0x4 * _0xa51676)) & 0xf)['toString'](0x10);
116+
return _0x39e29d;
117+
},
118+
};
119+
120+
/**
121+
* Reference: https://epsf.ticketmaster.com/eps-d
122+
*/
123+
function _0xbae375() {
124+
return Date['now'] ? Date['now']() : new Date()['getTime']();
125+
}
126+
127+
/**
128+
* Reference: https://epsf.ticketmaster.com/eps-d
129+
*/
130+
const timerFactory = (function () {
131+
/**
132+
*
133+
* start: ƒ (_0x3deed1)
134+
startInternal: ƒ (_0xd257e7)
135+
stop: ƒ (_0x975271)
136+
stopInternal: ƒ (_0x2f5e67)
137+
summary: ƒ ()
138+
*/
139+
function _0x1efe8f() {
140+
(this['marks'] = {}), (this['measures'] = {});
141+
}
142+
return (
143+
(_0x1efe8f['prototype']['start'] = function (_0x3deed1) {
144+
this['marks'][_0x3deed1] = _0xbae375();
145+
}),
146+
(_0x1efe8f['prototype']['startInternal'] = function (_0xd257e7) {}),
147+
(_0x1efe8f['prototype']['stop'] = function (_0x975271) {
148+
this['measures'][_0x975271] = _0xbae375() - this['marks'][_0x975271];
149+
}),
150+
(_0x1efe8f['prototype']['stopInternal'] = function (_0x2f5e67) {}),
151+
(_0x1efe8f['prototype']['summary'] = function () {
152+
return this['measures'];
153+
}),
154+
_0x1efe8f
155+
);
156+
})();
157+
158+
/* injector code starts here */
159+
160+
// const fs = require('fs');
161+
// const FILE_NAME = "reese84.json";
162+
163+
function writeResultToFile(data) {
164+
process.stdout.write(JSON.stringify(data))
165+
}
166+
167+
async function getInterrogation() {
168+
const INTERROGATOR = 'reese84interrogator',
169+
INTERROGATION = 'interrogate';
170+
const interrogationFn = window[INTERROGATOR];
171+
if (!interrogationFn) {
172+
throw new Error('Interrogation function not extracted');
173+
}
174+
let fn = {};
175+
const timer = new timerFactory();
176+
timer.start('total');
177+
178+
interrogationFn.call(fn, reese84HashObj.hash, timer);
179+
const res = await new Promise(fn[INTERROGATION]);
180+
return [res, timer];
181+
};
182+
183+
184+
/**
185+
* main function
186+
*/
187+
(async function () {
188+
const [reese84, timer] = await getInterrogation();
189+
const body = {
190+
error: null,
191+
old_token: null,
192+
performance: { interrogation: timer.measures.interrogation },
193+
solution: { interrogation: reese84 },
194+
};
195+
writeResultToFile(body);
196+
})();

0 commit comments

Comments
 (0)