Packet Capture, part 3: Analysis Tools - Page 2

 By O'Reilly Press
Page 2 of 6   |  Back to Page 1
Print Article

1.5.2. tcpdpriv

The program tcpdpriv is another program for removing sensitive information from tcpdump files. There are several major differences between tcpdpriv and sanitize. First, as a shell script, sanitize should run on almost any Unix system. As a compiled program, this is not true of tcpdpriv. On the other hand, tcpdpriv supports the direct capture of data as well as the analysis of existing files. The captured packets are written as a tcpdump file, which can be subsequently processed.

Also, tcpdpriv allows you some degree of control over how much of the original data is removed or scrambled. For example, it is possible to have an IP address scrambled but retain its class designation. If the -C4 option is chosen, an IP address such as might be replaced with Notice that address classes are preserved -- a class C address is replaced with a class C address.

There are a variety of command-line options that control how data is rewritten, several of which are mandatory. Many of the command-line options will look familiar to tcpdump users. The program does not allow output to be written to a terminal, so it must be written directly to a file or redirected. While a useful program, the number of required command-line options can be annoying. There is some concern that if the options are not selected properly, it may be possible to reconstruct the original data from the scrambled data. In practice, this should be a minor concern.

As an example of using tcpdpriv, the following command will scramble the file tracefile:

bsd1# tcpdpriv -P99 -C4 -M20 -r tracefile -w outfile

The -P99 option preserves (doesn't scramble) the port numbers, -C4 preserves the class identity of the IP addresses, and -M20 preserves multicast addresses. If you want the data output to your terminal, you can pipe the output to tcpdump:

bsd1# tcpdpriv -P99 -C4 -M20 -r tracefile -w- | tcpdump -r-

The last options look a little strange, but they will work.

This article was originally published on Nov 20, 2001
Get the Latest Scoop with Networking Update Newsletter