On 12/07/2007 11:44 AM, YeungXS67 wrote:
> The source of this error is this (sub "begin_capture")...
It's not a "sub", it's a function. You were supposed to tell us which
LINE caused the error, instead of leaving us to guess. Did you actually
read my suggestion about putting some print statements before the
offending line?
>
> def begin_capture(self):
> for t, pkt in self.pcap:
> stream = dpkt.ethernet.Ethernet(pkt)
Let's guess that the following statement is the one causing the problem.
Next question: is it stream that's a 'str' object (with no attribute
called 'data', or is it stream.data? Use print statements or a debugger
to find out!!!
> data = stream.data.data
> self.ip = "%d.%d.%d.%d" %tuple(map(ord, list(stream.data.dst)))
>
> if data.dport == self.port:
> self.process_stream(data)
>
> Its not that it behaves differently in a shell, as I don't run it in any
> shell; just through console. This is the link to the entire module:
> http://pastebin.ca/614338
>
|