Exemple #1
0
 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())
Exemple #2
0
 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()