예제 #1
0
class IterClassFile(object):
	"""
	Wrapper class to iterate over packets from psocket
	"""
	def __init__(self):
		self.reader = Reader(filename="../tests/packets_ether.pcap", lowest_layer=ethernet.Ethernet)

	def __iter__(self):
		while True:
			# time.sleep(0.5)
			try:
				# print("reading next....")
				pkt = self.reader.__next__()[1]
				if type(pkt) is bytes:
					print("only bytes..")
					continue
				yield pkt
			except StopIteration:
				break
			except:
				continue
		self.reader.close()
예제 #2
0
class IterClassFile(object):
    """
	Wrapper class to iterate over packets from psocket
	"""
    def __init__(self):
        self.reader = Reader(filename="../tests/packets_ether.pcap",
                             lowest_layer=ethernet.Ethernet)

    def __iter__(self):
        while True:
            # time.sleep(0.5)
            try:
                # print("reading next....")
                pkt = self.reader.__next__()[1]
                if type(pkt) is bytes:
                    print("only bytes..")
                    continue
                yield pkt
            except StopIteration:
                break
            except:
                continue
        self.reader.close()
예제 #3
0
 def __init__(self):
     self.reader = Reader(filename="../tests/packets_ether.pcap",
                          lowest_layer=ethernet.Ethernet)
예제 #4
0
	def __init__(self):
		self.reader = Reader(filename="../tests/packets_ether.pcap", lowest_layer=ethernet.Ethernet)