pdudrull.rb
# ------------------------------------------------------------------
# pdudrill.rb	Print all fields in a PDU (drilldown)
#	usage : pdudrill <capture-file> <pduid> 
#
#
# ------------------------------------------------------------------
require 'win32ole'
 
USAGE = "pdudrill <capture-filename> <pdu-id>"
 
 
# function printField
#	Formats and prints a field (also subfields if present)
#
def printField(indent, field)
	pad = "  "*indent
	print pad
	print "#{field.Name}\t\t #{field.Value} \n" 
 
	if field.SubFieldCount > 0 
		field.SubFields.each { |f| printField(indent+2, f) }
	end
end
 
 
if ARGV.length != 2
	puts USAGE
	exit 1
end
 
InputFile = ARGV[0]
PduID     = ARGV[1]
UnsniffDB = WIN32OLE.new("Unsniff.Database")
UnsniffDB.Open(InputFile)
 
 
PDU = UnsniffDB.PDUIndex(PduID)
PDU.Fields.each { |field| printField(1,field) }
 
UnsniffDB.Close()
unsniff/samples/pdudrill/ruby.txt · Last modified: 2014/09/11 23:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki