nstreams(1)
β¨ nstreams(1) β the tcpdump output analyzer β¨
okay bestie, gather round, because today we're talking about nstreams π the lil utility that stares at a tcpdump dump that's several megabytes of absolutely unhinged nonsense and goes "mmm yes, I see the streams, I gotchu" π¦
πΈ NAME πΈ
nstreams β a tcpdump output analyzer π
π SYNOPSIS π
nstreams [ -v ] [ -c nstreams-services ] [ -n nstreams-networks_file ] [
-N [ -i ] [ -I ]] [ -r ] [ -O output [ -D iface ] [ -Y ]] [ -u ] [ -U ]
[ -B ] [ -f tcpdump_file ] [ -l <iface> ] [ tcpdump output ]
like, that's a lot of brackets, but we're gonna get through them together, fr fr π«Ά
π« DESCRIPTION π«
So. nstreams is a utility designed to identify the IP streams that are occuring on a network β from a non-user-friendly tcpdump output of several megabytes. Yes, several megabytes. Of tcpdump. We've all been there π
This is especially useful when you're planning to install a firewall but you literally have no idea what nstreams the network users are generating (http, real audio, and more...) π So instead of guessing, you just... let nstreams look at the dump and tell you.
nstreams can read the tcpdump output directly from stdin, or from a file β whichever vibe you're on. And it can even generate the configuration file of your firewall, using the -O option. main character energy, honestly π
β¨ OPTIONS β¨
-c <nstreams-services-file>β the path to an alternate nstreams service file. This file is what's used to identify each protocol. Peep the services file section later in this manual page for the tea π-n <nstreams-networks-file>β the path to an alternate nstreams network file. This one's used to identify which hosts belong to which network. Again, networks file section, further down πΈ-f <tcpdump output file>β the path to the file to read data from. IMPORTANT bestie: this file must have been generated usingtcpdump -w filenameπ«Ά-l <iface>β listen directly on interface<iface>. This avoids the use of tcpdump entirely. living tcpdump-free, iconic π-Nβ print the networks names instead of the hosts IP addresses. Heads up: the intra-network traffic will not be shown. Use this option twice to show the networks IP address instead of their names π-iβ also show the intra-network traffic (must be used with-N)-Iβ only show the intra-network traffic (must be used with-N)-rβ be redundant. That is, the same streams will be printed each time they appear in the dump π-vβ print version number and exit. short and sweet, we respect it β¨-O <type>β output type. You can use this option to generate your firewall startup script π₯ Donstreams -hto see the supported output types.-D <iface>β interface to apply to output onto. Must be used with-O.-Yβ the firewall rules that will be generated will deny all packets coming from the outside trying to establish connections to the inside. If you system is not serving anything, then it's safe to turn on this option. π-uβ do not print the unknown streams π-Uβ only print the unknown streams π-Bβ show broadcasts and networks π‘
π USAGE π
Let tcpdump(1) run some time on your network (like one week β yes, a whole week, go touch grass, it'll be fine π±), and save its output in a file, by doing:
tcpdump -l -n > output
or
tcpdump -w filename
Then, feed nstreams with this output file, and it will turn it into a easily-readable file which will help you to write efficient firewall filters π
You may also do:
tcpdump -l -n | nstreams
or
nstreams -f filename
(if you used tcpdump -w) π«Ά
π§ THE SERVICES FILE π§
The service file contains the description of each protocol, as well as their name. Its syntax is:
protocol_name:server_port(s)/{udp,tcp}:client_ports(s)
or:
protocol_name:type(s)/icmp:code(s)
Whereas:
protocol_nameβ is the name of the protocol described. This name may contain any character, including space, except':'. yes, ANY character, except the one πserver_port(s)β is the range of ports used by the server. Usually, you will want to define one server port only, but you may enter any range you want.ip_protocolβ is the IP protocol that this protocol is lying onto. Acceptable values aretcpandudpπclient_port(s)β is the range of ports that the client may use. You can set this toanyor, for more accurate results, to ports ranges, like'1-1024,2048-4096'. The rules are: 'first match, first taken' β
πΈ SERVICE FILE EXAMPLE πΈ
Using this syntax, you would declare the ssh protocol by:
ssh-unix:22/tcp:1000-1023
Because the Unix version of the ssh client uses a privileged port to connect onto the ssh server which listens on port 22. slay, correct, no notes π
π¦ THE NETWORKS FILE π¦
The networks file is used to define sets and subsets of hosts (also known as networks). This avoids redundancy in the output file. The syntax format for this file is:
network name:ip/mask
Whereas the network name is whatever you want, the IP is the ip of the network, and the mask is the CIDR netmask of the network. The rule is 'first match, first taken' π
β NETWORKS FILE EXAMPLE β
admin:192.168.19.0/29
whole_subnet:192.168.0.0/16
internet:0.0.0.0/0
look at that lil hierarchy, it's giving organized π
π LIMITS π
nstreamscan only parse the output oftcpdump -nβ that's the one, that's the only one, no cap.- Even though the output of
nstreamsis easier to read than the one oftcpdump, it is still not easily readable. Usesort(1)on the nstream output to get a more readable file. (ngl this is the realest thing in this whole manpage π) - This program could have been written in perl π
π FILES π
/etc/nstreams-services
/etc/nstreams-networks
π₯ SEE ALSO π₯
π AUTHORS π
- Concept: Herve Schauer Consultants β http://www.hsc.fr
- Coding: Renaud Deraison
<deraison@cvs.nessus.org>
π«Ά BUG REPORTS π«Ά
Please send all your bug reports with the detail of your configuration to Renaud Deraison <deraison@cvs.nessus.org> π
and that's the whole page, bestie!! this one's from the nstreams manual, July 1999, and yeah we're still out here reading nstreams(1) in the year of our lord. the vibes are immaculate, the facts are untouched, periodt β¨π
π
π¦ where this page comes from
- debian bookworm: nstreams 1.0.4-1+b1
- debian trixie: nstreams 1.0.4+ds-0.1 Β· GPL-2.0-or-later
- ubuntu jammy: nstreams 1.0.4-1build1
- ubuntu noble: nstreams 1.0.4-1.1
- ubuntu questing: nstreams 1.0.4+ds-0.1
- ubuntu resolute: nstreams 1.0.4+ds-0.1build1 Β· GPL-2.0-or-later
- ubuntu stonking: nstreams 1.0.4+ds-0.1build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms