Ejemplo n.º 1
0
 def __init__(self):
     self.fields = OrderedDict([
         ('version', IntField(
             size=4,
             default=2
         )),
         ('has_initiator_id', BoolField(
             size=1,
             default=lambda s: len(s['initiator_host_name']) > 0
         )),
         ('reserved', BytesField(
             size=3,
             default=b"\x00\x00\x00"
         )),
         ('initiator_id', UuidField(size=16)),
         ('originator_flags', EnumField(
             size=4,
             enum_type=SVHDXOriginatorFlags
         )),
         ('open_request_id', IntField(size=8)),
         ('initiator_host_name_length', IntField(
             size=2,
             default=lambda s: len(s['initiator_host_name'])
         )),
         # utf-16-le encoded string
         ('initiator_host_name', BytesField(
             size=lambda s: s['initiator_host_name_length'].get_value()
         )),
         ('virtual_disk_properties_initialized', IntField(size=4)),
         ('server_service_version', IntField(size=4)),
         ('virtual_sector_size', IntField(size=4)),
         ('physical_sector_size', IntField(size=4)),
         ('virtual_size', IntField(size=8))
     ])
     super(SMB2SVHDXOpenDeviceContextV2Request, self).__init__()
Ejemplo n.º 2
0
 def __init__(self):
     self.fields = OrderedDict([('file_id', BytesField(size=16)),
                                ('create_guid', UuidField(size=16)),
                                ('flags',
                                 FlagField(size=4,
                                           flag_type=DurableHandleFlags))])
     super(SMB2CreateDurableHandleReconnectV2, self).__init__()
Ejemplo n.º 3
0
 def __init__(self):
     self.fields = OrderedDict([
         ('object_id', UuidField()),
         ('extended_info', BytesField(
             size=48,
             default=b"\x00" * 48,
         )),
     ])
     super(FileFsObjectIdInformation, self).__init__()
Ejemplo n.º 4
0
 def __init__(self):
     self.fields = OrderedDict([
         # timeout in milliseconds
         ('timeout', IntField(size=4)),
         ('flags', FlagField(size=4, flag_type=DurableHandleFlags)),
         ('reserved', IntField(size=8)),
         ('create_guid', UuidField(size=16))
     ])
     super(SMB2CreateDurableHandleRequestV2, self).__init__()
Ejemplo n.º 5
0
 def __init__(self):
     self.fields = OrderedDict([
         ('capabilities', FlagField(
             size=4,
             flag_type=Capabilities,
         )), ('guid', UuidField()),
         ('security_mode',
          EnumField(size=2, enum_type=SecurityMode, enum_strict=False)),
         ('dialect', EnumField(size=2, enum_type=Dialects))
     ])
     super(SMB2ValidateNegotiateInfoResponse, self).__init__()
Ejemplo n.º 6
0
 def __init__(self):
     self.fields = OrderedDict([
         ('capabilities', FlagField(
             size=4,
             flag_type=Capabilities,
         )), ('guid', UuidField()),
         ('security_mode', EnumField(
             size=2,
             enum_type=SecurityMode,
         )),
         ('dialect_count',
          IntField(size=2,
                   default=lambda s: len(s['dialects'].get_value()))),
         ('dialects',
          ListField(
              size=lambda s: s['dialect_count'].get_value() * 2,
              list_count=lambda s: s['dialect_count'].get_value(),
              list_type=EnumField(size=2, enum_type=Dialects),
          ))
     ])
     super(SMB2ValidateNegotiateInfoRequest, self).__init__()
Ejemplo n.º 7
0
 def __init__(self):
     self.fields = OrderedDict([('uuid', UuidField(little_endian=False)),
                                ('version', IntField(size=4))])
     super(SyntaxIdElement, self).__init__()
Ejemplo n.º 8
0
 def test_invalid_size_none(self):
     with pytest.raises(InvalidFieldDefinition) as exc:
         UuidField(size=8)
     assert str(exc.value) == "UuidField type must have a size of 16 not 8"
Ejemplo n.º 9
0
 def __init__(self):
     self.fields = OrderedDict([('field', UuidField())])
     super(TestUuidField.StructureTest, self).__init__()