def handle(self): print "[*] Handling debug event..." options = MACH_SEND_MSG _timeout = 0 if self.timeout is not None: _timeout = self.timeout options |= MACH_RCV_TIMEOUT ls_kernel.mach_msg(byref(self.reply), options, sizeof(self.reply), 0, MACH_PORT_NULL, _timeout, MACH_PORT_NULL)
def run(self): if self.eport is not None: msg = macdll_msg_t() self.reply = macdll_reply_t() while True: options = MACH_RCV_MSG | MACH_RCV_LARGE _timeout = 0 if self.timeout is not None: options |= MACH_RCV_TIMEOUT _timeout = self.timeout ls_kernel.mach_msg(byref(msg.head), options, 0, sizeof(msg), mach_port_t(self.eport), _timeout, MACH_PORT_NULL) middleware.set_callback(self.exc_handler) middleware_c.mach_exc_server(byref(msg), byref(self.reply)) else: raise Exception