コード例 #1
0
def test_radius_parse(data):
    """Tests the radiuse_parse function
    Args:
        data: payload to parse"""

    try:
        # The dict sets the packet ID for the known packet_id (test/fuzzer/radius_packet*.ex)
        #  to none. so no validation is done.
        MessageParser.radius_parse(data,
                                   "SECRET",
                                   radius_lifecycle=namedtuple(
                                       'RadiusLifecycle',
                                       'packet_id_to_request_authenticator')(
                                           NoneDict()))
    except MessageParseError:
        # Ignore exceptions the parser intentionally throws, and are caught by the caller.
        pass
コード例 #2
0
 def receive_radius_messages(self):
     """receive RADIUS messages from RADIUS server forever."""
     while self.running():
         sleep(0)
         self.logger.info("waiting for radius.")
         packed_message = self.radius_socket.receive()
         try:
             radius = MessageParser.radius_parse(packed_message,
                                                 self.radius_secret,
                                                 self.radius_lifecycle)
         except MessageParseError as exception:
             self.logger.warning(
                 "MessageParser.radius_parse threw exception.\n"
                 " packed_message: '%s'.\n"
                 " exception: '%s'.", packed_message, exception)
             continue
         self.logger.info("Received RADIUS message: %s", str(radius))
         self.send_radius_to_state_machine(radius)