C++ class that automatically analyzes a disk image to extract files from it. More...
#include <tsk_auto.h>
C++ class that automatically analyzes a disk image to extract files from it.
This class hides many of the details that are required to use lower-level TSK APIs to analyze volume and file systems.
The processFile() method must be implemented and it will be called for each file and directory that is found.
An image file must be first opened using openImage(). It can then be analyzed using one of the findFilesInXXXX() methods. The filterXX() methods can be used to skip volumes and file systems.
This class, by default, will not stop if an error occurs. It registers the error into an internal list. Those can be retrieved with getErrorList(). If you want to deal with errors differently, you must implement handleError().
Closes the handles to the open disk image.
Should be called after you have completed analysis of the image.
Reimplemented in TskAutoDb.
References m_internalOpen, and tsk_img_close().
Referenced by TskAutoDb::closeImage(), openImage(), openImageHandle(), and openImageUtf8().
Enables image writer, which creates a copy of the image as it is being processed.
References TSK_ERR, tsk_error_set_errno(), tsk_error_set_errstr(), TSK_OK, tsk_UTF8toUTF16(), TSKconversionOK, and TSKlenientConversion.
TskAuto calls this method before it processes each file system that is found in a volume.
You can use this to learn about each file system before it is processed and you can force TskAuto to skip this file system.
Reimplemented in TskAutoDb, and TskIsImageSupported.
References TSK_FILTER_CONT.
TskAuto calls this method before it processes each pool that is found.
You can use this to learn about each pool before it is processed and you can force TskAuto to skip this volume.
Reimplemented in TskAutoDb, and TskIsImageSupported.
References TSK_FILTER_SKIP, and tsk_verbose.
Referenced by findFilesInPool().
TskAuto calls this method before it processes each pool volume that is found in a pool.
You can use this to learn about each volume before it is processed and you can force TskAuto to skip this volume.
Reimplemented in TskAutoDb, and TskIsImageSupported.
References TSK_FILTER_SKIP, and tsk_verbose.
Referenced by findFilesInPool().
TskAuto calls this method before it processes each volume that is found in a volume system.
You can use this to learn about each volume before it is processed and you can force TskAuto to skip this volume. The setvolFilterFlags() method can be used to configure if TskAuto should process unallocated space.
Reimplemented in TskAutoDb, and TskIsImageSupported.
References TSK_FILTER_CONT.
TskAuto calls this method before it processes the volume system that is found in an image.
You can use this to learn about the volume system before it is processed and you can force TskAuto to skip this volume system.
Reimplemented in TskAutoDb.
References TSK_FILTER_CONT.
Referenced by findFilesInVs().
Starts in a specified byte offset of the opened disk images and looks for a file system.
Will call processFile() on each file that is found.
References TSK_FS_TYPE_DETECT.
Referenced by findFilesInFs(), findFilesInImg(), and findFilesInVs().
Starts in a specified byte offset of the opened disk images and looks for a file system.
Will call processFile() on each file that is found.
References findFilesInFsRet().
Starts in a specified byte offset of the opened disk images and looks for a file system.
Will start processing the file system at a specified file system. Will call processFile() on each file that is found in that directory.
References findFilesInFs(), and TSK_FS_TYPE_DETECT.
Starts in a specified byte offset of the opened disk images and looks for a file system.
Will start processing the file system at a specified file system. Will call processFile() on each file that is found in that directory.
References getCurVsPartDescr(), getCurVsPartFlag(), isCurVsValid(), registerError(), TSK_FS_INFO::root_inum, TSK_ERR, tsk_error_reset(), tsk_error_set_errno(), tsk_error_set_errstr(), tsk_error_set_errstr2(), tsk_fs_close(), tsk_fs_open_img_decrypt(), and TSK_VS_PART_FLAG_ALLOC.
Processes the file system represented by the given TSK_FS_INFO pointer.
Will Call processFile() on each file that is found.
References registerError(), TSK_FS_INFO::root_inum, tsk_error_reset(), tsk_error_set_errno(), and tsk_error_set_errstr().
Processes the file system represented by the given TSK_FS_INFO pointer.
Will Call processFile() on each file that is found.
References registerError(), tsk_error_reset(), tsk_error_set_errno(), and tsk_error_set_errstr().
Starts in a specified byte offset of the opened disk images and looks for a file system.
Will call processFile() on each file that is found. Same as findFilesInFs, but gives more detailed return values.
References getCurVsPartDescr(), getCurVsPartFlag(), isCurVsValid(), registerError(), TSK_FS_INFO::root_inum, TSK_ERR, tsk_error_reset(), tsk_error_set_errno(), tsk_error_set_errstr(), tsk_error_set_errstr2(), tsk_fs_close(), tsk_fs_open_img_decrypt(), TSK_OK, and TSK_VS_PART_FLAG_ALLOC.
Referenced by findFilesInFs().
Starts in sector 0 of the opened disk images and looks for a volume or file system.
Will call processFile() on each file that is found.
References findFilesInFs(), findFilesInVs(), TSK_IMG_INFO::itype, registerError(), tsk_error_reset(), tsk_error_set_errno(), tsk_error_set_errstr(), TSK_FS_TYPE_LOGICAL, and TSK_IMG_TYPE_LOGICAL.
Referenced by TskAutoDb::addFilesInImgToDb().
Starts in a specified byte offset of the opened disk images and opens a pool to search though any file systems in the pool.
Will call processFile() on each file that is found.
Referenced by findFilesInVs().
Starts in a specified byte offset of the opened disk images and opens a pool to search though any file systems in the pool.
Will call processFile() on each file that is found.
References filterPool(), filterPoolVol(), m_stopAllProcessing, registerError(), TSK_FS_INFO::root_inum, TSK_ERR, tsk_error_reset(), tsk_error_set_errno(), tsk_error_set_errstr(), tsk_error_set_errstr2(), TSK_FILTER_SKIP, TSK_FILTER_STOP, tsk_fs_close(), tsk_fs_open_img(), TSK_FS_TYPE_APFS, TSK_FS_TYPE_DETECT, tsk_img_close(), TSK_OK, and TSK_STOP.
Starts in a specified byte offset of the opened disk images and looks for a volume system or file system.
Will call processFile() on each file that is found.
References TSK_VS_TYPE_DETECT.
Referenced by findFilesInImg().
Starts in a specified byte offset of the opened disk images and looks for a volume system or file system.
Will call processFile() on each file that is found.
References filterVs(), findFilesInFs(), findFilesInPool(), hasPool(), m_stopAllProcessing, registerError(), tsk_error_get_errno(), tsk_error_reset(), tsk_error_set_errno(), tsk_error_set_errstr(), TSK_FILTER_SKIP, TSK_FILTER_STOP, tsk_verbose, tsk_vs_close(), tsk_vs_open(), and tsk_vs_part_walk().
get volume description of the lastly processed volume
Referenced by findFilesInFs(), and findFilesInFsRet().
get volume flags of the lastly processed volume.
Referenced by findFilesInFs(), and findFilesInFsRet().
Get the list of errors that were added to the internal list.
This list could be empty if the implementing class already acted on the errors or never called addToErrorList().
References TSK_IMG_INFO::size.
Override this method to get called for each error that is registered.
This method allows you to log the message or stop processing. Use setStopProcessing() to do that.
Reimplemented in TskIsImageSupported.
Referenced by registerError().
Checks whether a volume contains a pool.
References registerError(), tsk_error_reset(), tsk_error_set_errno(), and tsk_error_set_errstr().
Referenced by findFilesInVs().
Utility method to help determine if an attribute is the default type for the file/dir.
References TSK_FS_FILE::fs_info, and TSK_FS_ATTR::type.
Utility method to help determine if a file is a directory.
References TSK_FS_FILE::meta, TSK_FS_FILE::name, TSK_FS_NAME_TYPE_UNDEF, TSK_FS_META::type, and TSK_FS_NAME::type.
Referenced by TskAutoDb::processFile().
Utility method to help determine if a file is a .
or .. directory.
References TSK_FS_NAME::name, TSK_FS_FILE::name, TSK_FS_NAME::name_size, TSK_FS_NAME_TYPE_DIR, and TSK_FS_NAME::type.
Utility method to help determine if a file is a FAT file system file (such as $MBR).
References TSK_FS_FILE::fs_info, TSK_FS_INFO::ftype, TSK_FS_NAME::meta_addr, TSK_FS_FILE::name, and TSK_FS_TYPE_ISFAT.
Utility method to help determine if a file is a file (and not a directory).
References TSK_FS_FILE::meta, TSK_FS_FILE::name, TSK_FS_META_TYPE_REG, TSK_FS_NAME_TYPE_REG, TSK_FS_NAME_TYPE_UNDEF, TSK_FS_META::type, and TSK_FS_NAME::type.
Utility method to help determine if an attribute is non-resident (meaning it uses blocks to store data)
References TSK_FS_ATTR::flags, and TSK_FS_ATTR_NONRES.
Utility method to help determine if a file is an NTFS file system file (such as $MFT).
References TSK_FS_FILE::fs_info, TSK_FS_INFO::ftype, TSK_FS_NAME::meta_addr, TSK_FS_NAME::name, TSK_FS_FILE::name, and TSK_FS_TYPE_ISNTFS.
Opens the disk image to be analyzed.
This must be called before any of the findFilesInXXX() methods.
Reimplemented in TskAutoDb.
References closeImage(), m_internalOpen, resetErrorList(), and tsk_img_open().
Referenced by TskAutoDb::openImage().
Uses the already opened image for future analysis.
This must be called before any of the findFilesInXXX() methods. Note that the TSK_IMG_INFO will not be freed when the TskAuto class is closed.
References closeImage(), m_internalOpen, and resetErrorList().
Referenced by TskAutoDb::startAddImage().
Opens the disk image to be analyzed.
This must be called before any of the findFilesInXXX() methods. Always uses the utf8 tsk_img_open even in windows.
Reimplemented in TskAutoDb.
References closeImage(), m_internalOpen, resetErrorList(), and tsk_img_open_utf8().
Referenced by TskAutoDb::openImageUtf8().
Method that is called from processAttributes() for each attribute that a file has.
processAttributes() is not called by default. It exists so that implementations of processFile() can choose to call it if they want to look at all of the attributes. You must implement this method to see each attribute and modify processFile() so that it calls processAttributes().
References TSK_OK.
Referenced by processAttributes().
Method that can be used from within processFile() to look at each attribute that a file may have.
This will call the processAttribute() method (which you must implement) on each of the attributes in the file.
References m_stopAllProcessing, processAttribute(), tsk_fs_file_attr_get_idx(), tsk_fs_file_attr_getsize(), TSK_OK, and TSK_STOP.
Referenced by TskAutoDb::processFile().
TskAuto calls this method for each file and directory that it finds in an image.
The setFileFilterFlags() method can be used to set the criteria for what types of files this should be called for. There are several methods, such as isDir() that can be used by this method to help focus in on the files that you care about. When errors are encountered, send them to registerError().
Implemented in TskAutoDb, and TskIsImageSupported.
Internal method that TskAuto calls when it encounters issues while processing an image.
It will add the error to an internal list and then call handleError() to allow the sub-class to decide what to do with the error. The tsk global error values must be set before this is called (tsk_error_set_errno, etc.). This method will reset the error values before it returns.
References handleError(), tsk_error_get_errno(), tsk_error_get_errstr(), tsk_error_get_errstr2(), and tsk_error_reset().
Referenced by TskAutoDb::addFilesInImgToDb(), TskAutoDb::filterFs(), TskAutoDb::filterPool(), TskAutoDb::filterPoolVol(), TskAutoDb::filterVol(), TskAutoDb::filterVs(), findFilesInFs(), findFilesInFsRet(), findFilesInImg(), findFilesInPool(), findFilesInVs(), hasPool(), and TskAutoDb::startAddImage().
Set the attributes for the files that should be processed.
The default settings are for all files (allocated and deleted). This must be called before the findFilesInXX() method.
Referenced by TskAutoDb::filterFs().
Set the attributes for the volumes that should be processed.
The default settings are for Allocated Non-Meta volumes only. This must be called before the findFilesInXX() method.
Referenced by TskAutoDb::addFilesInImgToDb().
Copyright © 2007-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.