Beispiel #1
0
 def test_parse_message_domain_sid(self):
     actual = SIDPacket()
     data = b"\x01" \
            b"\x05" \
            b"\x00\x00" \
            b"\x00\x00\x00\x05" \
            b"\x15\x00\x00\x00" \
            b"\x3a\x8d\x4b\xc1" \
            b"\xa5\x92\x3e\xe1" \
            b"\xb9\x36\xe4\x62" \
            b"\x50\x04\x00\x00"
     actual.unpack(data)
     assert len(actual) == 28
     assert str(actual) == "S-1-5-21-3242954042-3778974373-1659123385-1104"
     assert actual['revision'].get_value() == 1
     assert actual['sub_authority_count'].get_value() == 5
     assert actual['reserved'].get_value() == 0
     assert actual['identifier_authority'].get_value() == 5
     sub_auth = actual['sub_authorities'].get_value()
     assert isinstance(sub_auth, list)
     assert len(sub_auth) == 5
     assert sub_auth[0] == 21
     assert sub_auth[1] == 3242954042
     assert sub_auth[2] == 3778974373
     assert sub_auth[3] == 1659123385
     assert sub_auth[4] == 1104
Beispiel #2
0
 def test_parse_message(self):
     actual = SIDPacket()
     data = b"\x01" \
            b"\x01" \
            b"\x00\x00" \
            b"\x00\x00\x00\x01" \
            b"\x00\x00\x00\x00"
     actual.unpack(data)
     assert len(actual) == 12
     assert str(actual) == "S-1-1-0"
     assert actual['revision'].get_value() == 1
     assert actual['sub_authority_count'].get_value() == 1
     assert actual['reserved'].get_value() == 0
     assert actual['identifier_authority'].get_value() == 1
     sub_auth = actual['sub_authorities'].get_value()
     assert isinstance(sub_auth, list)
     assert len(sub_auth) == 1
     assert sub_auth[0] == 0