* @param a_images Array of paths to the image parts
* @param a_type Image type
* @param a_ssize Size of device sector in bytes (or 0 for default)
* @param a_deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID).
* @param a_images Array of paths to the image parts
* @param a_type Image type
* @param a_ssize Size of device sector in bytes (or 0 for default)
* @param a_deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID).
* Adds an image to the database. Requires that m_img_info is already initialized
*
* @param a_deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID).
* @return 0 for success, 1 for failure
*/
uint8_t
TskAutoDb::openImage(constchar*a_deviceId)
{
if(m_img_info==NULL){
return1;
}
return(addImageDetails(a_deviceId));
}
/**
* Adds image details to the existing database tables.
*
* @param deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID).
* @return Returns 0 for success, 1 for failure
*/
uint8_t
TskAutoDb::addImageDetails(constchar*deviceId)
{
stringmd5="";
stringsha1="";
stringcollectionDetails="";
#if HAVE_LIBEWF
if(m_img_info->itype==TSK_IMG_TYPE_EWF_EWF){
// @@@ This should really probably be inside of a tsk_img_ method
* Analyzes the open image and adds image info to a database.
* Does not deal with transactions and such. Refer to startAddImage()
* for more control.
* @returns 1 if a critical error occurred (DB doesn't exist, no file system, etc.), 2 if errors occurred at some point adding files to the DB (corrupt file, etc.), and 0 otherwise. Errors will have been registered.
*/
uint8_tTskAutoDb::addFilesInImgToDb()
{
if(m_db==NULL||m_db->isDbOpen()==false){
tsk_error_reset();
tsk_error_set_errno(TSK_ERR_AUTO_DB);
tsk_error_set_errstr("addFilesInImgToDb: m_db not open");
registerError();
return1;
}
// @@@ This seems bad because we are overriding what the user may
// have set. We should remove the public API if we are going to
// override it -- presumably this was added so that we always have
// map the boolean return value from findFiles to the three-state return value we use
// @@@ findFiles should probably return this three-state enum too
if(m_foundStructure==false){
retVal=1;
}
else{
retVal=2;
}
}
TSK_RETVAL_ENUMaddUnallocRetval=TSK_OK;
if(m_addUnallocSpace)
addUnallocRetval=addUnallocSpaceToDb();
// findFiles return value trumps unalloc since it can return either 2 or 1.
if(retVal){
returnretVal;
}
elseif(addUnallocRetval==TSK_ERR){
return2;
}
else{
return0;
}
}
/**
* Start the process to add image/file metadata to database inside of a transaction.
* User must call either commitAddImage() to commit the changes,
* or revertAddImage() to revert them.
*
* @param numImg Number of image parts
* @param imagePaths Array of paths to the image parts
* @param imgType Image type
* @param sSize Size of device sector in bytes (or 0 for default)
* @param deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID)
* @param deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID)
* Start the process to add image/file metadata to database inside of a transaction.
* Same functionality as addFilesInImgToDb(). Reverts
* all changes on error. User must call either commitAddImage() to commit the changes,
* or revertAddImage() to revert them.
*
* @param numImg Number of image parts
* @param imagePaths Array of paths to the image parts
* @param imgType Image type
* @param sSize Size of device sector in bytes (or 0 for default)
* @param deviceId An ASCII-printable identifier for the device associated with the data source that is intended to be unique across multiple cases (e.g., a UUID)
int64_tm_curImgId;///< Object ID of image currently being processed
int64_tm_curVsId;///< Object ID of volume system currently being processed
int64_tm_curVolId;///< Object ID of volume currently being processed
int64_tm_curPoolVol;///< Object ID of the pool volume currently being processed
int64_tm_curPoolVs;///< Object ID of the pool volume system currently being processed
int64_tm_curFsId;///< Object ID of file system currently being processed
int64_tm_curFileId;///< Object ID of file currently being processed
TSK_INUM_Tm_curDirAddr;///< Meta address the directory currently being processed
int64_tm_curUnallocDirId;
stringm_curDirPath;//< Path of the current directory being processed
tsk_lock_tm_curDirPathLock;//< protects concurrent access to m_curDirPath
stringm_curImgTZone;
boolm_blkMapFlag;
boolm_fileHashFlag;
boolm_vsFound;
boolm_volFound;
boolm_poolFound;
boolm_stopped;
boolm_imgTransactionOpen;
TSK_HDB_INFO*m_NSRLDb;
TSK_HDB_INFO*m_knownBadDb;
boolm_addFileSystems;
boolm_noFatFsOrphans;
boolm_addUnallocSpace;
int64_tm_minChunkSize;///< -1 for no minimum, 0 for no chunking at all, greater than 0 to wait for that number of chunks before writing to the database
int64_tm_maxChunkSize;///< Max number of unalloc bytes to process before writing to the database, even if there is no natural break. -1 for no chunking
boolm_foundStructure;///< Set to true when we find either a volume or file system
boolm_attributeAdded;///< Set to true when an attribute was added by processAttributes
// prevent copying until we add proper logic to handle it
TskAutoDb(constTskAutoDb&);
TskAutoDb&operator=(constTskAutoDb&);
//internal structure to keep track of temp. unalloc block range