Merge branch 'scalpel-carver' of https://github.com/tmciver-basis/autopsy into scalpel-carver

This commit is contained in:
adam-m 2013-04-29 19:57:39 -04:00
commit dd284a896e

View File

@ -141,6 +141,15 @@ public class ScalpelCarverIngestModule implements IngestModuleAbstractFile {
// output = new ArrayList<CarvedFileMeta>(); // output = new ArrayList<CarvedFileMeta>();
// output.add(new CarvedFileMeta("carved-from-" + abstractFile.getId() + ".txt", 0, abstractFile.getSize())); // output.add(new CarvedFileMeta("carved-from-" + abstractFile.getId() + ".txt", 0, abstractFile.getSize()));
// get the image's size
long imageSize = Long.MAX_VALUE;
try {
imageSize = abstractFile.getImage().getSize();
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Could not obtain the image's size.");
}
// add a carved file to the DB for each file that scalpel carved // add a carved file to the DB for each file that scalpel carved
SleuthkitCase db = Case.getCurrentCase().getSleuthkitCase(); SleuthkitCase db = Case.getCurrentCase().getSleuthkitCase();
List<LayoutFile> carvedFiles = new ArrayList<LayoutFile>(output.size()); List<LayoutFile> carvedFiles = new ArrayList<LayoutFile>(output.size());
@ -158,6 +167,12 @@ public class ScalpelCarverIngestModule implements IngestModuleAbstractFile {
// get the size of the carved file // get the size of the carved file
long size = carvedFileMeta.getByteLength(); long size = carvedFileMeta.getByteLength();
// hack to fix the size of carved files that run to the end of the image
long endByte = byteOffset + size - 1;
if (endByte >= imageSize) {
size = imageSize - byteOffset;
}
// create the list of TskFileRange objects // create the list of TskFileRange objects
List<TskFileRange> data = new ArrayList<TskFileRange>(); List<TskFileRange> data = new ArrayList<TskFileRange>();
data.add(new TskFileRange(byteOffset, size, 0)); data.add(new TskFileRange(byteOffset, size, 0));