GithubHelp home page GithubHelp logo

osquery-node's Introduction

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

osquery-node's People

Contributors

datesss avatar sidorares avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

osquery-node's Issues

Only TEXT (strings) are supported

When sending a response, all value types must be a string or writeString will fail:
(this is using { "foo": 2 } having changed the schema to be "INTEGER"):

Error: writeString called without a string/Buffer argument: 2
    at TBinaryProtocol.writeString (/Users/chuck/Desktop/swamp/node_modules/osquery/node_modules/thrift/lib/thrift/protocol.js:149:11)
    at Object.ExtensionResponse.write (/Users/chuck/Desktop/swamp/node_modules/osquery/gen-nodejs/osquery_types.js:381:20)
    at Object.Extension_call_result.write (/Users/chuck/Desktop/swamp/node_modules/osquery/gen-nodejs/Extension.js:251:18)
    at /Users/chuck/Desktop/swamp/node_modules/osquery/gen-nodejs/Extension.js:434:14
    at /Users/chuck/Desktop/swamp/node_modules/osquery/extension_server.js:42:7
    at generateTable (/Users/chuck/Desktop/swamp/osquery.js:63:3)
    at /Users/chuck/Desktop/swamp/osquery.js:17:3

Connect error with /var/osquery/osquery.em file

Hello,

When I launch following code :

    let os = osquery.createClient();
    os.query('SELECT uid, name FROM listening_ports l, processes p WHERE l.pid=p.pid', function(err, res) {
        res.json(res);
    });

It return an error :

Uncaught Error: connect ECONNREFUSED /var/osquery/osquery.em

Thanks for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.