File: udp.py

package info (click to toggle)
python-libtrace 1.6%2Bgit20180219-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,620 kB
  • sloc: ansic: 7,465; python: 3,472; makefile: 54; sh: 49
file content (27 lines) | stat: -rw-r--r-- 439 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

# Thu, 13 Mar 14 (PDT)
# udp.py:  Demonstrate UDP objects
# Copyright (C) 2017, Nevil Brownlee, U Auckland | WAND

from plt_testing import *

t = get_example_trace('anon-v4.pcap')

n = 0;  offset = 12
for pkt in t:
    udp = pkt.udp
    if not udp:
        continue
    n += 1

    print "%4d:" % (n),
    print_udp(udp, offset)
    print

    if n == 20:
        break

t.close

print "%d packets examined\n" % (n)