nfdump icon indicating copy to clipboard operation
nfdump copied to clipboard

request/intent for PR: using nfdump as a library

Open martinpaljak opened this issue 5 years ago • 4 comments

Thanks for a great tool!

What is the recommended method of using nfdump as an external library for reading nfcapd data?

I'm in the process of making nfdump and moloch play together (read: piping nfcapd flows via moloch-capture pipeline as "dataless sessions" to be viewed and queried in moloch UI).

Integration is currently based on nfreader.c sample and it "seems to work OK, on my machine".

What I've done this far works with some hand-crafted code to please compiler and make things link, but for simple "--with-nfdump=/prefix" kind of inclusion some adjustments to the headers and build machinery should be done, IMHO.

Is there something missing from my radar, something planned in this field, or something where PR-s would be welcome?

martinpaljak avatar Nov 06 '19 20:11 martinpaljak

Using nfreader is indeed the preferred way to craft an interface of your choice. The nfreader code coming with nfdump is guaranteed to work. However, you can code your own reader. Everything you need is nffile.h with it's definitions. There might be a GO interface one day to read nfdump files with Apps written with Golang. Hope, this helps

phaag avatar Dec 05 '19 12:12 phaag

I'd like to re-open this, as it was not just a notice but to be followed with a PR.

To make things work for moloch-nfdump (nfdump data importer for moloch, see https://github.com/martinpaljak/moloch/wiki) manual fuss is needed to make nfdump header layout work from an external project. Namely:

  • conflict of "config.h"
  • clearer separation of internal and external headers.

Right now this makes it compile semi-cleanly:

https://github.com/martinpaljak/moloch/commit/5aa6408e3bf9c0aa29148565f208a6740c846611#diff-05e4d1c315718a1c74a8a45b096525a3R29-R60

https://github.com/martinpaljak/moloch/blob/nfdump/configure.ac#L356-L357

martinpaljak avatar Dec 06 '19 05:12 martinpaljak

I can reopen this, but changes won't be ready soon.

phaag avatar Feb 22 '20 07:02 phaag

As go-nfdump can read nfdump binary files, a custom importer written in Go would be most efficient, I guess.

phaag avatar Oct 14 '23 15:10 phaag