This is something I've found out very recently and It seems to be giving me a new / much simpler way of injecting game offsets/modifying it by using just node.js / javascript (consider use with electron or nwjs).
In simple words: this runs the client from nodejs script & modifies (only one) offset inside a packed dll hooked up to the client without any issues or delays.
Code:
const mem = require('memoryjs'); // https://github.com/Rob--/memoryjs
const {
openProcess,
virtualProtectEx,
readMemory,
writeMemory,
// debugger
Debugger: debuggerInstance,
awaitDebugEvent,
handleDebugEvent,
TRIGGER_ACCESS,
TRIGGER_WRITE,
// Types:
STRING,
INT,
PAGE_EXECUTE_READWRITE,
} = mem;
const path = require('path');
const { spawn } = require('child_process');
const [offset, new_url, executable_name] = [
1444586564, //modifying offset
'https://facebook.com/gameshiroi', //the new string
'sro_client.exe',
];
const setupDebugger = processId => {
debuggerInstance.attach(processId, false);
const register = debuggerInstance.setHardwareBreakpoint(processId, offset, TRIGGER_ACCESS, STRING);
debuggerInstance.on(register, (event) => {
console.log(`debug_event`, { event }); // guess what
});
};
// call this about each 1-1.5s until it executes properly.. actually this works fine without timeout too.. but who knows what the computer some people have.
const doOverrides = () => {
const spawnedClient = openProcess(executable_name);
const {
handle,
th32ProcessID,
} = spawnedClient;
if (handle) {
virtualProtectEx(handle, offset, new_url.length, PAGE_EXECUTE_READWRITE);
writeMemory(handle, offset, new_url, STRING); // update the offset
setupDebugger(th32ProcessID, false); // attach a debugger
console.log({
spawnedClient,
read_result: readMemory(handle, offset, STRING), // read value from offset
});
} else {
setTimeout(doOverrides, 500);
}
};
// spawn the client:
spawn(path.join(__dirname, 'client', executable_name), [0, '/34', 0, 0]);
// wait for client to be spawned, then inject
setTimeout(doOverrides, 1500);
note:
Above script is just a proof of concept and you will definitely need to think more about how to setup it for your own needs and what environments would it run at.
Hope you find this useful.






).