Live Capture
Capture from a network interface
To capture packets live, simple use the -iface flag:
Use the -interfaces flag to list all available intefaces and their MTUs:
Promiscous Mode
Netcap uses promiscous mode by default, which requires root permissions. You can toggle this behavior with the -promisc flag:
Windows
For windows, things work a little bit different.
First, download & install the latest version of WinPcap:
Next, open a CMD prompt and run:
Note down the Identifier for your adapter of interest (here: Ethernet0), in this example the identifier is:
To capture traffic on the interface,
you must prefix the interface ID ({B1B1E59F-FA8F-4A7B-B28C-7A26F6E00F5A}) with \Device\NPF_
This leaves us with the final command:
Info: When you stop the packet capture on windows with ctrl-C you will see several errors of the format:
failed to remove file remove XXXXX.ncap.gz: The process cannot access the file because it is being used by another process.
This happens because NETCAP creates and opens files for all supported audit records types on startup, and closes them when packet capture is finished or interrupted. Since it often happens that not all supported protocols appeared in the data stream, NETCAP opens the audit record files after closing again, to check if they are empty (=only contain the NETCAP header), and if so, removes the empty audit record files.
Unfortunately, windows does not allow closing and opening a file from the same process within such small time interval, which leads to the shown error. As a consequence, empty audit record files are not removed automatically on windows.
If you know a workaround for this, please let me know.
Last updated