/osquery-node

node.js client for osquery

Primary LanguageJavaScript

osquery-node

Facebook osquery client for node.js

Installation

npm install osquery

Usage

client:

var osquery = require('osquery');

var os = osquery.createClient({ path: '/var/osquery/osquery.em' });
os.query('SELECT uid, name FROM listening_ports l, processes p WHERE l.pid=p.pid', function(err, res) {
  console.log(res);
});

Table plugin:

var osquery = require('osquery');

var generateTable = function(req, resp) {
  resp(null, [{
        "foo": "foo value",
        "bar": "bar value " + Date.now()
      }]
  );
};

var c = osquery.createClient();
var s = c.createServer({
  info: {
    name: 'test table extension'
  },
  plugins: [{
    type: 'table',
    name: 'node_ext_table',
    schema: [
      {"name": "foo", "type": "TEXT"},
      {"name": "bar", "type": "TEXT"}
    ],
    handler: generateTable
  }]
});

s.listen(function(err, serv) {
  console.log('extension started!');
});

License

MIT

See also