def receive_offer(self, pkt): if pkt[MSGTYPE].code == 53: if pkt[MSGTYPE].type == 2: log_scapy.debug("I've got DHCP Offer, and should send Request.") self.your_client_ip = pkt[BOOTP].yiaddr self.server_id = pkt[SERVID].server_id raise self.RCVD_OFFER(pkt)
def receive_ack(self, pkt): if pkt[MSGTYPE].code == 53: if pkt[MSGTYPE].type == 5: #if pkt.haslayer(SERVID) and pkt[SERVID].server_id == self.server_id: #request without servid when client reboot log_scapy.debug("I've got DHCP ACK.") raise self.RCVD_ACK()
def on_ERROR(self): log_scapy.debug("This is action:Error happened, the automata will be ended.")
def timeout_waiting(self): log_scapy.debug("This is timeout condition: I don't get what I want, I'll retry or raise ERROR state.") if self._cur_retry < self._max_retry: raise self.SEND_DISCOVER() else: raise self.ERROR()
def WAITING(self): log_scapy.debug("This is WAITING state.")