The Sleuth Kit Framework
4.1
|
An implementation of the TskFileManager interface that stores files in a directory named 'files' based on their file ids. More...
#include <TskFileManagerImpl.h>
Public Member Functions | |
virtual void | addFile (const uint64_t fileId, std::istream &istr) |
Add a file to the system using the given file id and input stream. More... | |
virtual void | addFile (const uint64_t fileId, std::wstring &filePath) |
Add a file to the system using the given file id and path. More... | |
virtual void | copyDirectory (TskFile *directoryToCopy, const std::wstring &destinationPath, const bool bRecurse=false) |
Copy the contents of a directory to the given fully qualifed file path. More... | |
virtual void | copyFile (TskFile *fileToSave, const std::wstring &filePath) |
Copy the file to the given fully qualifed file path. More... | |
virtual void | deleteFile (TskFile *fileToDelete) |
Delete the local copy of a file. More... | |
virtual TskFileManager::FilePtrList | findFilesByExtension (const std::vector< std::string > &extensions) |
Return a list of any TskFile objects matching the given filename extension. More... | |
virtual TskFileManager::FilePtrList | findFilesByFsFileType (TSK_FS_META_TYPE_ENUM fsFileType) |
Return a list of any TskFile objects that match the given file meta type. More... | |
virtual TskFileManager::FilePtrList | findFilesByName (const std::string &name, const TSK_FS_META_TYPE_ENUM fsFileType=TSK_FS_META_TYPE_UNDEF) |
Return a list of any TskFile objects matching the given filename. More... | |
virtual TskFileManager::FilePtrList | findFilesByParent (const uint64_t parentFileId) |
Return a list of any TskFile objects that are children of the given file id. More... | |
virtual TskFileManager::FilePtrList | findFilesByPattern (const std::string &namePattern, const std::string &pathPattern) |
Return a list of any TskFile objects that match the given file and path patterns. More... | |
virtual TskFile * | getFile (const uint64_t fileId) |
Return a TskFile object for a given file ID. More... | |
virtual TskFileManager::FilePtrList | getFiles (const std::vector< uint64_t > &fileIds) |
Return a list of TskFile objects mapped to the given list of file ids. More... | |
virtual std::wstring | getPath (const uint64_t fileId) |
Return the fully qualified path to where the local instance of the file with the given ID should exist. More... | |
virtual void | saveFile (TskFile *fileToSave) |
Save the file to the default location. More... | |
![]() | |
virtual void | copyDirectory (uint64_t directoryIdToCopy, const std::wstring &destinationPath, const bool bRecurse=false) |
Copy the contents of a directory to the given fully qualifed file path. More... | |
virtual void | copyFile (const uint64_t fileId, const std::wstring &filePath) |
Copy the file to the given fully qualifed file path. More... | |
virtual void | deleteFile (const uint64_t fileId) |
Delete the local copy of a file. More... | |
virtual void | saveFile (const uint64_t fileId) |
Save the file to the default location. More... | |
Static Public Member Functions | |
static TskFileManagerImpl & | instance () |
Static Public Attributes | |
static const int | FILE_BUFFER_SIZE = 8192 |
static const std::string | FILES_DIRECTORY = "Files" |
static const int | FILES_PER_DIR = 1000 |
Additional Inherited Members | |
![]() | |
typedef TskFile * | FilePtr |
typedef std::vector< FilePtr > | FilePtrList |
![]() | |
TskFileManager () | |
Default Constructor. | |
TskFileManager (TskFileManager const &) | |
Copy Constructor. | |
virtual | ~TskFileManager () |
Destructor. | |
An implementation of the TskFileManager interface that stores files in a directory named 'files' based on their file ids.
|
virtual |
Add a file to the system using the given file id and input stream.
This method saves a local copy of the content contained in the input stream.
fileId | ID of the new file. |
istr | Input stream containing the file content to save. |
TskFileException | if a file with the given fileId already exists or if an error is encountered while saving the input stream. |
Implements TskFileManager.
References TskFile::exists(), getFile(), getPath(), LOGERROR, and TskUtilities::toUTF8().
|
virtual |
Add a file to the system using the given file id and path.
This method saves a local copy of the file given in the path.
fileId | ID of the new file. |
filePath | The path of the file to save. |
TskFileException | if a file with the given fileId already exists, the file specified in filePath does not exist or an error is encountered while saving the file. |
Implements TskFileManager.
References getPath(), LOGERROR, and TskUtilities::toUTF8().
|
virtual |
Copy the contents of a directory to the given fully qualifed file path.
Directories along the path will be created if they do not exist. If the destination directory exists it will be replaced. Defaults to a non-recursive copy.
directoryToCopy | The TskFile object representing the directory to copy. |
destinationPath | The path to save directory contents to, including the directory name. |
bRecurse | Whether to recursively copy directory contents. |
various | exceptions on errors |
Implements TskFileManager.
References copyFile(), TskFile::exists(), getFile(), TskFile::getId(), TskServices::getImgDB(), TskFile::getName(), TskFile::getPath(), TskServices::Instance(), TskFile::isDirectory(), TskUtilities::toUTF16(), and TskUtilities::toUTF8().
|
virtual |
Copy the file to the given fully qualifed file path.
Directories along the path will be created if they do not exist. If the destination file exists it will be replaced.
fileToSave | The file to save. |
filePath | The path to save to, including the file name. |
various | exceptions on errors |
Implements TskFileManager.
References TskFile::close(), TskFile::exists(), TskFile::getPath(), TskFile::isDirectory(), TskFile::open(), TskFile::read(), TskFile::seek(), TskFile::tell(), and TskUtilities::toUTF8().
Referenced by copyDirectory(), and saveFile().
|
virtual |
Delete the local copy of a file.
fileToDelete | Object of file to delete local copy of |
various | exceptions on errors |
Implements TskFileManager.
References TskFile::exists(), TskFile::getPath(), and LOGERROR.
Referenced by TskFileAnalysisPipeline::run().
|
virtual |
Return a list of any TskFile objects matching the given filename extension.
extensions | List of file name extension strings. |
Implements TskFileManager.
References getFiles(), TskServices::getImgDB(), and TskServices::Instance().
|
virtual |
Return a list of any TskFile objects that match the given file meta type.
fsFileType | File meta type. |
Implements TskFileManager.
References getFiles(), TskServices::getImgDB(), and TskServices::Instance().
|
virtual |
Return a list of any TskFile objects matching the given filename.
name | The file name. |
fsFileType | Optional file meta type. Will not filter on meta_type if this is omitted. |
Implements TskFileManager.
References getFiles(), TskServices::getImgDB(), TskServices::Instance(), and TSK_FS_META_TYPE_UNDEF.
|
virtual |
Return a list of any TskFile objects that are children of the given file id.
parentFileId | ID of parent file. |
Implements TskFileManager.
References getFiles(), TskServices::getImgDB(), and TskServices::Instance().
|
virtual |
Return a list of any TskFile objects that match the given file and path patterns.
namePattern | File name pattern. Can include "%" wildcards. |
pathPattern | File path pattern. Can include "%" wildcards. |
Implements TskFileManager.
References getFiles(), TskServices::getImgDB(), TskServices::Instance(), and TSK_FS_META_TYPE_REG.
|
virtual |
Return a TskFile object for a given file ID.
fileId | ID of file to return object of. |
TskException | in case of error. |
Implements TskFileManager.
Referenced by addFile(), copyDirectory(), TskDBBlackboard::createGenInfoAttribute(), and getFiles().
|
virtual |
Return a list of TskFile objects mapped to the given list of file ids.
fileIds | List of fileId IDs. |
Implements TskFileManager.
References getFile().
Referenced by findFilesByExtension(), findFilesByFsFileType(), findFilesByName(), findFilesByParent(), and findFilesByPattern().
|
virtual |
Return the fully qualified path to where the local instance of the file with the given ID should exist.
This does not validate that the ID is for a file and does not validate that the file actually exists.
fileId | Id of the file. |
Implements TskFileManager.
References TskUtilities::toUTF16().
Referenced by addFile(), and saveFile().
|
virtual |
Save the file to the default location.
fileToSave | File object of the file to save. |
various | exceptions on errors |
Implements TskFileManager.
References copyFile(), TskFile::getId(), getPath(), TskFile::getTypeId(), and TskUtilities::toUTF8().
Referenced by TskFileAnalysisPipeline::run().
Copyright © 2011-2013 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.