qfield.vbs
'
' QFIELD.vbs - Print all instances of a given field in a capture file
'
Set Sout = WScript.Stdout
 
' -----------------------
' Check usage & arguments
' -----------------------
if WScript.Arguments.Count <> 3 then
	Sout.Writeline   "Usage: qfield <filename> LAYER FIELD"
	WScript.Quit
end if
 
ArgFile     = WScript.Arguments.Item(0)
LayerName   = WScript.Arguments.Item(1)
FieldName   = WScript.Arguments.Item(2)
 
 
Set UnsniffDB = CreateObject("Unsniff.Database")
UnsniffDB.Open(ArgFile)
 
Set PacketStore    = UnsniffDB.PacketIndex
 
For Each Packet in PacketStore
	Set ProtocolLayers = Packet.Layers
	For Each  Layer In ProtocolLayers
		If Layer.Name = LayerName Then
			Set Fld = Nothing
			Set Fld = Layer.FindField (FieldName)
			If Not Fld Is Nothing  Then
				PrintField Fld
			End If
		End If
	Next
Next
 
UnsniffDB.Close()
 
Sub PrintField (Field)
 
	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 SubField
		Next
	End If
End Sub				
unsniff/samples/qfield/vbs.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