-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathticket.js
367 lines (344 loc) · 9.3 KB
/
ticket.js
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
const { performance } = require('perf_hooks');
const request = require('request-promise');
const { promises: fs } = require('fs');
const crypto = require("crypto");
const SocksProxyAgent = require('socks-proxy-agent');
var supjar = request.jar();
supjar._jar.setCookie('lastVisitedFragment=', 'https://www.supremenewyork.com/', (error, cookie) => {
});
var document = {
get cookie() {
if (supjar!=undefined)
{
let c = supjar._jar.getCookieStringSync('https://www.supremenewyork.com');
console.log('getcookie', c);
return c;
} else return 'lastVisitedFragment=';
},
set cookie(value) {
if (supjar!=undefined)
{
supjar._jar.setCookie(value, 'https://www.supremenewyork.com', (error, cookie) => {
if (error) {
throw error;
}
});
console.log('setcookie',value);
}
}
};
var navigator = {
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1'
};
var window = {
crypto: {
getRandomValues: crypto.randomFillSync
},
__wasmExecute () {
}
}
var outputBuf = "";
var global = {
Uint8Array,
window,
document,
navigator,
fs: {
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },
writeSync(fd, buf) {
outputBuf += decoder.decode(buf);
const nl = outputBuf.lastIndexOf("\n");
if (nl != -1) {
console.log(outputBuf.substr(0, nl));
outputBuf = outputBuf.substr(nl + 1);
}
return buf.length;
},
write(fd, buf, offset, length, position, callback) {
if (offset !== 0 || length !== buf.length || position !== null) {
callback(enosys());
return;
}
const n = this.writeSync(fd, buf);
callback(null, n);
},
open(path, flags, mode, callback) { callback(enosys()); },
fsync(fd, callback) { callback(null); },
}
}
const enosys = () => {
const err = new Error("not implemented");
err.code = "ENOSYS";
return err;
};
var b = new TextEncoder("utf-8"),
e = new TextDecoder("utf-8"),
g = [];
class Go {
constructor() {
var a=this;
a.exit = (code) => {
if (code !== 0) {
console.warn("exit code:", code);
}
};
a._exitPromise = new Promise((resolve) => {
a._resolveExitPromise = resolve;
});
a._pendingEvent = null;
a._scheduledTimeouts = new Map();
a._nextCallbackTimeoutID = 1;
var c = function() {
return new DataView(a._inst.exports.memory.buffer)
},
f = function(b) {
var d = c().getFloat64(b, !0);
if (0 !== d) {
if (!isNaN(d)) return d;
b = c().getUint32(b, !0);
return a._values[b]
}
},
d = function(b, d) {
if ("number" === typeof d) isNaN(d) ? (c().setUint32(b + 4, 2146959360, !0), c().setUint32(b, 0, !0)) : 0 === d ? (c().setUint32(b + 4, 2146959360, !0), c().setUint32(b, 1, !0)) : c().setFloat64(b, d, !0);
else {
switch (d) {
case void 0:
c().setFloat64(b, 0, !0);
return;
case null:
c().setUint32(b + 4, 2146959360, !0);
c().setUint32(b, 2, !0);
return;
case !0:
c().setUint32(b + 4, 2146959360, !0);
c().setUint32(b, 3, !0);
return;
case !1:
c().setUint32(b + 4, 2146959360, !0);
c().setUint32(b, 4, !0);
return
}
var f = a._refs.get(d);
void 0 === f && (f = a._values.length, a._values.push(d), a._refs.set(d, f));
var e = 0;
switch (typeof d) {
case "string":
e = 1;
break;
case "symbol":
e = 2;
break;
case "function":
e = 3
}
c().setUint32(b + 4, 2146959360 | e, !0);
c().setUint32(b, f, !0)
}
},
m = function(a, b, c) {
c = Array(b);
for (var d = 0; d < b; d++) c[d] = f(a + 8 * d);
return c
},
l = function(b, c) {
return e.decode(new DataView(a._inst.exports.memory.buffer, b, c))
},
t = Date.now() - performance.now();
this.importObject = {
wasi_unstable: {
fd_write: function(a, b, d, f) {
if (1 == a)
for (a = 0; a < d; a++) {
var k = b + 8 * a,
q = c().getUint32(k + 0, !0);
k = c().getUint32(k + 4, !0);
for (var h = 0; h < k; h++) {
var p = c().getUint8(q + h);
13 != p && (10 == p ? (p = e.decode(new Uint8Array(g)), g = [], console.log(p)) : g.push(p))
}
} else console.error("invalid file descriptor:", a);
c().setUint32(f, 0, !0);
return 0
}
},
env: {
"runtime.ticks": function() {
return t + performance.now()
},
"runtime.sleepTicks": function(b) {
setTimeout(a._inst.exports.go_scheduler, b)
},
"syscall/js.stringVal": function(a, b, c) {
console.log('stringVal', arguments);
b = l(b, c);
d(a, b)
},
"syscall/js.valueGet": function(a, b, c, e) {
console.log('valueget', arguments);
c = l(c, e);
b = f(b);
c=='process'&&(c='fakeprocess'); //faked process object
b = Reflect.get(b, c);
d(a, b)
},
"syscall/js.valueSet": function(a, b, c, d) {
console.log('valueset',arguments);
a = f(a);
b = l(b, c);
d = f(d);
Reflect.set(a, b, d)
},
"syscall/js.valueIndex": function(a, b, c) {
console.log('valueIndex', arguments);
d(a, Reflect.get(f(b), c))
},
"syscall/js.valueSetIndex": function(a, b, c) {
console.log('valueSetIndex', arguments);
Reflect.set(f(a), b, f(c))
},
"syscall/js.valueCall": function(a, b, e, g, h, n, v) {
console.log('valuecall',arguments);
b = f(b);
e = l(e, g);
h = m(h, n, v);
try {
var k = Reflect.get(b, e);
d(a, Reflect.apply(k, b, h));
c().setUint8(a + 8, 1)
} catch (x) {
d(a, x), c().setUint8(a + 8, 0)
}
},
"syscall/js.valueInvoke": function(a, b, e, g, h) {
console.log('valueInvoke', arguments);
try {
var k = f(b),
q = m(e, g, h);
d(a, Reflect.apply(k, void 0, q));
c().setUint8(a + 8, 1)
} catch (w) {
d(a, w), c().setUint8(a + 8, 0)
}
},
"syscall/js.valueNew": function(a, b, e, g, h) {
console.log('valueNew', arguments);
b = f(b);
e = m(e, g, h);
try {
d(a, Reflect.construct(b, e)), c().setUint8(a + 8, 1)
} catch (u) {
d(a, u), c().setUint8(a + 8, 0)
}
},
"syscall/js.valueLength": function(a) {
console.log('valueLength',arguments);
return f(a).length
},
"syscall/js.valuePrepareString": function(a, e) {
console.log('valuePrepareString',arguments);
e = String(f(e));
e = b.encode(e);
d(a, e);
a += 8;
e = e.length;
c().setUint32(a + 0, e, !0);
c().setUint32(a + 4, Math.floor(e / 4294967296), !0)
},
"syscall/js.valueLoadString": function(b, c, d, e) {
console.log('valueLoadString',arguments);
b = f(b);
(new Uint8Array(a._inst.exports.memory.buffer, c, d)).set(b)
}
}
}
};
async run(instance) {
this._inst = instance;
this._values = [NaN, 0, null, true, false, global];
this._refs = new Map();
this._callbackShutdown = false;
this.exited = false;
while (true) {
const callbackPromise = new Promise((resolve) => {
this._resolveCallbackPromise = () => {
if (this.exited) {
throw new Error('bad callback: Go program has already exited');
}
setTimeout(resolve, 0);
};
});
this._inst.exports._start();
if (this.exited) {
break;
}
await callbackPromise;
}
}
_resume() {
if (this.exited) {
throw new Error("Go program has already exited");
}
this._inst.exports.resume();
if (this.exited) {
this._resolveExitPromise();
}
}
_makeFuncWrapper(id) {
const go = this;
return function () {
const event = { id: id, this: this, args: arguments };
go._pendingEvent = event;
go._resume();
return event.result;
};
}
}
(async () => {
const go = new Go();
const module = await WebAssembly.compile(await fs.readFile('./f.031a537.wasm'));
const instance = await WebAssembly.instantiate(module, go.importObject);
go.run(instance);
const info = {
host: '127.0.0.1',
port: 8888,
};
var agent = new SocksProxyAgent(info);
var supreme = request.defaults({
agent: agent,
jar : supjar,
gzip: true,
headers: {
'Accept-Language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
'Origin': 'https://www.supremenewyork.com',
'Referer': 'https://www.supremenewyork.com/mobile/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': navigator.userAgent,
'X-Requested-With': 'XMLHttpRequest'
}
})
const copitem = { //hanes M
id: 304903,
sizeid: 63127,
styleid: 28535
}
await supjar._jar.setCookie(`lastVisitedFragment=products/${copitem.id}/${copitem.styleid}`, 'https://www.supremenewyork.com/', (error, cookie) => {
});
await supreme(
{
method: 'POST',
url: `https://www.supremenewyork.com/shop/${copitem.id}/add.json`,
json: true,
form: { // !!!!!!EU ATC FORM!!!!!!!
size: copitem.sizeid,
style: copitem.styleid,
'qty': 1
}
}, (err, res, body) => {
if (err) { console.log(err); }
console.log(body);
process.exit(0);
});
})();