- tcpports.vbs
' -----------------
' Declare variables
' -----------------
Set Sout = WScript.Stdout
' -----------------------
' Check usage & arguments
' -----------------------
if WScript.Arguments.Count <> 1 then
Sout.Writeline "Usage: tcpport <filename>"
WScript.Quit
end if
ArgFile = WScript.Arguments.Item(0)
Set UnsniffDB = CreateObject("Unsniff.Database")
UnsniffDB.Open(ArgFile)
Set PacketStore = UnsniffDB.PacketIndex
PacketCount = PacketStore.Count
Dim FName
For I = 0 To PacketCount-1
Set Packet = PacketStore(I)
For Each Layer In Packet.Layers
If Layer.Name = "TCP" Then
Set Fields = Layer.Fields
For Each Field In Fields
FName = Field.Name
If FName = "Src Port" Then
Sout.Write Field.Value & vbTab
ElseIf FName = "Dest Port" Then
Sout.Write "--> " & Field.Value
End If
Next
Sout.Write vbCrLf
End If
Next
Next
UnsniffDB.Close()