Technical Tip: How to customize Notepad++ to automate SnifTran processing of sniffed traces
| Description | This article describes how to use SnifTran, a free program to convert plain text traffic captured from FortiGate issued from 'diagnose sniffer packet ...' followed with the parameter 6 (full packets with interface and data). The resulting conversion is a new file following PCAPng format, usable in Wireshark for a graphical display and further analysis.
Here is a detailed how to get even more benefits from this tool by customizing it:
This article will describe the customization of Notepad++ on Windows :
|
| Scope | FortiGate. |
| Solution | SnifTran and Wireshark integration in Notepad++. Even if the GUI of FortiGate now allows creating packet capture, most people prefer to use CLI 'diagnose snif packet …' with option '6' in a console window or using an SSH connection.
Example of a generated text file using CLI :
diagnose snif packet any "port 443" 6
The drawback is that the packet sniffer generates a text file (for instance console-out-CLI-Console.txt) and not a PCAP file (like the GUI does directly).
As it is a text file, it is easy to open directly in Notepad++.
By using fgt2eth.exe or a better conversion tool like SnifTran, this file can be converted into a PCAP file format and opened in Wireshark… but with several manual actions. The purpose of this article is to customize Notepad++ for automation to:
The idea would be to call the following equivalent command on the displayed file, here represented by the variable $(FULL_CURRENT_PATH) :
Note: 2022+ versions of SnifTran overwrite by default the output file. With previous versions, use option '--overwrite'. This can be implemented with Notepad++ in two ways:
See how-to tutorials on NppExec exploring that option: Using Notepad++ shortcuts in two steps: first SnifTran this file; then start Wireshark on the resulting file.
Focusing on the second option, here is how to customize Notepad++ shortcuts:
<Command name="Sniftran on file" Ctrl="yes" Alt="yes" Shift="yes" Key="83" >c:\tools\sniftran.exe --in "$(FULL_CURRENT_PATH)"</Command>
By default, SnifTran will produce an output file with the same name as the input file + the suffix '.pcapng'.
When Notepad++ is restarted, it will then display new options in the 'Run' menu:
When displaying the capture text file, select Run -> Sniftran on file, wait, then select Run -> Wireshark on result. Wireshark will pop up and display the pcapng file.
Related article: |





