shaofis / Node-Netflowd

A node.js based netflow collector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


I'm only using NetFlowPacket.js and not Netflow.js

NetFlowPacket.js has been modified in format and will not work with Netflow.js as designed.

I have not yet converted V5 to my formating. I made these changes for my own personal use. I hadn't planned on posting them but saw the request for V9 and figured if this could help bring V9 into Node-Netflowd sooner that I'd post this online.

I am not a programmer... Gasp ...So I appologize in advance for how messy some of this might be. I've peiced it together as I've went using all available RFCs.

Example

var NetFlowPacket = require('./NetFlowPacket')
var dgram = require('dgram')

var server = dgram.createSocket('udp4');
server.on('message', function(msg, rinfo){
  var Packet = new NetFlowPacket(msg, rinfo.address);
  console.log(Packet)
});
server.bind(2055);

Further Details V9 Appears to be working; needs more testing. I'm close on V10 but it isn't complete yet; I have been working with rfc5101 but I believe there is a newer version. For now V10 is handled with a few exceptions based on changes from a newer rfc.

I've changed NetFlowPacket to return an object including the header and 3 key arrays

    Flows[]            mapped flows
    Templates[]        received templates
    noTemplates[]      flow information where we don't yet have a template for

Templates are sent so that you can store it semi permanantly so that on reload you can immediatly decode these flows. Since we can't decode a V9 or V10 packet until we have a template I've sent those packets back to the main app where you can decide if you want to queue it and decode it later or discard it.

About

A node.js based netflow collector

License:Other


Languages

Language:JavaScript 100.0%