Ejemplo n.º 1
0
def get_directory_index_inactive_entries(fs, directory):
    """
    get the inactive (slack) MFT_INDEX_ENTRYs from a directory's
    INDEX_ROOT and INDEX_ALLOCATION attributes
    """
    if not directory.is_directory():
        raise InvalidArgumentError()

    # sorry, reaching
    record = directory._record

    ret = []

    try:
        indx_alloc_attr = record.attribute(ATTR_TYPE.INDEX_ALLOCATION)
        indx_alloc = INDEX_ALLOCATION(fs.get_attribute_data(indx_alloc_attr),
                                      0)
        for block in indx_alloc.blocks():
            for entry in block.index().slack_entries():
                ret.append(entry)
    except AttributeNotFoundError:
        pass

    try:
        indx_root_attr = record.attribute(ATTR_TYPE.INDEX_ROOT)
        indx_root = INDEX_ROOT(fs.get_attribute_data(indx_root_attr), 0)
        for entry in indx_root.index().slack_entries():
            ret.append(entry)
    except AttributeNotFoundError:
        pass

    return ret
Ejemplo n.º 2
0
def get_directory_index_inactive_entries(fs, directory):
    """
    get the inactive (slack) MFT_INDEX_ENTRYs from a directory's
    INDEX_ROOT and INDEX_ALLOCATION attributes
    """
    if not directory.is_directory():
        raise InvalidArgumentError()

    # sorry, reaching
    record = directory._record

    ret = []

    try:
        indx_alloc_attr = record.attribute(ATTR_TYPE.INDEX_ALLOCATION)
        indx_alloc = INDEX_ALLOCATION(fs.get_attribute_data(indx_alloc_attr), 0)
        for block in indx_alloc.blocks():
            for entry in block.index().slack_entries():
                ret.append(entry)
    except AttributeNotFoundError:
        pass

    try:
        indx_root_attr = record.attribute(ATTR_TYPE.INDEX_ROOT)
        indx_root = INDEX_ROOT(fs.get_attribute_data(indx_root_attr), 0)
        for entry in indx_root.index().slack_entries():
            ret.append(entry)
    except AttributeNotFoundError:
        pass

    return ret