def data_received(self, data): frame = Ethernet(frame=data) # skip frame unless ARP if frame.ethertype == ETHERTYPE['ARP']: log.info('data length is {}'.format(len(data))) log.debug('data received {}'.format(data)) log.info(frame.info()) packet = ARP(packet=frame.payload) log.info(packet.info())
def arp_request(self, ip): packet = ARP(tha='00:00:00:00:00:00', tpa=ip, sha=self._get_mac_info(), spa=self._get_ip_info()) frame = Ethernet(dst_mac='FF:FF:FF:FF:FF:FF', src_mac=self._get_mac_info(), ethertype='ARP', payload=packet.write()) log.info(frame.info()) log.info(packet.info()) return frame.write()
def _handle_dispatch(self, hdr, data): if self.dumper: self.dumper.dump(hdr, data) self.frame = Ethernet.create(data)
def _read_cache_file(self): self.log.info("Using existing file: %s" % self.cache_filename) reader = pcapy.open_offline(self.cache_filename) (hdr, data) = reader.next() self.frame = Ethernet.create(data)