Tutorial: PDF Report Generation from PCAP using t2fm

t2fm tawk database data carving


This tutorial presents t2fm, a script which generates a PDF report out of a PCAP file. Information provided in the report includes top source and destination addresses and ports, protocols and applications, DNS and HTTP activity and potential warnings, such as executable downloads or SSH connections.


For this tutorial, it is assumed the user has a basic knowledge of Tranalyzer and that the file t2_aliases has been sourced in ~/.bashrc or ~/.bash_aliases as follows (Refer to the file README.md or to the documentation for more details):

Make sure to replace $T2HOME with the actual path, e.g., $HOME/tranalyzer2-0.9.0):

Required plugins

The following plugins must be loaded for t2fm to produce a useful report:

Optional plugins

The following plugins are optional:

If one of those plugin is not loaded, messages like N/A: dnsDecode plugin required will be displayed in the PDF where the information could not be accessed.


The following packages are required to build the PDF:

  • texlive-latex-extra
  • texlive-fonts-recommended

PCAP to PDF in One Command

For simplicity, this tutorial assumes the user wants a complete report, i.e., requires all of the optional plugins.

The -b option builds and configures Tranalyzer and the plugins, the -A option opens the generated report.

t2fm -b -A -r file.pcap

Step-by-Step Instructions (PCAP to PDF)

Alternatively if you prefer to configure Tranalyzer, build the plugins and open the generated report yourself:

  1. Make sure all the plugins are configured as described in Section Prerequisites.

  2. Build Tranalyzer and the plugins (Hint: use the tab completion to avoid typing the full name of all the plugins: t2build tr<tab> ... ht<tab> ...):

    t2build tranalyzer2 basicFlow basicStats txtSink arpDecode dnsDecode httpSniffer nDPI portClassifier pwX sshDecode sslDecode

(Note that those first two steps can be omitted if t2fm -b option is used)

  1. Run t2fm directly on the PCAP file (the report will be named file.pdf):

    t2fm -r file.pcap

    (the output folder/prefix can be specified with the -w option: t2fm -r file.pcap -w ~/results/my_prefix)

  2. Open the generated PDF report file.pdf (Note that this step can be omitted if t2fm -A option is used:

    evince file.pdf

Step-by-Step Instructions (flow file to PDF)

Alternatively, if you prefer to run Tranalyzer yourself or already have access to a flow file, replace step 3 of the PCAP to PDF section with the following steps:

  • Run Tranalyzer on a pcap file as follows:

    t2 -r file.pcap -w out

  • The previous command should have created the following files:

    out_headers.txt     out_flows.txt
  • Run the t2fm script on the flow file previously generated previously:

    t2fm -F out_flows.txt

Step-by-Step Instructions (ClickHouse / MongoDB / PostgreSQL to PDF)

If one of the clickhouseSink, mongoSink or psqlSink plugins were loaded, t2fm can use the created databases to generate the report (faster).

  • Follow point 1 and 2 from the PCAP to PDF section

    (Note that HTTP_SAVE_* do not need to be set as EXE downloads detection is currently not implemented in the DB backends).

  • Build one the clickhouseSink, mongoSink or psqlSink plugin:

  • Run Tranalyzer on a pcap file as follows:

    t2 -r file.pcap -w out

  • Run the t2fm script on the database generated previously:

When generating a report from a database a time range to query can be specified with the -T option. The complete format is as follows: YYYY-MM-DD HH:MM:SS.USEC([+-]OFFSET|Z), e.g., 2018-10-01 12:34:56.912345+0100. Note that only the required fields must be specified, e.g., 2018-09-01 is equivalent to 2018-09-01 00:00:00.000000. For example, to generate a report from the 1st of September to the 11. of October 2018 at 14:59 from a PostgreSQL database, run the following command: t2fm -p tranalyzer -T "2018-09-01" "2018-10-11 14:59"

Sample Report

A sample report (IPs and passwords anonymized for privacy reasons) can be downloaded here.


This tutorial has presented how t2fm can be used to create a PDF report summarizing the traffic contained in a PCAP file. Although not discussed in this tutorial, it is also possible to use t2fm on a live interface (-i option) or on a list of PCAP files (-R option). For more details, refer to t2fm man page or use t2fm --help.