Netcap offers a simple interface to filter for specific fields and select only those of interest. Filtering and exporting specific fields can be performed with all available audit record types, over a uniform command-line interface. By default, output is generated as CSV with the field names added as first line. It is also possible to use a custom separator string. Fields are exported in the order they are named in the select statement. Sub structures of audit records (for example IPv4Options from an IPv4 packet), are converted to a human readable string representation. More examples for using this feature on the command-line can be found in the usage section.
Netcap offers a simple command-line interface to select fields of interest from the gathered audit records.
Show available header fields:
$ net.dump -r UDP.ncap.gz -fieldsTimestamp,SrcPort,DstPort,Length,Checksum,PayloadEntropy,PayloadSize
Print all fields for the supplied audit record:
$ net.dump -r UDP.ncap.gz1331904607.100000,53,42665,120,41265,4.863994469989251,1121331904607.100000,42665,53,53,1764,4.0625550894074385,451331904607.290000,51190,53,39,22601,3.1861758166070766,311331904607.290000,56434,53,39,37381,3.290856864924384,311331904607.330000,137,137,58,64220,3.0267194361875682,50...
Selecting fields will also define their order:
$ net.dump -r UDP.ncap.gz -select Length,SrcPort,DstPort,TimestampLength,SrcPort,DstPort,Timestamp145,49792,1900,1499254962.084372145,49792,1900,1499254962.084377145,49792,1900,1499254962.084378145,49792,1900,1499254962.084379145,49792,1900,1499254962.084380...
Print selection in the supplied order and convert timestamps to UTC time:
$ net.dump -r UDP.ncap.gz -select Timestamp,SrcPort,DstPort,Length -utc2012-03-16 13:30:07.1 +0000 UTC,53,42665,1202012-03-16 13:30:07.1 +0000 UTC,42665,53,532012-03-16 13:30:07.29 +0000 UTC,51190,53,392012-03-16 13:30:07.29 +0000 UTC,56434,53,392012-03-16 13:30:07.33 +0000 UTC,137,137,58...
To save the output into a new file, simply redirect the standard output:
$ net.dump -r UDP.ncap.gz -select Timestamp,SrcPort,DstPort,Length -utc > UDP.csv