def process_string_buffer(self, buffer, entry_offset): is_name_list = self['referral_entry_flags'].has_flag( DFSReferralEntryFlags.NAME_LIST_REFERRAL) buffer_fields = ['dfs_path', 'network_address'] if not is_name_list: buffer_fields.insert(1, 'dfs_alternate_path') for field_name in buffer_fields: field_offset = self['%s_offset' % field_name].get_value() if field_offset == 0: continue string_offset = field_offset - entry_offset if is_name_list and field_name == 'network_address': value = [] for _ in range(self['dfs_alternate_path_offset'].get_value()): field = TextField(null_terminated=True, encoding='utf-16-le') field.unpack(buffer[string_offset:]) value.append(field.get_value()) string_offset += len(field) else: field = TextField(null_terminated=True, encoding='utf-16-le') field.unpack(buffer[string_offset:]) value = field.get_value() setattr(self, field_name, value)
def __init__(self): self.fields = OrderedDict([ ('max_referral_level', IntField(size=2, default=4)), ('request_flags', FlagField(size=2, flag_type=DFSReferralRequestFlags)), ('request_data_length', IntField( size=4, default=lambda s: 4 + s['request_file_name_length'].get_value( ) + s['site_name_length'].get_value(), )), ('request_file_name_length', IntField( size=2, default=lambda s: len(s['request_file_name']), )), ('request_file_name', TextField( null_terminated=True, size=lambda s: s['request_file_name_length'].get_value(), )), ('site_name_length', IntField( size=2, default=lambda s: len(s['site_name']), )), ('site_name', TextField( null_terminated=True, size=lambda s: s['site_name_length'].get_value(), )), ]) super(DFSReferralRequestEx, self).__init__()
def process_string_buffer(self, buffer, entry_offset): buffer_fields = ['dfs_path', 'dfs_alternate_path', 'network_address'] for field_name in buffer_fields: field_offset = self['%s_offset' % field_name].get_value() if field_offset == 0: continue field = TextField(null_terminated=True, encoding='utf-16-le') field.unpack(buffer[field_offset - entry_offset:]) setattr(self, field_name, field.get_value())
def __init__(self): self.fields = OrderedDict([ ('version_number', IntField(size=2, default=1)), ('size', IntField(size=2)), ('server_type', EnumField(size=2, enum_type=DFSServerTypes)), ('referral_entry_flags', FlagField(size=2, flag_type=DFSReferralEntryFlags)), ('share_name', TextField(null_terminated=True)), ]) super(DFSReferralEntryV1, self).__init__()
def __init__(self): self.fields = OrderedDict([ ('file_name_length', IntField( size=4, default=lambda s: len(s['file_name']), )), ('file_name', TextField( encoding='utf-16-le', size=lambda s: s['file_name_length'].get_value(), default="", )), ]) super(FileNameInformation, self).__init__()
def __init__(self): self.fields = OrderedDict([ ('replace_if_exists', BoolField()), ('reserved', BytesField( size=7, default=b"\x00" * 7, )), ('root_directory', IntField(size=8)), ('file_name_length', IntField( size=4, default=lambda s: len(s['file_name']), )), ('file_name', TextField(size=lambda s: s['file_name_length'].get_value(), )) ]) super(FileRenameInformation, self).__init__()
def __init__(self): self.fields = OrderedDict([ ('volume_creation_time', DateTimeField()), ('volume_serial_number', IntField(size=4)), ('volume_label_length', IntField( size=4, default=lambda s: len(s['volume_label']), )), ('supports_objects', BoolField(default=False)), ('reserved', IntField(size=1)), ('volume_label', TextField( size=lambda s: s['volume_label_length'].get_value(), encoding='utf-16-le', )), ]) super(FileFsVolumeInformation, self).__init__()
def __init__(self): self.fields = OrderedDict([ ('next_entry_offset', IntField(size=4)), ('action', EnumField( size=4, enum_type=FileAction, )), ('file_name_length', IntField( size=4, default=lambda s: len(s['file_name']), )), ('file_name', TextField( encoding='utf-16-le', size=lambda s: s['file_name_length'].get_value(), )), ]) super(FileNotifyInformation, self).__init__()
def __init__(self): self.fields = OrderedDict([ ('next_entry_offset', IntField(size=4)), ('stream_name_length', IntField( size=4, default=lambda s: len(s['stream_name']), )), ('stream_size', IntField( size=8, unsigned=False, )), ('stream_allocation_size', IntField( size=8, unsigned=False, )), ('stream_name', TextField( encoding='utf-16-le', size=lambda s: s['stream_name_length'].get_value(), )), ]) super(FileStreamInformation, self).__init__()
def __init__(self): self.fields = OrderedDict([ ('max_referral_level', IntField(size=2, default=4)), ('request_file_name', TextField(null_terminated=True)), ]) super(DFSReferralRequest, self).__init__()