lzp819739483 / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

'module' object has no attribute 'dport' #95

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

According to the documentation, there should be an attribute called 'tcp.dport' 
in the tcp.py script. However when I try to call the object from the TCP class 
in tcp.py, I have an anttribute error as shown in the summary. I've already 
assigned eth.data to tcp, what seems to be the issue here?

My code: (I've tried)

dstport = dpkt.tcp.TCP.dport
dstport = dpkt.tcp.dport

Original issue reported on code.google.com by daw...@un0wn.org on 3 Sep 2012 at 2:47

GoogleCodeExporter commented 9 years ago
I also got the same error while accessing dport

Original comment by ali.huss...@ebryx.com on 31 Jan 2013 at 7:28

GoogleCodeExporter commented 9 years ago
will work much better when you actually use the right convention.

    for ts, buf in pcap:
        eth = dpkt.ethernet.Ethernet(buf)
        #we only care about IP packets for now
        if eth.type != dpkt.ethernet.ETH_TYPE_IP:
            continue
        ip = eth.data
        #example implements TCP data reading only
        if ip.p = 6:

            tcp = ip.data
            dstport=tcp.dport

Original comment by kyle.creyts@gmail.com on 31 Jan 2013 at 2:14