Esempio n. 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())
Esempio n. 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()
Esempio n. 3
0
File: cdp.py Progetto: nveeser/dino
 def _handle_dispatch(self, hdr, data):
     if self.dumper:
         self.dumper.dump(hdr, data)            
     self.frame = Ethernet.create(data)
Esempio n. 4
0
File: cdp.py Progetto: nveeser/dino
 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)