Exemplo n.º 1
0
class UACParameters(ndr.NdrParameters):
    MEMBERS = [
        ndr.NdrUniquePTR(ndr.NdrWString),
        ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrLong, ndr.NdrLong,
        ndr.NdrWString, ndr.NdrWString, NdrUACStartupInfo, ndr.NdrLong,
        ndr.NdrLong
    ]
Exemplo n.º 2
0
class RAiLaunchAdminProcessParameters(ndr.NdrParameters):
    MEMBERS = [
        ndr.NdrUniquePTR(ndr.NdrWString),
        ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrLong, ndr.NdrLong,
        ndr.NdrWString, ndr.NdrWString, NdrUACStartupInfo, ndr.NdrLong,
        ndr.NdrLong
    ]
Exemplo n.º 3
0
class PLSAPR_OBJECT_ATTRIBUTES(ndr.NdrStructure):
    MEMBERS = [ndr.NdrLong,
                ndr.NdrUniquePTR(ndr.NdrWString),
                ndr.NdrUniquePTR(ndr.NdrLong), # We dont care of the subtype as we will pass None
                ndr.NdrLong,
                ndr.NdrUniquePTR(ndr.NdrLong), # We dont care of the subtype as we will pass None
                ndr.NdrUniquePTR(ndr.NdrLong)] # We dont care of the subtype as we will pass None
Exemplo n.º 4
0
class ComplexAlignementStructure(ndr.NdrStructure):
    MEMBERS = [
        ndr.NdrByte,
        ndr.NdrUniquePTR(ndr.NdrByte),
        ndr.NdrUniquePTR(ndr.NdrLong), ndr.NdrByte,
        ndr.NdrUniquePTR(ndr.NdrHyper),
        ndr.NdrUniquePTR(ndr.NdrByte)
    ]
Exemplo n.º 5
0
class NdrUACStartupInfo(ndr.NdrStructure):
    MEMBERS = [ndr.NdrUniquePTR(ndr.NdrWString),
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                ndr.NdrLong,
                NDRPoint]
Exemplo n.º 6
0
class SvcMoveFileInheritSecurity(ndr.NdrParameters):
    MEMBERS = [ndr.NdrUniquePTR(ndr.NdrWString),
                ndr.NdrUniquePTR(ndr.NdrWString),
                ndr.NdrLong]
Exemplo n.º 7
0
class Towers(ndr.NdrConformantVaryingArrays):
    MEMBER_TYPE = ndr.NdrUniquePTR(NdrTower)
Exemplo n.º 8
0
class EptMapAuthParameters(ndr.NdrParameters):
    MEMBERS = [
        NDRIID, NdrTower,
        ndr.NdrUniquePTR(ndr.NdrSID), NdrContext, ndr.NdrLong
    ]
Exemplo n.º 9
0
            [ndr.NdrShort, InternalAlignementStructure, ndr.NdrShort]),
        (0x0101, [0x4141, 0x42, 0x43434343, 0x44, 0x4545, 0x46], 0x4747),
        # Verified with an actual RPC server
        b"\x01\x01PPAABPCCCCDPEEFPGG"),
    # Complex struct alignement
    # A struct with both primitive field & pointer to primitiv field of various size
    (ComplexAlignementStructure,
     [0x41, 0x42, 0x43434343, 0x44, 0x4545454545454545, 0x46],
     b"APPP\x02\x02\x02\x02\x03\x03\x03\x03\x44PPP\x05\x05\x05\x05\x06\x06\x06\x06BPPPCCCCEEEEEEEEF"
     ),

    # Complex struct alignement with nesting (due to uniqueptr at the start)
    # The last hyper is not aligned/pad like previous test due to the leading UniquPTR
    # This is the proof that NDR packing cannot be in "context-free" sub function and must share a state
    # This test fails for now (0.6) and I don't know if I will implem the full NDR logic someday
    (ndr.NdrUniquePTR(ComplexAlignementStructure),
     [0x41, 0x42, 0x43434343, 0x44, 0x4545454545454545, 0x46],
     b"\x01\x01\x01\x01APPP\x02\x02\x02\x02\x03\x03\x03\x03\x44PPP\x05\x05\x05\x05\x06\x06\x06\x06BPPPCCCCPPPPEEEEEEEEF"
     )
]


@pytest.mark.parametrize("ndrobj, values, result", NDR_PACK_TEST_CASE)
def test_ndr_packing(ndrobj, values, result):
    assert ndrobj.pack(values) == result


# Check the result of serializing a fixed 'EptMapAuthParameters' call known to works
# It allow to test for packing of real-complexe Parameter without relying on the whole ALPC/RPC stack
def test_ndr_packing_complex_epmapper_call():
    # Param from a real UAC endpoint resolution
Exemplo n.º 10
0
class LsarOpenPolicy2Parameter(ndr.NdrParameters):
    MEMBERS = [
        ndr.NdrUniquePTR(ndr.NdrWString), PLSAPR_OBJECT_ATTRIBUTES, ndr.NdrLong
    ]