예제 #1
0
class EXSObjectHeader(Struct):
    type_signature = integer()
    size = integer()
    object_id = integer()
    unknown = integer()
    atom = string(
        size=4,
        null_terminated=False,
        validate=lambda v: v in ('TBOS', 'JBOS'))
    name = string(size=64)
예제 #2
0
class BitStruct(Struct):
    int_a = integer(signed=False, endianness=Big)

    empty_space = empty(size=3)

    bits = bitfield(
        empty(),
        bit(),
        empty(size=5),
        bit(),
    )

    bit_a, bit_b = bits.expand()

    int_b = integer(signed=False, endianness=Big)
예제 #3
0
class MyStruct(Struct):
    int_a = integer(signed=False, endianness=Big)

    empty_space = empty(size=3)

    bits = bitfield(
        empty(),
        bit(),
        empty(size=5),
        bit(),
    )

    bit_a, bit_b = bits.expand()

    embedded = embed(EmbeddedStruct, default=EmbeddedStruct(2, 3, 4, 5))
예제 #4
0
class ArrayStruct(Struct):
    array1 = array(
        integer(signed=False, endianness=Big, validate=lambda x: x < 50))
예제 #5
0
class ArraySwitchStruct(Struct):
    array1 = array(
        one_of(
            integer(signed=False, endianness=Big, validate=lambda x: x < 0x10),
            integer(signed=False, endianness=Big,
                    validate=lambda x: x > 0x20)))
예제 #6
0
class VariableSizeSwitchStruct(Struct):
    value = one_of(string(size=20), integer(endianness=Big))
예제 #7
0
class SwitchStruct(Struct):
    int_a = one_of(
        integer(signed=False, endianness=Big, validate=lambda x: x < 50),
        integer(signed=False, endianness=Little, validate=lambda x: x > 100))
예제 #8
0
class EmbeddedSwitchStruct2(Struct):
    int1 = integer(signed=False, endianness=Big, default=1)
    int2 = integer(signed=False, endianness=Big, default=2)
    int3 = integer(signed=False, endianness=Big, default=3)
예제 #9
0
class EmbeddedStruct(Struct):
    int_b = integer(signed=False, endianness=Big)
    int_c = integer(signed=False, endianness=Big)
    int_d = integer(signed=False, endianness=Big)
    int_e = integer(signed=False, endianness=Big)
예제 #10
0
class StringStruct(Struct):
    int_a = integer(signed=False, endianness=Big)
    str_a = string(size=4, null_terminated=False)
    int_b = integer(signed=False, endianness=Big)
예제 #11
0
class IntStruct(Struct):
    int_a = integer(signed=False, endianness=Big)
예제 #12
0
class EmbedStruct(Struct):
    struct_a = embed(IntStruct)
    int_b = integer(signed=False, endianness=Big)
예제 #13
0
class BasicStruct(Struct):
    int_a = integer(signed=False, endianness=Big)
    int_b = integer(signed=False, endianness=Big)
예제 #14
0
class EmptyStruct(Struct):
    int_a = integer(signed=False, endianness=Big)
    empty_space = empty(size=3)
    int_b = integer(signed=False, endianness=Big)
예제 #15
0
class IntStruct(Struct):
    signature = integer(signed=False,
                        endianness=Big,
                        validate=lambda x: x == 1234)
예제 #16
0
class ValidStruct(Struct):
    int_a = integer(signed=False, endianness=Big, validate=lambda x: x < 50)
    int_b = integer(signed=False, endianness=Big, validate=lambda x: x > 50)
    embedded = embed(IntStruct, default=IntStruct(signature=1234))