def test_eapol_logoff_message_packs(self): expected_packed_message = build_byte_string( "0180c2000003001906eab88c888e01020000") message = EapolLogoffMessage( src_mac=MacAddress.from_string("00:19:06:ea:b8:8c")) packed_message = MessagePacker.pack( message, MacAddress.from_string("01:80:c2:00:00:03")) self.assertEqual(expected_packed_message, packed_message)
def test_failure_message_packs(self): expected_packed_message = build_byte_string( "000000000001001906eab88c888e0100000404ff0004") message = FailureMessage( src_mac=MacAddress.from_string("00:19:06:ea:b8:8c"), message_id=255) packed_message = MessagePacker.pack( message, MacAddress.from_string("00:00:00:00:00:01")) self.assertEqual(expected_packed_message, packed_message)
def test_success_message_packs(self): expected_packed_message = build_byte_string( "0180c2000003001906eab88c888e0100000403ff0004") message = SuccessMessage( src_mac=MacAddress.from_string("00:19:06:ea:b8:8c"), message_id=255) packed_message = MessagePacker.pack( message, MacAddress.from_string("01:80:c2:00:00:03")) self.assertEqual(expected_packed_message, packed_message)
def test_identity_request_message_packs(self): expected_packed_message = build_byte_string( "0180c2000003001906eab88c888e010000050101000501") message = IdentityMessage( src_mac=MacAddress.from_string("00:19:06:ea:b8:8c"), message_id=1, code=Eap.REQUEST, identity="") packed_message = MessagePacker.pack( message, MacAddress.from_string("01:80:c2:00:00:03")) self.assertEqual(expected_packed_message, packed_message)
def test_identity_response_message_packs(self): expected_packed_message = build_byte_string( "0180c2000003001422e9545e888e0100001102000011014a6f686e2e4d63477569726b" ) message = IdentityMessage( src_mac=MacAddress.from_string("00:14:22:e9:54:5e"), message_id=0, code=Eap.RESPONSE, identity="John.McGuirk") packed_message = MessagePacker.pack( message, MacAddress.from_string("01:80:c2:00:00:03")) self.assertEqual(expected_packed_message, packed_message)
def test_md5_challenge_response_message_packs(self): expected_packed_message = build_byte_string( "0180c2000003001422e9545e888e010000220201002204103a535f0ee8c6b34fe714aa7dad9a0e154a6f686e2e4d63477569726b" ) message = Md5ChallengeMessage( src_mac=MacAddress.from_string("00:14:22:e9:54:5e"), message_id=1, code=Eap.RESPONSE, challenge=build_byte_string("3a535f0ee8c6b34fe714aa7dad9a0e15"), extra_data=b"John.McGuirk") packed_message = MessagePacker.pack( message, MacAddress.from_string("01:80:c2:00:00:03")) self.assertEqual(expected_packed_message, packed_message)
def test_md5_challenge_request_message_packs(self): expected_packed_message = build_byte_string( "0180c2000003001906eab88c888e01000016010100160410824788d693e2adac6ce15641418228cf" ) message = Md5ChallengeMessage( src_mac=MacAddress.from_string("00:19:06:ea:b8:8c"), message_id=1, code=Eap.REQUEST, challenge=build_byte_string("824788d693e2adac6ce15641418228cf"), extra_data=b"") packed_message = MessagePacker.pack( message, MacAddress.from_string("01:80:c2:00:00:03")) self.assertEqual(expected_packed_message, packed_message)