Skip to content

Instantly share code, notes, and snippets.

@syakesaba
Created September 13, 2014 10:48
Show Gist options
  • Select an option

  • Save syakesaba/4b83153038888d72e3d9 to your computer and use it in GitHub Desktop.

Select an option

Save syakesaba/4b83153038888d72e3d9 to your computer and use it in GitHub Desktop.
691 class PcapWriter(RawPcapWriter):
692 def _write_header(self, pkt):
693 if self.linktype == None:
694 if type(pkt) is list or type(pkt) is tuple or isinstance(pkt,Bas
695 pkt = pkt[0]
696 try:
697 self.linktype = conf.l2types[pkt.__class__]
698 except KeyError:
699 warning("PcapWriter: unknown LL type for %s. Using type 1 (E
700 self.linktype = 1
701 RawPcapWriter._write_header(self, pkt)
702
703 def _write_packet(self, packet):████████
704 sec = int(packet.time)
705 usec = int(round((packet.time-sec)*1000000))
706 s = str(packet)
707 caplen = len(s)
708 RawPcapWriter._write_packet(self, s, sec, usec, caplen, caplen)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment