export3.rb
# ---------------------------------------------------------------
# export3.rb	-  Export selected individual packets to a file
#
#	usage : export3 <unsniff file>  <libpcap file> <packets>
#			<packets> = list of pktids, comma separated
#
#----------------------------------------------------------------
require 'win32ole'
 
USAGE = "export3 <unsniff-file> <to-libpcap-file> <packet-ids>"
 
if ARGV.length != 3
	puts USAGE
	exit 1
end
 
FromDB    = ARGV[0]
ToFile    = ARGV[1]
PacketIDs = ARGV[2]
UnsniffDB = WIN32OLE.new("Unsniff.Database")
UnsniffDB.Open(FromDB)
PacketIndex = UnsniffDB.PacketIndex
 
PacketIDArr = PacketIDs.chomp.split(/\s*,\s*/)
UnsniffDB.BeginExport("libpcap", ToFile)
PacketIDArr.each { |idx|
	packet2export = PacketIndex.Item(idx)
	UnsniffDB.ExportPacket(packet2export)
}
UnsniffDB.EndExport()
UnsniffDB.Close()
 
print "Exported #{PacketIDArr.length} selected packets  to libpcap/tcpdump file  #{ToFile}"
unsniff/samples/export3/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