This shows you the differences between two versions of the page.
— |
unsniff:samples:pdudrill:vbs [2014/09/11 23:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <file vb pdudrill.vbs> | ||
+ | ' ----------------- | ||
+ | ' Declare variables | ||
+ | ' ----------------- | ||
+ | Set Sout = WScript.Stdout | ||
+ | ' ----------------------- | ||
+ | ' Check usage & arguments | ||
+ | ' ----------------------- | ||
+ | if WScript.Arguments.Count <> 2 then | ||
+ | Sout.Writeline "Usage: pdudrill <filename> <pduid>" | ||
+ | WScript.Quit | ||
+ | end if | ||
+ | |||
+ | ArgFile = WScript.Arguments.Item(0) | ||
+ | PduIdx = WScript.Arguments.Item(1) | ||
+ | |||
+ | |||
+ | Set UnsniffDB = CreateObject("Unsniff.Database") | ||
+ | UnsniffDB.Open(ArgFile) | ||
+ | |||
+ | Set PDUStore = UnsniffDB.PDUIndex | ||
+ | Set PDU = PDUStore(PduIdx) | ||
+ | Set Fields = PDU.Fields | ||
+ | |||
+ | For Each Field In Fields | ||
+ | PrintField 2, Field | ||
+ | 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 | ||
+ | </file> |