Extracting information in DNS Records with Unsniff and Ruby

There was a question in the Wireshark Q&A site that prompted this post. A user wanted to pull out IP Addresses but only from the “Answer Records” section of DNS.  All the information in Authority or Additional records section were to be ignored. The picture below describes what he was trying to accomplish with tshark.

Types of scripting

The problem is TShark does not actually expose an object model to a scripting language. The user gets the values of the fields “dns.qry.name” and “dns.resp.addr” which are tagged fields using the display filter format. Without doubt, this is a powerful capability of TShark but extending this to support adhoc scripting requirements is difficult. The solution is to dump the entire packet as text and parse if offline – a difficult ask.

How would you accomplish this with a scriptable object model ?

Unsniff Network Analyzer exposes an object model to scripting languages like Ruby and VBScript. So you can put together a quick script to walk down the protocol try which ever way you want. Lets do this example in Ruby.

Once you get hold of the packets you want, you use the same field names in the GUI to navigate the protocol tree. The key pieces in the above ruby code are :

  • Import the pcap file

  • Iterate over all packets and only work on QUERY Response. The same string is shown in the user interface, so it is easy to remember this string.

  • Find the “Answer Records” section in the “DNS” layer and process each record

Running this

If you run the above script

You get something like this

 

Add Unsniff to your toolkit

The beauty of Unsniff is you can script higher layer objects the same way using the UserObjects model. For example you can save all Images matching a certain name or size or whatever. Check out the samples here

  • Download Unsniff Network Analyzer for free here

Trisul screencast – retrieve POST data from full packet capture

This is a real story. I spent about 30 mins composing and posting a thoughtful message to an online forum. Upon hitting submit, something broke and the server returned an error. Hitting the back button or pressing refresh did not work. After a burst of profanity, I recalled that we have a full capture NSM tool (Trisul) running in our company. In a little $500 appliance, capturing every flow, URL, and packet our two ISP connections see.

I was able to recover my message within 1 minute.

This little 4-minute screencast shows you how to

  1. Pull up list of URLs
  2. Use the form to filter POST requests to specific server
  3. Pull out PCAPs into a reconstruction tool like Unsniff Network Analyzer
  4. Locate data in reconstructed (ie, unzipped, dechunked) content

Please excuse the poor audio and the developers voice !

The next post will be about automating this whole process using Ruby and Trisul Remote Protocol.

——————————–

Deploy Trisul Network Analytics today to track everything about your network along with a slick web based user interface to perform complex drilldowns. All you need is a Linux box.

It is totally free for monitoring a recent 3-day window. Get it now.

New Cisco SNMP MIB Package available for Unbrowse

Hey SNMP Heads,

Cisco MIB ListWe just uploaded a new MIB package containing all public CISCO MIBs updated till date. You can import this package into Unbrowse SNMP in 5 minutes and you can start working with SNMP right away.

This package contains 1341 Modules and over 120,000 objects.

  • Please download it from  here. (42.1 MB).
  • Instructions to install it are here

Also if you have updated your Unbrowse SNMP copy, do it today. There have been quite a number of fixes specifically with IPv6 and SNMPv3 INFORMS in newer builds.

Happy MIB Walking.