File: icmp6.py

package info (click to toggle)
python-libtrace 1.6%2Bgit20161027-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,124 kB
  • ctags: 1,357
  • sloc: ansic: 6,890; python: 3,228; makefile: 70; sh: 49
file content (31 lines) | stat: -rwxr-xr-x 505 bytes parent folder | download
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
28
29
30
31
#!/usr/bin/env python

# Sun, 23 Oct 2016 (NZDT)
# icmp6.py: Demonstrate ICMP (v4) header decodes
# Copyright (C) 2015, Nevil Brownlee, U Auckland | WAND

from plt_testing import *

t = get_example_trace('icmp6-sample.pcap')

n = 0;  nicmp = 0
offset = 12

for pkt in t:
    n += 1

    icmp6 = pkt.icmp6
    if not icmp6:
        continue

    print "%5d: " % (n),
    print_icmp6(icmp6, offset)
    print

    nicmp += 1
    #if nicmp == 10:
    #    break

t.close

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