def packets_for_stream(fobj, offset):
 pcap = dpkt.pcap.Reader(fobj)
 pcapiter = iter(pcap)
 (ts, raw) = pcapiter.next()
 fobj.seek(offset)
 for p in next_connection_packets(pcapiter, linktype=pcap.datalink()):
  (yield p)

def packets_for_stream ( fobj , offset ) : pcap = dpkt . pcap . Reader ( fobj ) pcapiter = iter ( pcap ) ( ts , raw ) = pcapiter . next ( ) fobj . seek ( offset ) for p in next_connection_packets ( pcapiter , linktype = pcap . datalink ( ) ) : ( yield p )
open a pcap .