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 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())