Skip to content

Instantly share code, notes, and snippets.

@vdeturckheim

vdeturckheim/injector.js Secret

Last active Jan 21, 2021
Embed
What would you like to do?
'use strict';
const CDP = require('chrome-remote-interface');
const main = async function () {
const client = await CDP({
port: 9229
});
await client.Runtime.enable();
const ServerPrototypeResult = await client.Runtime.evaluate({
expression:"require('http').Server.prototype", includeCommandLineAPI: true, returnByValue: false
});
const ServerInstanceListResult = await client.Runtime.queryObjects({
prototypeObjectId: ServerPrototypeResult.result.objectId
});
const ServerInstancesResult = await client.Runtime.getProperties({
objectId: ServerInstanceListResult.objects.objectId
});
const serverInstance = ServerInstancesResult.result[0].value.objectId;
console.log({ serverInstance });
await client.close();
};
main(); // on Node 15, an error will stop the process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment