frida/frida-node

[Feature Request / Bug] script.load() doesn't throw error

ChiChou opened this issue · 1 comments

frida-node@14.0.5

const frida = require('frida');

async function main() {
	const dev = await frida.getLocalDevice();
	const pid = await dev.spawn('/bin/sh')
	const session = await dev.attach(pid)
	const script = await session.createScript(`console.log(1); throw 1;`) // <--- better raise an exception or something
	await script.load()
	await dev.resume(pid)
	await session.detach()
	await dev.kill(pid)
}

main()

await script.load() doesn't throw error, making it harder to debug complex agent scripts.

Session#createScript() cannot execute any code, since execution may emit messages which nothing can handle. That is why creation and loading are two separate steps.