- prdrill.vbs
' -----------------
' Declare variables
' -----------------
Set Sout = WScript.Stdout
' -----------------------
' Check usage & arguments
' -----------------------
if WScript.Arguments.Count <> 2 then
Sout.Writeline "Usage: prdrill <filename> <pktid>"
WScript.Quit
end if
ArgFile = WScript.Arguments.Item(0)
PktIdx = WScript.Arguments.Item(1)
Set UnsniffDB = CreateObject("Unsniff.Database")
UnsniffDB.Open(ArgFile)
Sout.Writeline "Number of packets = " & UnsniffDB.PacketCount
Set PacketStore = UnsniffDB.PacketIndex
Set Packet = PacketStore(PktIdx)
Set ProtocolLayers = Packet.Layers
For Each Layer In ProtocolLayers
Sout.Writeline "Layer=" & Layer.Name
Set Fields = Layer.Fields
For Each Field In Fields
PrintField 2, Field
Next
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