How to use the frida.attach function in frida

To help you get started, we’ve selected a few frida examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lmangani / node_ssl_logger / node_ssl_logger.js View on Github external
process.exit(code ? code : 0);
}

if(process.argv.indexOf("-p") != -1){ var pid = process.argv[process.argv.indexOf("-p") + 1]; }
if(process.argv.indexOf("-v") != -1){ debug = true; }

try {
      fs.readFile(filename, function read(err, data) {
        if (!err) {
		fsscript = data.toString();
        } else { quit(1,err); }
      });
} catch(e) { quit(1,'Failed loading script!'); }

if (!pid){ process.exit(1);}
frida.attach(pid)
.then(function (session) {
  if (debug) console.log('attached:', session);
  return session.createScript(fsscript);
})
.then(function (script) {
  if(debug) { console.log('script created:', script); }
  console.log('Press Ctrl+C to stop logging...');
  script.events.listen('message', function (message, data) {
    if(data.length >0) {
    	if (debug) console.log('message from script:', message );
    	console.log(data.toString('utf8'));
    }
  });
  script.load();
})
.catch(function (error) {
github sipcapture / HEPjack.js / hepjack.js View on Github external
if(process.argv.indexOf("-p") != -1){ var pid = process.argv[process.argv.indexOf("-p") + 1]; }
if(process.argv.indexOf("-v") != -1){ debug = true; }

if(!pid) { console.error('No process defined! Exiting'); process.exit(1); }

try {
      fs.readFile(filename, function read(err, data) {
        if (!err) {
		fsscript = data.toString();
        } else { quit(1,err); }
      });
} catch(e) { quit(1,'Failed loading Frida script!'); }

if (!pid){ process.exit(1);}

frida.attach(pid)
.then(function (session) {
  if (debug) console.log('attached:', session);
  return session.createScript(fsscript);
})
.then(function(script) {
  if(debug) { console.log('script created:', script); }
  if (!script.events){ quit(1,'failed initializing script'); }
  console.log('Press Ctrl+C to stop logging...');
  script.events.listen('message', function (message, data) {
    if(data && data.length >0) {
	if(debug) { console.log('GOT DATA:', data.toString('utf8'), message) }
	var hep_proto = { "type": "HEP", "version": 3, "payload_type": "SIP", "captureId": hepId, "capturePass": hepPass, "ip_family": 2};
	var datenow =  new Date().getTime();
	hep_proto.time_sec = Math.floor(datenow / 1000);
	hep_proto.time_usec = datenow - (hep_proto.time_sec*1000);
	hep_proto.srcIp = ipInt(message.payload.src_addr).toIP();
github lailune / SLRRMultiplayer / app.js View on Github external
function AttachHook(pid) {
	frida.attach(pid)
		.then(function (session) {
			return session.createScript(injectScript);
		})
		.then(function (script) {
			script.events.listen('message', function (message, data) {
				//console.log('HScript:', message, data);
				handleMessage(script, message.payload.name, message.payload.data);
			});
			script.load()
				.then(function () {
					console.log('Hook script injected.');
				})
				.catch(function (error) {
					console.log('Hook Error:', error.message);
				});
		})
github frida / frida-presentations / ZeroNights2015 / 09-injecting-errors / app.js View on Github external
co(function *() {
  session = yield frida.attach(process.argv[2]);
  const source = yield load(require.resolve('./agent.js'));
  script = yield session.createScript(source);
  script.events.listen('message', message => {
    console.log(message);
  });
  yield script.load();
})
.catch(console.error);
github frida / frida-presentations / ZeroNights2015 / 10-stalking / app.js View on Github external
co(function *() {
  session = yield frida.attach(process.argv[2]);
  const source = yield load(
      require.resolve('./agent.js'));
  script = yield session.createScript(source);
  script.events.listen('message', message => {
    if (message.type === 'send') {
      const stanza = message.payload;
      switch (stanza.name) {
        case '+ready':
          console.log('Waiting for application to call recv()...');
          break;
        case '+result': {
          console.log('Results received:');
          const events = stanza.payload.events;
          events.forEach(ev => {
            const location = ev[0];
            const target = ev[1];
github frida / frida-presentations / NcN2015 / 01-basics / 5-recv / app.js View on Github external
co(function *() {
  session = yield frida.attach('hello');
  const source = yield load(
      require.resolve('./agent.js'));
  script = yield session.createScript(source);
  script.events.listen('message', message => {
    console.log(message);
  });
  yield script.load();
  yield script.postMessage({ magic: 21 });
  yield script.postMessage({ magic: 12 });
});
github frida / frida-presentations / NLUUG2015 / 1-basics / 4-send / app.js View on Github external
co(function *() {
  session = yield frida.attach('hello');
  const source = yield load(
      require.resolve('./agent.js'));
  script = yield session.createScript(source);
  script.events.listen('message', message => {
    console.log(message);
  });
  yield script.load();
});
github frida / frida-presentations / ZeroNights2015 / 01-basics / 7-rpc / app.js View on Github external
co(function *() {
  session = yield frida.attach('hello');
  const source = yield load(require.resolve('./agent.js'));
  script = yield session.createScript(source);
  yield script.load();
  const api = yield script.getExports();
  const result = yield api.disassemble('0x106a81ec0');
  console.log(result);
  yield session.detach();
});
github frida / frida-presentations / ZeroNights2015 / 01-basics / 6-blocking-recv / app.js View on Github external
co(function *() {
  session = yield frida.attach('hello');
  const source = yield load(
      require.resolve('./agent.js'));
  script = yield session.createScript(source);
  script.events.listen('message', message => {
    const number = message.payload.number;
    script.postMessage({ number: number * 2 });
  });
  yield script.load();
});

frida

Inject JavaScript to explore native apps on Windows, Mac, Linux, iOS and Android

LGPL-2.0 WITH WxWindows-excep…
Latest version published 14 hours ago

Package Health Score

66 / 100
Full package analysis