From rrpo....com on November 03, 2011 13:12:57
What steps will reproduce the problem? 1. running pcap parser 2. #!/usr/bin/env python2
import dpkt # Framework for parsing packets, use python 2.6 import sys
try: file = open(sys.argv[1], 'rb') #print sys.argv[1] pcap = dpkt.pcap.Reader(file) #print pcap lines = 0 for ts, buf in pcap: #print pkts, len(buf) eth = dpkt.ethernet.Ethernet(buf) ip = eth.data tcp = ip.data lines = lines +1 print lines if tcp.dport == 80 and len(tcp.data) > 0: http = dpkt.http.Request(tcp.data) print http.uri
file.close()
except ValueError: print "Could not open file!" What is the expected output? What do you see instead? Traceback (most recent call last): File "pcapParser.py", line 17, in tcp = ip.data AttributeError: 'str' object has no attribute 'data' What version of the product are you using? On what operating system? 1.7 Please provide any additional information below. n/a
Original issue: http://code.google.com/p/dpkt/issues/detail?id=81
该提问来源于开源项目:kbandla/dpkt