source:
swig/python/check.py
@
548da5c
Last change on this file since 548da5c was d5e7d91, checked in by Daniel Lawson <dlawson@…>, 18 years ago | |
---|---|
|
|
File size: 571 bytes |
Rev | Line | |
---|---|---|
[4e194bc] | 1 | #!/usr/bin/python |
2 | import libtrace | |
3 | import sys | |
4 | ||
5 | trace = libtrace.Trace(sys.argv[1]) | |
6 | ||
7 | print "trace=",trace | |
8 | ||
9 | ||
[77ba31d] | 10 | packet = libtrace.Packet() |
[4e194bc] | 11 | |
[6f34090] | 12 | count = 0 |
[f2794ea] | 13 | |
[d5e7d91] | 14 | filter = libtrace.Filter("tcp") |
[f2794ea] | 15 | |
[4e194bc] | 16 | while 1: |
[2980487] | 17 | trace.trace_read_packet(packet) |
[4e194bc] | 18 | if not packet: |
19 | break | |
[f2794ea] | 20 | |
[6f34090] | 21 | ippacket = packet.trace_get_ip() |
22 | if not ippacket: | |
23 | continue | |
[2980487] | 24 | |
[d5e7d91] | 25 | count += 1 |
26 | if count % 10000 == 0: | |
27 | print count | |
[f2794ea] | 28 | |
[d5e7d91] | 29 | #tcppacket = packet.trace_get_tcp() |
30 | #if not tcppacket: | |
31 | # continue | |
32 | ||
33 | #if not packet.trace_bpf_filter(filter): | |
34 | # continue | |
[f2794ea] | 35 | |
[d5e7d91] | 36 | #print ippacket.ip_src,':',tcppacket.source,'->',ippacket.ip_dst,':',tcppacket.dest |
[4e194bc] | 37 |
Note: See TracBrowser
for help on using the repository browser.