Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find address from buffer like in memfind package #73

Open
webkitten opened this issue Dec 18, 2020 · 0 comments
Open

Find address from buffer like in memfind package #73

webkitten opened this issue Dec 18, 2020 · 0 comments

Comments

@webkitten
Copy link

Hello! I'm creating nw.js app with scanning memory, but memfind package doesn't work with nw

how to find address from buffer like this:

const MemoryFinder = require('memfind');
const mf = new MemoryFinder('notepad.exe');

mf.find('Hello World', block => {
	console.log(block.hexAddress, block.get(-5, 10).toString('binary'));
	// return true to stop find
});

// or

let addr;
const bufToFind = Buffer.from('Hello World');
mf.scan(block => {
	// don't put cpu-intensive code inside scan loop, e.g. Buffer.from()
	if (block.match(bufToFind)) {
		console.log(block.hexAddress, block.get(0, 20).toString());
		if (block.get(20)==0x65) {
			addr = block.address;
			return true;
			// return true to stop scan
		}
	}
});
if (addr) console.log(mf.read(addr-10, 128));

it returns addresses like:

5ab2780
5ab2960
5ab2978
5ab2b40
5ab2b58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant