Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@fxjs/netflow
Advanced tools
NetFlow Version 5 library for Fibjs
npm install @fxjs/netflow
The usage of the netflowv9 collector library is very very simple. You just have to do something like this:
let Collector = require('@fxjs/netflow');
let co = new Collector(3000, function(flow) {
console.log(flow);
})
co.run((err) => { console.error(err); })
or you can use it as event provider:
let co = new Collector({port: 3000}).on('data',function(flow) {
console.log(flow);
});
co.run()
The flow will be presented in a format very similar to this:
{ header:
{ version: 9,
count: 25,
uptime: 2452864139,
seconds: 1401951592,
sequence: 254138992,
sourceId: 2081 },
rinfo:
{ address: '15.21.21.13',
family: 'IPv4',
port: 29471,
size: 1452 },
packet: Buffer <00 00 00 00 ....>
flow: [
{ in_pkts: 3,
in_bytes: 144,
ipv4_src_addr: '15.23.23.37',
ipv4_dst_addr: '16.16.19.165',
input_snmp: 27,
output_snmp: 16,
last_switched: 2452753808,
first_switched: 2452744429,
l4_src_port: 61538,
l4_dst_port: 62348,
out_as: 0,
in_as: 0,
bgp_ipv4_next_hop: '16.16.1.1',
src_mask: 32,
dst_mask: 24,
protocol: 17,
tcp_flags: 0,
src_tos: 0,
direction: 1,
fw_status: 64,
flow_sampler_id: 2 } } ]
There will be one callback for each packet, which may contain more than one flow.
Additionally, you can use the collector to listen for template updates:
var collector = new Collector({port: 3000});
collector.on('data', function(data) {
console.log(data);
});
collector.run()
Currently we support netflow version 5.
You can initialize the collector with either callback function only or a group of options within an object.
The following options are available during initialization:
port - defines the port where our collector will listen to.
new Collector({ port: 5000, cb: function (flow) { console.log(flow) } })
Or
new Collector(5000, function (flow) { console.log(flow) })
host - binds to a particular host on the local interfaces.
new Collector({ port: 5000, host: '0.0.0.0', cb: function (flow) { console.log(flow) } })
type - defines to what socket type we will bind to. Default is udp4. You can change it to udp6 is you like.
new Collector(5000, { socketType: 'udp6', cb: function (flow) { console.log(flow) } })
recvBufferSize - defines the udp socket recvBuffer default 256kbytes.
The module allows you to define multiple collectors at the same time. For example:
var Collector = require('@fxjs/netflow');
new Collector(5555, function(flow) { // Collector 1 listening on port 5555
console.log(flow);
}).run();
new Collector(6666, function(flow) { // Collector 2 listening on port 6666
console.log(flow);
}).run();
FAQs
netflow for fibjs
We found that @fxjs/netflow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.