def run(self): self.dev.unmask_interrupts() print "[+] waiting for interrupts..." read_fds = [self.dev.interface.eventfd, self.tfd] while True: ready, _, _ = select.select(read_fds, [], []) for i in ready: if i == self.dev.interface.eventfd: os.read(i, 8) self._handle_interrupt() elif i == self.tfd: b = self.mm.alloc(0x800) l = c.read(self.tfd, b, 0x800) self._send_b(b, l)
def _get_packet(self): b = self.mm.alloc(0x800) l = c.read(self.tfd, b, 0x800) return (b, l)
def _get_tap_packet(self, buf, buf_len): l = c.read(self.tfd, buf, buf_len) return (buf, l)