Automated searching in gzip/chunk/encrypted content with Unsniff

A key capability required in network forensics is to be able to search for a string in a collection of pcap files or live traffic. You may want to search for a name with the intention of finding any relevant emails, tweets, followers, facebook, etc.  Naive packet level string matching wont work for the following reasons.

  1. The transport is usually TCP so reassembly is needed before matching
  2. The protocol is usually HTTP, so must process HTTP headers
  3. Chunked encoding
  4. GZIPped content
  5. Encrypted content ( pretty much a dead end unless you are using a non EDH and have access to the private key)

Unsniff Network Analyzer allows you to search inside user objects after taking into account all of the above factors. To use the UI, switch to the User objects sheet, then press Ctrl+F and enter your patterns.  The UI works great in many cases, but many times you want to do more automatically.

These days javascript heavy websites like twitter use JSON as the dominant interchange format. Instead of sending back full HTML webpages – chunks of JSON are used to build the final user interface. So in order to present results (such as a twitter followers list) you need to wrap the results in your own application. This post tells you how to use the Scripting Interface to accomplish that.

  1. Download and install the latest Unsniff from http://www.unleashnetworks.com/downloads.html

Assume you want to search for a pattern “mickey” in all content.

Step 1 : Have your program dump your packets into a libpcap file – say mypackets.pcap

Step 2 : Copy the following script into a directory in a file named searchuo.vbs

Step 3: Run the script like this

Step 4: All user objects – mails, attachments, contacts and any HTTP exchanges gzipped or chunked will be reassembled and put as separate files into that directory

Step 5 : Your code should read these files and integrate them into your UI. For example, Yahoo mails come as JSON, so maybe you can parse the JSON or display raw text with the pattern highlighted etc. Its your call.

In this mode, Unsniff will be the engine for content extraction.  You can then integrate the files into your own application.

Author: Vivek Rajagopalan

Vivek Rajagopalan is the a lead developer for Trisul Network Analytics. Prior products were Unsniff Network Analyzer and Unbrowse SNMP. Loves working with packets , very high speed networks, and helping track down the bad guys on the internet.