Files
Tiago Valente bf1ca4b61a CheatSpecter 0.3.0
Browser-based real-time modding tool for offline single-player games on a
jailbroken PS5, served by a payload on the console.

- Value search, memory and code views, find what writes to a value
- Cheats as patches, held values, injected code, calls and scripts
- .cspector cheat files, saved on the PS5 or on your device
- Community tables in JSON, SHN and MC4 from three repositories
- Game library with names, logos and sizes; start a game from the browser
- MCP server for assistants
2026-10-10 10:16:57 -07:00

49 lines
1.7 KiB
JavaScript

// Sends the built payload to an ELF loader on the console.
//
// npm run payload:send -- 192.168.1.20 (loader on port 9021)
// npm run payload:send -- 192.168.1.20 9020
import fs from 'node:fs';
import net from 'node:net';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const [host, portArg] = process.argv.slice(2);
if (!host) {
console.error('Usage: npm run payload:send -- <PS5 IP address> [loader port, default 9021]');
process.exit(1);
}
const port = Number(portArg ?? 9021);
const elf = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../payload/cheatspecter.elf');
if (!fs.existsSync(elf)) {
console.error('payload/cheatspecter.elf does not exist yet. Build it with: npm run payload');
process.exit(1);
}
const data = fs.readFileSync(elf);
const sock = net.connect({ host, port, timeout: 5000 });
// Some loaders keep the connection open after taking the file, so once every
// byte has gone out, a quiet connection is success, not a failure.
let sent = false;
let reported = false;
const done = () => {
if (reported) return;
reported = true;
console.log(`Sent ${(data.length / 1024).toFixed(0)} KB to ${host}:${port}. Watch the TV for the "CheatSpecter is ready" notification.`);
};
sock.on('timeout', () => {
if (sent) {
done();
sock.destroy();
} else sock.destroy(new Error('timed out'));
});
sock.on('connect', () => sock.end(data, () => (sent = true)));
sock.on('close', (hadError) => {
if (!hadError && sent) done();
});
sock.on('error', (err) => {
if (reported) return;
console.error(`Could not send to ${host}:${port} (${err.message}). Is an ELF loader running on the console?`);
process.exitCode = 1;
});