' ' export3 - Exports selected individual packets to a PCAP file ' ' ----------------------- ' Check usage & arguments ' ----------------------- Set Sout = WScript.StdOut if WScript.Arguments.Count <> 3 then Sout.WriteLine "Usage: export3 <packets-csv> <from-filename> <to-filename>" WScript.Quit end if PacketsCSV = WScript.Arguments.Item(0) FromFile = WScript.Arguments.Item(1) ToFile = WScript.Arguments.Item(2) Set FromDB = CreateObject("Unsniff.Database") Set FSO = CreateObject("Scripting.FileSystemObject") FromDB.Open(FromFile) Dim PktIdxArray PktIdxArray = Split(PacketsCSV, ",", -1, 1) ' ' Save the specified packets to the target DB ' Set Packets = FromDB.PacketIndex FromDB.BeginExport "libpcap", ToFile For I = 0 To UBound ( PktIdxArray) Set Packet = Packets(I) FromDB.ExportPacket Packet Next FromDB.EndExport FromDB.Close() Sout.WriteLine "Exported selected packets to " & ToFile