tcpflow

tcpflow is a program that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging. Each TCP flow is stored in its own file. Thus, the typical TCP flow will be stored in two files, one for each direction. tcpflow can also process stored tcpdump packet flows.

tcpflow stores all captured data in files that have names of the form: [timestampT]sourceip.sourceport-destip.destport[--VLAN][cNNNN]

where: timestamp is an optional timestamp of the time that the first packet was seen T is a delimiter that indicates a timestamp was provided sourceip is the source IP address sourceport is the source port destip is the destination ip address destport is the destination port VLAN is the VLAN port c is a delimiter indicating that multiple connections are present NNNN is a connection counter, when there are multiple connections with the same [time]/sourceip/sourceport/destip/destport combination.

Usage

Usage: tcpflow [options] [expression]

OptionDescription
-ado ALL post-processing.
-b max_bytesmax number of bytes per flow to save
-d debug_leveldebug level; default is 1
-fmaximum number of file descriptors to use
-Hprint detailed information about each scanner
-inetwork interface on which to listen
-Iwrite for each flow another file *.findx to provide byte-indexed timestamps
-goutput each flow in alternating colors (note change!)
-ltreat non-flag arguments as input files rather than a pcap expression
-L semlockspecifies that writes are locked using a named semaphore
-pdon’t use promiscuous mode
-qquiet mode - do not print warnings
-r fileread packets from tcpdump pcap file (may be repeated)
-R fileread packets from tcpdump pcap file TO FINISH CONNECTIONS
-vverbose operation equivalent to -d 10
-Vprint version number and exit
-w filewrite packets not processed to file
-o outdirspecify output directory (default ’.‘)
-X filenameDFXML output to filename
-m bytesspecifies skip that starts a new stream (default 16777216)
-F{p}filename prefix/suffix (-hh for options)
-T{t}filename template (-hh for options; default %A.%a-%B.%b%V%v%C%c)
-Zdo not decompress gzip-compressed HTTP transactions
-Koutput/keep pcap flow structure.
-U userrelinquish privileges and become user (if running as root)
-z dirchroot to dir (requires that -U be used)
-E scannerturn off all scanners except scanner
-S name=valueSet a configuration parameter (-hh for info)
-Bbinary output, even with -c or -C (normally -c or -C turn it off)
-cconsole print only (don’t create files)
-Cconsole print only, but without the display of source/dest header
-0don’t print newlines after packets when printing to console
-sstrip non-printable characters (change to ’.‘)
-Joutput JSON format.
-Doutput in hex (useful to combine with -c or -C)