diff --git a/bindings/java/src/org/sleuthkit/datamodel/FileSystem.java b/bindings/java/src/org/sleuthkit/datamodel/FileSystem.java index c971488097c4a183cfa27794d773eba047e659e9..8d5b8fcc8271d808aec5a11e44068aa9a4e77d48 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/FileSystem.java +++ b/bindings/java/src/org/sleuthkit/datamodel/FileSystem.java @@ -30,7 +30,7 @@ public class FileSystem extends AbstractContent { private long imgOffset, blockSize, blockCount, rootInum, - firstInum, lastInum; + firstInum, lastInum, poolBlock; private TskData.TSK_FS_TYPE_ENUM fsType; private Content parent; private volatile long filesystemHandle = 0; @@ -51,7 +51,7 @@ public class FileSystem extends AbstractContent { */ protected FileSystem(SleuthkitCase db, long obj_id, String name, long img_offset, TskData.TSK_FS_TYPE_ENUM fs_type, long block_size, long block_count, long root_inum, - long first_inum, long last_inum) { + long first_inum, long last_inum, long poolBlock) { super(db, obj_id, name); this.imgOffset = img_offset; this.fsType = fs_type; @@ -60,6 +60,7 @@ protected FileSystem(SleuthkitCase db, long obj_id, String name, long img_offset this.rootInum = root_inum; this.firstInum = first_inum; this.lastInum = last_inum; + this.poolBlock = poolBlock; } @Override diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java index 4b311acc633236e357d4898d8bf5c3d185e3e3e1..2fe059405f550751e0481469e717478863ce1f53 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java @@ -5732,11 +5732,12 @@ public FileSystem addFileSystem(long parentObjId, long imgOffset, TskData.TSK_FS preparedStatement.setLong(7, firstInum); preparedStatement.setLong(8, lastInum); preparedStatement.setString(9, displayName); + preparedStatement.setLong(10, 0); // TODO - deal with this properly connection.executeUpdate(preparedStatement); // Create the new FileSystem object return new FileSystem(this, newObjId, displayName, imgOffset, type, blockSize, blockCount, rootInum, - firstInum, lastInum); + firstInum, lastInum, 0); } catch (SQLException ex) { throw new TskCoreException(String.format("Error creating file system with image offset %d and parent ID %d", imgOffset, parentObjId), ex); @@ -7320,7 +7321,7 @@ private FileSystem getFileSystemByIdHelper(long id, Content parent) throws TskCo TskData.TSK_FS_TYPE_ENUM fsType = TskData.TSK_FS_TYPE_ENUM.valueOf(rs.getInt("fs_type")); //NON-NLS FileSystem fs = new FileSystem(this, rs.getLong("obj_id"), "", rs.getLong("img_offset"), //NON-NLS fsType, rs.getLong("block_size"), rs.getLong("block_count"), //NON-NLS - rs.getLong("root_inum"), rs.getLong("first_inum"), rs.getLong("last_inum")); //NON-NLS + rs.getLong("root_inum"), rs.getLong("first_inum"), rs.getLong("last_inum"), rs.getLong("pool_block")); //NON-NLS fs.setParent(parent); // save it for the next call synchronized (fileSystemIdMap) { @@ -7481,7 +7482,7 @@ public Collection<FileSystem> getFileSystems(Image image) { TskData.TSK_FS_TYPE_ENUM fsType = TskData.TSK_FS_TYPE_ENUM.valueOf(rs.getInt("fs_type")); //NON-NLS FileSystem fs = new FileSystem(this, rs.getLong("obj_id"), "", rs.getLong("img_offset"), //NON-NLS fsType, rs.getLong("block_size"), rs.getLong("block_count"), //NON-NLS - rs.getLong("root_inum"), rs.getLong("first_inum"), rs.getLong("last_inum")); //NON-NLS + rs.getLong("root_inum"), rs.getLong("first_inum"), rs.getLong("last_inum"), rs.getLong("pool_block")); //NON-NLS fs.setParent(null); allFileSystems.add(fs); } @@ -10731,8 +10732,8 @@ private enum PREPARED_STATEMENT { INSERT_VS_INFO("INSERT INTO tsk_vs_info (obj_id, vs_type, img_offset, block_size) VALUES (?, ?, ?, ?)"), INSERT_VS_PART_SQLITE("INSERT INTO tsk_vs_parts (obj_id, addr, start, length, desc, flags) VALUES (?, ?, ?, ?, ?, ?)"), INSERT_VS_PART_POSTGRESQL("INSERT INTO tsk_vs_parts (obj_id, addr, start, length, descr, flags) VALUES (?, ?, ?, ?, ?, ?)"), - INSERT_FS_INFO("INSERT INTO tsk_fs_info (obj_id, img_offset, fs_type, block_size, block_count, root_inum, first_inum, last_inum, display_name)" - + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + INSERT_FS_INFO("INSERT INTO tsk_fs_info (obj_id, img_offset, fs_type, block_size, block_count, root_inum, first_inum, last_inum, display_name, pool_block)" + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); private final String sql; diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java index 0d4f012e1379f53ad7d1409ebfda448595601c77..7497fc87ec1a42690de3cf54974bb76c805e0e0d 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java @@ -817,7 +817,12 @@ public static long openVsPart(long vsHandle, long volId) throws TskCoreException * @throws TskCoreException exception thrown if critical error occurs within * TSK */ + public static long openFs(long imgHandle, long fsOffset, SleuthkitCase skCase) throws TskCoreException { + return openFs(imgHandle, fsOffset, 0, skCase); + } + + public static long openFs(long imgHandle, long fsOffset, long poolBlock, SleuthkitCase skCase) throws TskCoreException { getTSKReadLock(); try { long fsHandle; @@ -832,13 +837,15 @@ public static long openFs(long imgHandle, long fsOffset, SleuthkitCase skCase) t if (imgOffSetToFsHandle == null) { throw new TskCoreException("Missing image offset to file system handle cache for image handle " + imgHandle); } - if (imgOffSetToFsHandle.containsKey(fsOffset)) { + + long combinedOffset = fsOffset + poolBlock; + if (imgOffSetToFsHandle.containsKey(combinedOffset)) { //return cached - fsHandle = imgOffSetToFsHandle.get(fsOffset); + fsHandle = imgOffSetToFsHandle.get(combinedOffset); } else { - fsHandle = openFsNat(imgHandle, fsOffset); + fsHandle = openFsNat(imgHandle, combinedOffset); //cache it - imgOffSetToFsHandle.put(fsOffset, fsHandle); + imgOffSetToFsHandle.put(combinedOffset, fsHandle); } } return fsHandle; diff --git a/tsk/auto/auto.cpp b/tsk/auto/auto.cpp index 32af9970e5b190eb567bb88d88e03aa3d66559c2..38ea607382657e26e89588c6267c46edf2720e88 100755 --- a/tsk/auto/auto.cpp +++ b/tsk/auto/auto.cpp @@ -208,6 +208,7 @@ TskAuto::filterPoolVol(const TSK_POOL_VOLUME_INFO * /*pool_vol*/) /* Most of our tools can't handle pool volumes yet */ if (tsk_verbose) fprintf(stderr, "filterPoolVol: Pool handling is not yet implemented for this tool\n"); + printf("no pool!\n"); return TSK_FILTER_SKIP; } @@ -434,11 +435,15 @@ TskAuto::findFilesInPool(TSK_OFF_T start, TSK_POOL_TYPE_ENUM ptype) } if (filterRetval != TSK_FILTER_SKIP) { + printf("findFilesInPool - should be making new pool_img...\n"); + fflush(stdout); TSK_IMG_INFO *pool_img = pool->get_img_info(pool, vol_info->block); if (pool_img != NULL) { + printf("Calling apfs_open with image of type 0x%x\n", pool_img->itype); TSK_FS_INFO *fs_info = apfs_open(pool_img, 0, TSK_FS_TYPE_APFS, ""); if (fs_info) { - + printf("Image in fs_info from apfs_open has type 0x%x\n", fs_info->img_info->itype); + fflush(stdout); TSK_RETVAL_ENUM retval = findFilesInFsInt(fs_info, fs_info->root_inum); tsk_fs_close(fs_info); diff --git a/tsk/auto/auto_db.cpp b/tsk/auto/auto_db.cpp index c0364d3a08a4350dda42bb52c8e64dff03ccec34..516be1479458d98291d278c0622fdab939846486 100755 --- a/tsk/auto/auto_db.cpp +++ b/tsk/auto/auto_db.cpp @@ -303,6 +303,14 @@ TSK_FILTER_ENUM TskAutoDb::filterVs(const TSK_VS_INFO * vs_info) return TSK_FILTER_CONT; } +TSK_FILTER_ENUM +TskAutoDb::filterPoolVol(const TSK_POOL_VOLUME_INFO * pool_vol) +{ + printf("filterPoolVol 0x%llx\n", pool_vol->index); + m_curPoolVol = pool_vol->index; + return TSK_FILTER_CONT; +} + TSK_FILTER_ENUM TskAutoDb::filterVol(const TSK_VS_PART_INFO * vs_part) { @@ -985,6 +993,12 @@ TSK_WALK_RET_ENUM TskAutoDb::fsWalkUnallocBlocksCb(const TSK_FS_BLOCK *a_block, * @returns TSK_OK on success, TSK_ERR on error */ TSK_RETVAL_ENUM TskAutoDb::addFsInfoUnalloc(const TSK_DB_FS_INFO & dbFsInfo) { + + // Unalloc space is not yet implemented for APFS + if (dbFsInfo.fType == TSK_FS_TYPE_APFS) { + return TSK_OK; + } + //open the fs we have from database TSK_FS_INFO * fsInfo = tsk_fs_open_img(m_img_info, dbFsInfo.imgOffset, dbFsInfo.fType); if (fsInfo == NULL) { diff --git a/tsk/auto/db_sqlite.cpp b/tsk/auto/db_sqlite.cpp index 3f5d1598ad241130992ec531d37e466c85136938..a0c95f221e24d4e35143148f5fee0e22e9fea3da 100755 --- a/tsk/auto/db_sqlite.cpp +++ b/tsk/auto/db_sqlite.cpp @@ -15,6 +15,7 @@ #include "tsk_db_sqlite.h" #include "guid.h" +#include "../img/pool.hpp" #include <string.h> #include <sstream> #include <algorithm> @@ -304,7 +305,7 @@ TskDbSqlite::initialize() "Error creating tsk_vol_info table: %s\n") || attempt_exec - ("CREATE TABLE tsk_fs_info (obj_id INTEGER PRIMARY KEY, img_offset INTEGER NOT NULL, fs_type INTEGER NOT NULL, block_size INTEGER NOT NULL, block_count INTEGER NOT NULL, root_inum INTEGER NOT NULL, first_inum INTEGER NOT NULL, last_inum INTEGER NOT NULL, display_name TEXT, FOREIGN KEY(obj_id) REFERENCES tsk_objects(obj_id));", + ("CREATE TABLE tsk_fs_info (obj_id INTEGER PRIMARY KEY, img_offset INTEGER NOT NULL, fs_type INTEGER NOT NULL, block_size INTEGER NOT NULL, block_count INTEGER NOT NULL, root_inum INTEGER NOT NULL, first_inum INTEGER NOT NULL, last_inum INTEGER NOT NULL, display_name TEXT, pool_block INTEGER NOT NULL, FOREIGN KEY(obj_id) REFERENCES tsk_objects(obj_id));", "Error creating tsk_fs_info table: %s\n") || attempt_exec @@ -786,16 +787,23 @@ TskDbSqlite::addFsInfo(const TSK_FS_INFO* fs_info, int64_t parObjId, if (addObject(TSK_DB_OBJECT_TYPE_FS, parObjId, objId)) return 1; + printf("addFsInfo\n"); + fflush(stdout); + TSK_OFF_T pool_block = 0L; + if (fs_info->img_info->itype == TSK_IMG_TYPE_POOL) { + IMG_POOL_INFO *pool_img = (IMG_POOL_INFO*)fs_info->img_info; + pool_block = pool_img->pvol_block; + } snprintf(stmt, 1024, "INSERT INTO tsk_fs_info (obj_id, img_offset, fs_type, block_size, block_count, " - "root_inum, first_inum, last_inum) " + "root_inum, first_inum, last_inum, pool_block) " "VALUES (" "%" PRId64 ",%" PRIdOFF ",%d,%u,%" PRIuDADDR "," - "%" PRIuINUM ",%" PRIuINUM ",%" PRIuINUM ")", + "%" PRIuINUM ",%" PRIuINUM ",%" PRIuINUM ",%" PRIuINUM ")", objId, fs_info->offset, (int) fs_info->ftype, fs_info->block_size, fs_info->block_count, fs_info->root_inum, fs_info->first_inum, - fs_info->last_inum); + fs_info->last_inum, pool_block); return attempt_exec(stmt, "Error adding data to tsk_fs_info table: %s\n"); @@ -1859,7 +1867,7 @@ TSK_RETVAL_ENUM TskDbSqlite::getFsInfos(int64_t imgId, vector<TSK_DB_FS_INFO>& f { sqlite3_stmt* fsInfosStatement = NULL; if (prepare_stmt( - "SELECT obj_id, img_offset, fs_type, block_size, block_count, root_inum, first_inum, last_inum FROM tsk_fs_info", + "SELECT obj_id, img_offset, fs_type, block_size, block_count, root_inum, first_inum, last_inum, pool_block FROM tsk_fs_info", &fsInfosStatement)) { return TSK_ERR; @@ -1894,6 +1902,7 @@ TSK_RETVAL_ENUM TskDbSqlite::getFsInfos(int64_t imgId, vector<TSK_DB_FS_INFO>& f rowData.root_inum = sqlite3_column_int64(fsInfosStatement, 5); rowData.first_inum = sqlite3_column_int64(fsInfosStatement, 6); rowData.last_inum = sqlite3_column_int64(fsInfosStatement, 7); + rowData.pool_block = sqlite3_column_int64(fsInfosStatement, 8); //insert a copy of the rowData fsInfos.push_back(rowData); diff --git a/tsk/auto/tsk_case_db.h b/tsk/auto/tsk_case_db.h index 851c577ee3d918c34ee41ddd79c5628efe94c1f8..6ebbde48780c3dcf339520ec7c6051e95076ae94 100644 --- a/tsk/auto/tsk_case_db.h +++ b/tsk/auto/tsk_case_db.h @@ -45,6 +45,7 @@ class TskAutoDb:public TskAuto { virtual TSK_FILTER_ENUM filterVs(const TSK_VS_INFO * vs_info); virtual TSK_FILTER_ENUM filterVol(const TSK_VS_PART_INFO * vs_part); + virtual TSK_FILTER_ENUM filterPoolVol(const TSK_POOL_VOLUME_INFO * pool_vol); virtual TSK_FILTER_ENUM filterFs(TSK_FS_INFO * fs_info); virtual TSK_RETVAL_ENUM processFile(TSK_FS_FILE * fs_file, const char *path); @@ -126,6 +127,7 @@ class TskAutoDb:public TskAuto { int64_t m_curImgId; ///< Object ID of image currently being processed int64_t m_curVsId; ///< Object ID of volume system currently being processed int64_t m_curVolId; ///< Object ID of volume currently being processed + int64_t m_curPoolVol; // POOL int64_t m_curFsId; ///< Object ID of file system currently being processed int64_t m_curFileId; ///< Object ID of file currently being processed TSK_INUM_T m_curDirAddr; ///< Meta address the directory currently being processed diff --git a/tsk/auto/tsk_db.h b/tsk/auto/tsk_db.h index bf7b72ebb3ddf5a3440cc1e522ccaa574f964adb..c929ac76680c4f6edef1f73323f81dd83c352734 100755 --- a/tsk/auto/tsk_db.h +++ b/tsk/auto/tsk_db.h @@ -115,7 +115,8 @@ typedef struct _TSK_DB_FS_INFO { TSK_DADDR_T block_count; TSK_INUM_T root_inum; TSK_INUM_T first_inum; - TSK_INUM_T last_inum; + TSK_INUM_T last_inum; + TSK_INUM_T pool_block; } TSK_DB_FS_INFO; ostream& operator <<(ostream &os,const TSK_DB_FS_INFO &fsInfo); diff --git a/tsk/fs/apfs_compat.cpp b/tsk/fs/apfs_compat.cpp index 410c0416e37b907519b75cc9ddfb79083eec1f87..cf5a680f01fa6682ddb8224497b9563cbf6490f5 100755 --- a/tsk/fs/apfs_compat.cpp +++ b/tsk/fs/apfs_compat.cpp @@ -4,6 +4,7 @@ #include "tsk_fs_i.h" #include "../pool/apfs_pool_compat.hpp" +#include "../img/pool.hpp" #include "apfs_compat.hpp" #include <cstring> @@ -14,8 +15,27 @@ extern "C" void error_returned(const char* errstr, ...); static inline const APFSPoolCompat& to_pool( const TSK_POOL_INFO* pool_info) noexcept { - const auto pool = static_cast<APFSPoolCompat*>(pool_info->impl); - return *pool; + + const auto pool = static_cast<APFSPoolCompat*>(pool_info->impl); + return *pool; +} + +static inline const APFSPoolCompat& fs_info_to_pool( + const TSK_FS_INFO* fs_info) noexcept { + + IMG_POOL_INFO *pool_img = (IMG_POOL_INFO*)fs_info->img_info; + return to_pool(pool_img->pool_info); +} + +static inline TSK_DADDR_T to_pool_vol_block( + const TSK_FS_INFO* fs_info) noexcept { + + if (fs_info->img_info->itype != TSK_IMG_TYPE_POOL) { + return 0; + } + + IMG_POOL_INFO *pool_img = (IMG_POOL_INFO*)fs_info->img_info; + return pool_img->pvol_block; } static inline APFSFSCompat& to_fs(const TSK_FS_INFO* fs_info) noexcept { @@ -136,7 +156,7 @@ static const char* attr_type_name(uint32_t typeNum) noexcept { } } -APFSFSCompat::APFSFSCompat(const TSK_POOL_INFO* pool_info, +APFSFSCompat::APFSFSCompat(TSK_IMG_INFO* img_info, const TSK_POOL_INFO* pool_info, apfs_block_num vol_block, const char* pass) : APFSJObjTree(APFSFileSystem{to_pool(pool_info), vol_block, pass}) { const auto& pool = to_pool(pool_info); @@ -153,8 +173,11 @@ APFSFSCompat::APFSFSCompat(const TSK_POOL_INFO* pool_info, _fsinfo.flags |= TSK_FS_INFO_FLAG_ENCRYPTED; } - _fsinfo.pool_info = pool_info; - _fsinfo.vol_block = vol_block; + //_fsinfo.fs_pool_info = pool_info; + //_fsinfo.fs_vol_block = vol_block; + _fsinfo.img_info = img_info; + _fsinfo.offset = 0; // TODO FIX + printf("Storing image in apfs fs_info with type 0x%x\n", _fsinfo.img_info->itype); _fsinfo.block_count = vol.alloc_blocks(); _fsinfo.block_size = pool.block_size(); _fsinfo.dev_bsize = pool.dev_block_size(); @@ -231,11 +254,11 @@ APFSFSCompat::APFSFSCompat(const TSK_POOL_INFO* pool_info, } uint8_t APFSFSCompat::fsstat(FILE* hFile) const noexcept try { - const auto& pool = to_pool(_fsinfo.pool_info); + const auto& pool = fs_info_to_pool(&_fsinfo); #ifdef HAVE_LIBOPENSSL - APFSFileSystem vol{pool, _fsinfo.vol_block, _crypto.password}; + APFSFileSystem vol{pool, to_pool_vol_block(&_fsinfo), _crypto.password}; #else - APFSFileSystem vol{ pool, _fsinfo.vol_block}; + APFSFileSystem vol{ pool, to_pool_vol_block(&_fsinfo) }; #endif tsk_fprintf(hFile, "FILE SYSTEM INFORMATION\n"); @@ -403,7 +426,7 @@ uint8_t tsk_apfs_fsstat(TSK_FS_INFO* fs_info, apfs_fsstat_info* info) try { return 1; } - const APFSFileSystem vol{to_pool(fs_info->pool_info), fs_info->vol_block}; + const APFSFileSystem vol{fs_info_to_pool(fs_info), to_pool_vol_block(fs_info)}; memset(info, 0, sizeof(*info)); @@ -1315,10 +1338,10 @@ uint8_t APFSFSCompat::decrypt_block(TSK_DADDR_T block_num, void* data) noexcept int APFSFSCompat::name_cmp(const char* s1, const char* s2) const noexcept try { #ifdef HAVE_LIBOPENSSL - const APFSFileSystem vol{to_pool(_fsinfo.pool_info), _fsinfo.vol_block, + const APFSFileSystem vol{ fs_info_to_pool(&_fsinfo), to_pool_vol_block(&_fsinfo), _crypto.password}; #else - const APFSFileSystem vol{ to_pool(_fsinfo.pool_info), _fsinfo.vol_block}; + const APFSFileSystem vol{ fs_info_to_pool(&_fsinfo), to_pool_vol_block(&_fsinfo)}; #endif if (vol.case_sensitive()) { @@ -1350,7 +1373,7 @@ uint8_t tsk_apfs_list_snapshots(TSK_FS_INFO* fs_info, } const auto snapshots = - APFSFileSystem{to_pool(fs_info->pool_info), fs_info->vol_block} + APFSFileSystem{ fs_info_to_pool(fs_info), to_pool_vol_block(fs_info)} .snapshots(); *list = (apfs_snapshot_list*)tsk_malloc( diff --git a/tsk/fs/apfs_compat.hpp b/tsk/fs/apfs_compat.hpp index 97566f42256899393af32d878d2bc77009871ad0..b7605dd6985c1a5422a14a46f3d00d9ddc2087fe 100644 --- a/tsk/fs/apfs_compat.hpp +++ b/tsk/fs/apfs_compat.hpp @@ -23,7 +23,7 @@ class APFSFSCompat : public APFSJObjTree { mutable date_added_cache _da_cache{&_fsinfo}; public: - APFSFSCompat(const TSK_POOL_INFO* pool_info, apfs_block_num vol_block, + APFSFSCompat(TSK_IMG_INFO* img_info, const TSK_POOL_INFO* pool_info, apfs_block_num vol_block, const char* pass = ""); inline const TSK_FS_INFO& fs_info() const noexcept { return _fsinfo; } inline TSK_FS_INFO& fs_info() noexcept { return _fsinfo; } diff --git a/tsk/fs/apfs_open.cpp b/tsk/fs/apfs_open.cpp index 4a480757d275e941eba5bb8cc19df872262b8b08..e470409e5bb55510d6c5ceaf63fad22dbc66d794 100755 --- a/tsk/fs/apfs_open.cpp +++ b/tsk/fs/apfs_open.cpp @@ -37,7 +37,7 @@ TSK_FS_INFO* apfs_open(TSK_IMG_INFO * img_info, TSK_OFF_T offset, } try { - auto fs = new APFSFSCompat(pool_img->pool_info, pool_img->pvol_block, pass); + auto fs = new APFSFSCompat(img_info, pool_img->pool_info, pool_img->pvol_block, pass); return &fs->fs_info(); } catch (std::runtime_error& e) { tsk_error_set_errno(TSK_ERR_FS_GENFS); diff --git a/tsk/fs/fs_io.c b/tsk/fs/fs_io.c index 1a87d85fe9a078dadf980373c2299f509e8169f6..ec1a15326839f8616e0f0cc409f35286dcb4ca29 100755 --- a/tsk/fs/fs_io.c +++ b/tsk/fs/fs_io.c @@ -28,13 +28,6 @@ #include "tsk_fs_i.h" -/** \internal - * Internal method to detect pooled file systems - */ -static inline int is_pool_fs(TSK_FS_INFO * a_fs) { - return (a_fs->pool_info->tag == TSK_POOL_INFO_TAG); -} - /** \internal * Internal method to deal with calculating correct offset when we have pre and post bytes @@ -242,11 +235,7 @@ tsk_fs_read_block_decrypt(TSK_FS_INFO * a_fs, TSK_DADDR_T a_addr, char *a_buf, ssize_t ret_len; - if (is_pool_fs(a_fs)) { - TSK_OFF_T off = (TSK_OFF_T) (a_addr) * a_fs->block_size; - ret_len = tsk_pool_read(a_fs->pool_info, off, a_buf, a_len); - } - else if ((a_fs->block_pre_size == 0) && (a_fs->block_post_size == 0)) { + if ((a_fs->block_pre_size == 0) && (a_fs->block_post_size == 0)) { TSK_OFF_T off = a_fs->offset + (TSK_OFF_T) (a_addr) * a_fs->block_size; ret_len = tsk_img_read(a_fs->img_info, off, a_buf, a_len); diff --git a/tsk/fs/fs_open.c b/tsk/fs/fs_open.c index e1d0cb4a62f194659a3d32c0fb5a2f50887677d6..92362877d6771d849233696ff3583caa4bab4cbd 100755 --- a/tsk/fs/fs_open.c +++ b/tsk/fs/fs_open.c @@ -224,6 +224,8 @@ tsk_fs_open_img_decrypt(TSK_IMG_INFO * a_img_info, TSK_OFF_T a_offset, return yaffs2_open(a_img_info, a_offset, a_ftype, 0); } else if (TSK_FS_TYPE_ISAPFS(a_ftype)) { + printf("Opening apfs\n"); + fflush(stdout); return apfs_open(a_img_info, a_offset, a_ftype, a_pass); } tsk_error_reset(); diff --git a/tsk/fs/tsk_fs.h b/tsk/fs/tsk_fs.h index 3dc8bece872f77d77d55e3db3b16be0710c3b06d..89580f6688015241281f7b036e148671781d5397 100644 --- a/tsk/fs/tsk_fs.h +++ b/tsk/fs/tsk_fs.h @@ -927,16 +927,16 @@ extern "C" { */ struct TSK_FS_INFO { int tag; ///< \internal Will be set to TSK_FS_INFO_TAG if structure is still allocated, 0 if not - union { - struct { + //union { + struct { TSK_IMG_INFO *img_info; ///< Pointer to the image layer state TSK_OFF_T offset; ///< Byte offset into img_info that fs starts - }; - struct { - const TSK_POOL_INFO *pool_info; ///< Pointer to the pool layer state - TSK_DADDR_T vol_block; ///< Block number in the pool for the volume - }; }; + // struct { + // const TSK_POOL_INFO *fs_pool_info; ///< Pointer to the pool layer state + // TSK_DADDR_T fs_vol_block; ///< Block number in the pool for the volume + // }; + //}; /* meta data */ TSK_INUM_T inum_count; ///< Number of metadata addresses diff --git a/tsk/pool/tsk_pool.hpp b/tsk/pool/tsk_pool.hpp index 35e9ae0d0187386497a0a4411fa51eb21c7df137..4195b2ae3ffbccd6542577e064a0b87e6e72a221 100644 --- a/tsk/pool/tsk_pool.hpp +++ b/tsk/pool/tsk_pool.hpp @@ -41,7 +41,7 @@ class TSKPool { virtual const std::vector<range> unallocated_ranges() const { return {}; }; - TSK_IMG_INFO *getTSKImgInfo(int index) { + TSK_IMG_INFO *getTSKImgInfo(int index) const { if (index < _members.size()) { return _members[index].first; }