Esempio n. 1
0
 def next(self):
     c = pcap_next_ex(self.pcap, byref(self.header), byref(self.pkt_data))  # noqa: E501
     if not c > 0:
         return
     ts = self.header.contents.ts.tv_sec + float(self.header.contents.ts.tv_usec) / 1000000  # noqa: E501
     pkt = b"".join(chb(i) for i in self.pkt_data[:self.header.contents.len])  # noqa: E501
     return ts, pkt
Esempio n. 2
0
 def next(self):
     c = pcap_next_ex(self.pcap, byref(self.header), byref(self.pkt_data))  # noqa: E501
     if not c > 0:
         return
     ts = self.header.contents.ts.tv_sec + float(self.header.contents.ts.tv_usec) / 1000000  # noqa: E501
     pkt = b"".join(chb(i) for i in self.pkt_data[:self.header.contents.len])  # noqa: E501
     return ts, pkt