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.

How to add search to your static site

Trisul’s new website is completely static. We have never been happier to finally move away from Joomla! and WordPress. There is no database, no PHP, no perl, no security upgrades. Just files and nginx.  Now I just  look at the access logs and laugh at all the sql exploit attempts. But one of the features we lost on the static site was search. I wanted to share how we used Google Custom Search to close that gap.

It is dead simple.

Go to Google Custom Search http://www.google.com/cse/

Click on Create a Custom Search Engine

Give it a name, enter sites you want to cover with the search.

Select Standard Edition. It is free, but will show ads on the search results page. No ads will be shown on the search widget itself.

Complete the process and get the javascript. Integrate the script into your static page.

Here is how it looks ready to accept input

Search box in static page

Here is how it looks when the user searches for something on your site. Notice the ads on the top. They dont bother me that much !

Search box expands in place - notice ads on top

Tools for static sites

By the way, we use the following tools for trisul.org

  • Site generator – statis
  • CSS framework – Twitter Bootstrap
  • Web server for development – adsf
  • Background textures – Subtle Patterns
  • Icons – WPZOOM
  • Forms – Google Docs
  • Search – Google Custom Search
  • Twitter feed – Twitter widget
I found all these tools by lurking on Hacker News.