' ----------------- ' Declare variables ' ----------------- Set Sout = WScript.Stdout ' ----------------------- ' Check usage & arguments ' ----------------------- if WScript.Arguments.Count <> 3 then Sout.Writeline "Usage: dlayer <filename> <pktid> <layername>" WScript.Quit end if ArgFile = WScript.Arguments.Item(0) PktIdx = WScript.Arguments.Item(1) LayerName = WScript.Arguments.Item(2) Set UnsniffDB = CreateObject("Unsniff.Database") UnsniffDB.Open(ArgFile) Set PacketStore = UnsniffDB.PacketIndex Set Packet = PacketStore(PktIdx) Set ProtocolLayers = Packet.Layers For Each Layer In ProtocolLayers If Layer.Name = LayerName Then Sout.Writeline "Layer=" & Layer.Name Set Fields = Layer.Fields For Each Field In Fields PrintField 2, Field Next End If Next UnsniffDB.Close() Sub PrintField (Indent , Field) For I = 1 to Indent Sout.Write " " Next Dim NewIndent NewIndent = Indent + 3 Sout.Write Field.Name & _ " ( " & Field.Value & " )" & _ " [ s: " & Field.SizeBits & _ " o: " & Field.OffsetBits & " ]" & vbCrLf If Field.SubFieldCount > 0 Then For Each SubField in Field.SubFields PrintField NewIndent , SubField Next End If End Sub