mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Merge branch 'custom-release-2.11.0' of https://github.com/sleuthkit/autopsy into custom-release-2.11.0
This commit is contained in:
commit
1b9165ce31
@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.corecomponents;
|
||||
import java.awt.Dimension;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static java.util.Objects.nonNull;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
@ -30,7 +29,6 @@ import javax.swing.JPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Video viewer part of the Media View layered pane. Uses different engines
|
||||
@ -153,11 +151,9 @@ public abstract class MediaViewVideoPanel extends JPanel implements FrameCapture
|
||||
if (AUDIO_EXTENSIONS.contains("." + extension) || getExtensionsList().contains("." + extension)) {
|
||||
SortedSet<String> mimeTypes = new TreeSet<>(getMimeTypes());
|
||||
try {
|
||||
String mimeType = new FileTypeDetector().detect(file);
|
||||
if (nonNull(mimeType)) {
|
||||
return mimeTypes.contains(mimeType);
|
||||
}
|
||||
} catch (FileTypeDetector.FileTypeDetectorInitException | TskCoreException ex) {
|
||||
String mimeType = new FileTypeDetector().detectMIMEType(file);
|
||||
return mimeTypes.contains(mimeType);
|
||||
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
|
||||
logger.log(Level.WARNING, "Failed to look up mimetype for " + file.getName() + " using FileTypeDetector. Fallingback on AbstractFile.isMimeType", ex);
|
||||
if (!mimeTypes.isEmpty() && file.isMimeType(mimeTypes) == AbstractFile.MimeMatchEnum.TRUE) {
|
||||
return true;
|
||||
|
@ -263,12 +263,12 @@ public class ImageUtils {
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
String mimeType = getFileTypeDetector().detect(file);
|
||||
String mimeType = getFileTypeDetector().detectMIMEType(file);
|
||||
if (StringUtils.isNotBlank(mimeTypePrefix) && mimeType.startsWith(mimeTypePrefix)) {
|
||||
return true;
|
||||
}
|
||||
return supportedMimeTypes.contains(mimeType);
|
||||
} catch (FileTypeDetectorInitException | TskCoreException ex) {
|
||||
} catch (FileTypeDetectorInitException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error determining MIME type of " + getContentPathSafe(file), ex);//NON-NLS
|
||||
return false;
|
||||
}
|
||||
|
@ -21,10 +21,14 @@ package org.sleuthkit.autopsy.ingest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* This class manages a sequence of file level ingest modules for a data source
|
||||
@ -136,10 +140,17 @@ final class FileIngestPipeline {
|
||||
break;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
||||
if (!this.job.isCancelled()) {
|
||||
// Save any properties that have not already been saved to the database
|
||||
try{
|
||||
file.save();
|
||||
} catch (TskCoreException ex){
|
||||
Logger.getLogger(FileIngestPipeline.class.getName()).log(Level.SEVERE, "Failed to save data for file " + file.getId(), ex); //NON-NLS
|
||||
}
|
||||
IngestManager.getInstance().fireFileIngestDone(file);
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task);
|
||||
return errors;
|
||||
|
@ -28,7 +28,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.hwpf.usermodel.Picture;
|
||||
@ -135,27 +134,22 @@ class MSOfficeEmbeddedContentExtractor {
|
||||
* supported. Else it returns false.
|
||||
*/
|
||||
boolean isContentExtractionSupported(AbstractFile abstractFile) {
|
||||
try {
|
||||
String abstractFileMimeType = fileTypeDetector.getFileType(abstractFile);
|
||||
for (SupportedExtractionFormats s : SupportedExtractionFormats.values()) {
|
||||
if (s.toString().equals(abstractFileMimeType)) {
|
||||
abstractFileExtractionFormat = s;
|
||||
return true;
|
||||
}
|
||||
String abstractFileMimeType = fileTypeDetector.detectMIMEType(abstractFile);
|
||||
for (SupportedExtractionFormats s : SupportedExtractionFormats.values()) {
|
||||
if (s.toString().equals(abstractFileMimeType)) {
|
||||
abstractFileExtractionFormat = s;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (TskCoreException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error executing FileTypeDetector.getFileType()", ex); // NON-NLS
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method selects the appropriate process of extracting embedded
|
||||
* content from files using either Tika or POI classes. Once the content has
|
||||
* been extracted as files, the method adds them to the DB and fires a
|
||||
* ModuleContentEvent. ModuleContent Event is not fired if no content
|
||||
* was extracted from the processed file.
|
||||
* ModuleContentEvent. ModuleContent Event is not fired if no content was
|
||||
* extracted from the processed file.
|
||||
*
|
||||
* @param abstractFile The abstract file to be processed.
|
||||
*/
|
||||
|
@ -131,9 +131,7 @@ class SevenZipExtractor {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns true if the file format is currently supported. Else
|
||||
* it returns false. Attempt extension based detection in case Apache Tika
|
||||
* based detection fails.
|
||||
* Checks whether extraction is supported for a file, based on MIME type.
|
||||
*
|
||||
* @param abstractFile The AbstractFilw whose mimetype is to be determined.
|
||||
*
|
||||
@ -141,26 +139,12 @@ class SevenZipExtractor {
|
||||
* supported. Else it returns false.
|
||||
*/
|
||||
boolean isSevenZipExtractionSupported(AbstractFile abstractFile) {
|
||||
try {
|
||||
String abstractFileMimeType = fileTypeDetector.getFileType(abstractFile);
|
||||
for (SupportedArchiveExtractionFormats s : SupportedArchiveExtractionFormats.values()) {
|
||||
if (s.toString().equals(abstractFileMimeType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Error executing FileTypeDetector.getFileType()", ex); // NON-NLS
|
||||
}
|
||||
|
||||
// attempt extension matching
|
||||
final String extension = abstractFile.getNameExtension();
|
||||
for (String supportedExtension : SUPPORTED_EXTENSIONS) {
|
||||
if (extension.equals(supportedExtension)) {
|
||||
String abstractFileMimeType = fileTypeDetector.detectMIMEType(abstractFile);
|
||||
for (SupportedArchiveExtractionFormats s : SupportedArchiveExtractionFormats.values()) {
|
||||
if (s.toString().equals(abstractFileMimeType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -188,13 +188,9 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter
|
||||
/*
|
||||
* Qualify the MIME type.
|
||||
*/
|
||||
try {
|
||||
String mimeType = fileTypeDetector.getFileType(file);
|
||||
if (mimeType != null && mimeType.equals("application/octet-stream")) {
|
||||
possiblyEncrypted = true;
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
throw new TskCoreException("Failed to detect the file type.", ex);
|
||||
String mimeType = fileTypeDetector.detectMIMEType(file);
|
||||
if (mimeType.equals("application/octet-stream")) {
|
||||
possiblyEncrypted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ public final class ExifParserFileIngestModule implements FileIngestModule {
|
||||
blackboard = Case.getCurrentCase().getServices().getBlackboard();
|
||||
|
||||
//skip unalloc
|
||||
if ((content.getType().equals(TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) ||
|
||||
(content.getType().equals(TSK_DB_FILES_TYPE_ENUM.SLACK)))) {
|
||||
if ((content.getType().equals(TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)
|
||||
|| (content.getType().equals(TSK_DB_FILES_TYPE_ENUM.SLACK)))) {
|
||||
return ProcessResult.OK;
|
||||
}
|
||||
|
||||
@ -250,17 +250,8 @@ public final class ExifParserFileIngestModule implements FileIngestModule {
|
||||
* @return true if to be processed
|
||||
*/
|
||||
private boolean parsableFormat(AbstractFile f) {
|
||||
try {
|
||||
String mimeType = fileTypeDetector.getFileType(f);
|
||||
if (mimeType != null) {
|
||||
return supportedMimeTypes.contains(mimeType);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to detect file type", ex); //NON-NLS
|
||||
return false;
|
||||
}
|
||||
String mimeType = fileTypeDetector.detectMIMEType(f);
|
||||
return supportedMimeTypes.contains(mimeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,7 +39,6 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.datamodel.TskData.FileKnown;
|
||||
import org.sleuthkit.datamodel.TskException;
|
||||
@ -163,17 +162,14 @@ public class FileExtMismatchIngestModule implements FileIngestModule {
|
||||
*
|
||||
* @return false if the two match. True if there is a mismatch.
|
||||
*/
|
||||
private boolean compareSigTypeToExt(AbstractFile abstractFile) throws TskCoreException {
|
||||
private boolean compareSigTypeToExt(AbstractFile abstractFile) {
|
||||
String currActualExt = abstractFile.getNameExtension();
|
||||
|
||||
// If we are skipping names with no extension
|
||||
if (settings.skipFilesWithNoExtension() && currActualExt.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String currActualSigType = detector.getFileType(abstractFile);
|
||||
if (currActualSigType == null) {
|
||||
return false;
|
||||
}
|
||||
String currActualSigType = detector.detectMIMEType(abstractFile);
|
||||
if (settings.getCheckType() != CHECK_TYPE.ALL) {
|
||||
if (settings.getCheckType() == CHECK_TYPE.NO_TEXT_FILES) {
|
||||
if (!currActualExt.isEmpty() && currActualSigType.equals("text/plain")) { //NON-NLS
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.modules.filetypeid;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -30,12 +29,9 @@ import java.util.stream.Collectors;
|
||||
import org.apache.tika.Tika;
|
||||
import org.apache.tika.io.TikaInputStream;
|
||||
import org.apache.tika.mime.MimeTypes;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.casemodule.services.Blackboard;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
@ -175,61 +171,16 @@ public class FileTypeDetector {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MIME type of a file, detecting it if it is not already known. If
|
||||
* detection is necessary, the result is added to the case database.
|
||||
*
|
||||
* IMPORTANT: This method should only be called by ingest modules. All other
|
||||
* clients should call AbstractFile.getMIMEType, and may call
|
||||
* FileTypeDetector.detect, if AbstractFile.getMIMEType returns null.
|
||||
*
|
||||
* @param file The file.
|
||||
*
|
||||
* @return A MIME type name. If file type could not be detected or results
|
||||
* were uncertain, octet-stream is returned.
|
||||
*
|
||||
* @throws TskCoreException if detection is required and there is a problem
|
||||
* writing the result to the case database.
|
||||
*/
|
||||
public String getFileType(AbstractFile file) throws TskCoreException {
|
||||
return detect(file, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the MIME type of a file. The result is not added to the case
|
||||
* database.
|
||||
* Detects the MIME type of a file.
|
||||
*
|
||||
* @param file The file to test.
|
||||
*
|
||||
* @return A MIME type name. If file type could not be detected or results
|
||||
* @return A MIME type name. If file type could not be detected, or results
|
||||
* were uncertain, octet-stream is returned.
|
||||
*
|
||||
* @throws TskCoreException If there is a problem writing the result to the
|
||||
* case database.
|
||||
*/
|
||||
public String detect(AbstractFile file) throws TskCoreException {
|
||||
return detect(file, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the MIME type of a file. The result is saved to the case database
|
||||
* only if the add to case database flag is set.
|
||||
*
|
||||
* @param file The file to test.
|
||||
* @param addToCaseDb Whether the MIME type should be added to the case
|
||||
* database. This flag is part of a partial workaround
|
||||
* for a check-then-act-race condition (see notes in
|
||||
* comments for details).
|
||||
*
|
||||
* @return A MIME type name. If file type could not be detected or results
|
||||
* were uncertain, octet-stream is returned.
|
||||
*
|
||||
* @throws TskCoreException If there is a problem writing the result to the
|
||||
* case database.
|
||||
*/
|
||||
private String detect(AbstractFile file, boolean addToCaseDb) throws TskCoreException {
|
||||
public String detectMIMEType(AbstractFile file) {
|
||||
/*
|
||||
* Check to see if the file has already been typed. This is the "check"
|
||||
* part of a check-then-act race condition (see note below).
|
||||
* Check to see if the file has already been typed.
|
||||
*/
|
||||
String mimeType = file.getMIMEType();
|
||||
if (null != mimeType) {
|
||||
@ -274,10 +225,10 @@ public class FileTypeDetector {
|
||||
*/
|
||||
if (null == mimeType) {
|
||||
ReadContentInputStream stream = new ReadContentInputStream(file);
|
||||
|
||||
|
||||
try (TikaInputStream tikaInputStream = TikaInputStream.get(stream)) {
|
||||
String tikaType = tika.detect(tikaInputStream, file.getName());
|
||||
|
||||
|
||||
/*
|
||||
* Remove the Tika suffix from the MIME type name.
|
||||
*/
|
||||
@ -299,30 +250,6 @@ public class FileTypeDetector {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If adding the result to the case database, do so now.
|
||||
*
|
||||
* NOTE: This condtional is a way to deal with the check-then-act race
|
||||
* condition created by the gap between querying the MIME type and
|
||||
* recording it. It is not really a problem for the mime_type column of
|
||||
* the tsk_files table, but it can lead to duplicate blackboard posts,
|
||||
* and the posts are required to maintain backward compatibility.
|
||||
* Various mitigation strategies were considered. It was decided to go
|
||||
* with the policy that only ingest modules are allowed to add file
|
||||
* types to the case database, at least until such time as file types
|
||||
* are no longer posted to the blackboard. Of course, this is not a
|
||||
* perfect solution. It's not really enforceable for community
|
||||
* contributed plug ins and it does not handle the unlikely but possible
|
||||
* scenario of multiple processes typing the same file for a multi-user
|
||||
* case.
|
||||
*/
|
||||
if (addToCaseDb) {
|
||||
/*
|
||||
* Add the MIME type to the files table in the case database.
|
||||
*/
|
||||
Case.getCurrentCase().getSleuthkitCase().setFileMIMEType(file, mimeType);
|
||||
}
|
||||
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
@ -344,7 +271,9 @@ public class FileTypeDetector {
|
||||
|
||||
/**
|
||||
* Determines whether or not the a file matches a user-defined custom file
|
||||
* type.
|
||||
* type. If the file matches and corresponds to an interesting files type
|
||||
* rule, this method has the side effect of creating an interesting files
|
||||
* hit artifact and indexing that artifact for keyword search.
|
||||
*
|
||||
* @param file The file to test.
|
||||
*
|
||||
@ -352,37 +281,28 @@ public class FileTypeDetector {
|
||||
*
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
private String detectUserDefinedType(AbstractFile file) throws TskCoreException {
|
||||
private String detectUserDefinedType(AbstractFile file) {
|
||||
for (FileType fileType : userDefinedFileTypes) {
|
||||
if (fileType.matches(file)) {
|
||||
if (fileType.createInterestingFileHit()) {
|
||||
BlackboardArtifact artifact;
|
||||
artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
|
||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||
BlackboardAttribute setNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, FileTypeIdModuleFactory.getModuleName(), fileType.getInterestingFilesSetName());
|
||||
attributes.add(setNameAttribute);
|
||||
|
||||
/*
|
||||
* Use the MIME type as the category attribute, i.e., the
|
||||
* rule that determined this file belongs to the interesting
|
||||
* files set.
|
||||
*/
|
||||
BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, FileTypeIdModuleFactory.getModuleName(), fileType.getMimeType());
|
||||
attributes.add(ruleNameAttribute);
|
||||
|
||||
artifact.addAttributes(attributes);
|
||||
/*
|
||||
* Index the artifact for keyword search.
|
||||
*/
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getBlackboard().indexArtifact(artifact);
|
||||
} catch (Blackboard.BlackboardException ex) {
|
||||
logger.log(Level.SEVERE, String.format("Unable to index blackboard artifact %d", artifact.getArtifactID()), ex); //NON-NLS
|
||||
MessageNotifyUtil.Notify.error(
|
||||
NbBundle.getMessage(Blackboard.class, "Blackboard.unableToIndexArtifact.exception.msg"), artifact.getDisplayName());
|
||||
BlackboardArtifact artifact;
|
||||
artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
|
||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||
BlackboardAttribute setNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, FileTypeIdModuleFactory.getModuleName(), fileType.getInterestingFilesSetName());
|
||||
attributes.add(setNameAttribute);
|
||||
BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, FileTypeIdModuleFactory.getModuleName(), fileType.getMimeType());
|
||||
attributes.add(ruleNameAttribute);
|
||||
artifact.addAttributes(attributes);
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getBlackboard().indexArtifact(artifact);
|
||||
} catch (Blackboard.BlackboardException ex) {
|
||||
logger.log(Level.SEVERE, String.format("Unable to index TSK_INTERESTING_FILE_HIT blackboard artifact %d (file obj_id=%d)", artifact.getArtifactID(), file.getId()), ex); //NON-NLS
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, String.format("Unable to create TSK_INTERESTING_FILE_HIT artifact for file (obj_id=%d)", file.getId()), ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
return fileType.getMimeType();
|
||||
}
|
||||
}
|
||||
@ -396,10 +316,8 @@ public class FileTypeDetector {
|
||||
* @param file The file to test.
|
||||
*
|
||||
* @return The file type name string or null, if no match is detected.
|
||||
*
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
private String detectAutopsyDefinedType(AbstractFile file) throws TskCoreException {
|
||||
private String detectAutopsyDefinedType(AbstractFile file) {
|
||||
for (FileType fileType : autopsyDefinedFileTypes) {
|
||||
if (fileType.matches(file)) {
|
||||
return fileType.getMimeType();
|
||||
@ -469,12 +387,58 @@ public class FileTypeDetector {
|
||||
*
|
||||
* @throws TskCoreException if detection is required and there is a problem
|
||||
* writing the result to the case database.
|
||||
* @deprecated Use getFileType instead and use AbstractFile.getMIMEType
|
||||
* instead of querying the blackboard.
|
||||
* @deprecated Use detectMIMEType instead, and call AbstractFile.setMIMEType
|
||||
* and AbstractFile.save to save the result to the file object and the
|
||||
* database.
|
||||
*/
|
||||
@Deprecated
|
||||
public String detectAndPostToBlackboard(AbstractFile file) throws TskCoreException {
|
||||
return getFileType(file);
|
||||
String fileType = detectMIMEType(file);
|
||||
file.setMIMEType(fileType);
|
||||
file.save();
|
||||
return fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MIME type of a file, detecting it if it is not already known. If
|
||||
* detection is necessary, the result is added to the case database.
|
||||
*
|
||||
* @param file The file.
|
||||
*
|
||||
* @return A MIME type name. If file type could not be detected or results
|
||||
* were uncertain, octet-stream is returned.
|
||||
*
|
||||
* @throws TskCoreException if detection is required and there is a problem
|
||||
* writing the result to the case database.
|
||||
*
|
||||
* @deprecated Use detectMIMEType instead, and call AbstractFile.setMIMEType
|
||||
* and AbstractFile.save to save the result to the file object and the
|
||||
* database.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getFileType(AbstractFile file) throws TskCoreException {
|
||||
String fileType = detectMIMEType(file);
|
||||
file.setMIMEType(fileType);
|
||||
file.save();
|
||||
return fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the MIME type of a file. The result is not added to the case
|
||||
* database.
|
||||
*
|
||||
* @param file The file to test.
|
||||
*
|
||||
* @return A MIME type name. If file type could not be detected or results
|
||||
* were uncertain, octet-stream is returned.
|
||||
*
|
||||
* @throws TskCoreException
|
||||
* @deprecated Use detectMIMEType instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public String detect(AbstractFile file) throws TskCoreException {
|
||||
String fileType = detectMIMEType(file);
|
||||
return fileType;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class FileTypeIdIngestModule implements FileIngestModule {
|
||||
*/
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
fileTypeDetector.getFileType(file);
|
||||
file.setMIMEType(fileTypeDetector.detectMIMEType(file));
|
||||
addToTotals(jobId, (System.currentTimeMillis() - startTime));
|
||||
return ProcessResult.OK;
|
||||
} catch (Exception e) {
|
||||
|
@ -176,7 +176,8 @@ public class HashDbIngestModule implements FileIngestModule {
|
||||
if (md5Hash == null || md5Hash.isEmpty()) {
|
||||
try {
|
||||
long calcstart = System.currentTimeMillis();
|
||||
md5Hash = HashUtility.calculateMd5(file);
|
||||
md5Hash = HashUtility.calculateMd5Hash(file);
|
||||
file.setMd5Hash(md5Hash);
|
||||
long delta = (System.currentTimeMillis() - calcstart);
|
||||
totals.totalCalctime.addAndGet(delta);
|
||||
|
||||
@ -205,20 +206,8 @@ public class HashDbIngestModule implements FileIngestModule {
|
||||
foundBad = true;
|
||||
totals.totalKnownBadCount.incrementAndGet();
|
||||
|
||||
try {
|
||||
skCase.setKnown(file, TskData.FileKnown.BAD);
|
||||
} catch (TskException ex) {
|
||||
logger.log(Level.WARNING, "Couldn't set notable state for file " + name + " - see sleuthkit log for details", ex); //NON-NLS
|
||||
services.postMessage(IngestMessage.createErrorMessage(
|
||||
HashLookupModuleFactory.getModuleName(),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"HashDbIngestModule.hashLookupErrorMsg",
|
||||
name),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"HashDbIngestModule.settingKnownBadStateErr",
|
||||
name)));
|
||||
ret = ProcessResult.ERROR;
|
||||
}
|
||||
file.setKnown(TskData.FileKnown.BAD);
|
||||
|
||||
String hashSetName = db.getDisplayName();
|
||||
|
||||
String comment = "";
|
||||
@ -262,13 +251,8 @@ public class HashDbIngestModule implements FileIngestModule {
|
||||
try {
|
||||
long lookupstart = System.currentTimeMillis();
|
||||
if (db.lookupMD5Quick(file)) {
|
||||
try {
|
||||
skCase.setKnown(file, TskData.FileKnown.KNOWN);
|
||||
break;
|
||||
} catch (TskException ex) {
|
||||
logger.log(Level.WARNING, "Couldn't set known state for file " + name + " - see sleuthkit log for details", ex); //NON-NLS
|
||||
ret = ProcessResult.ERROR;
|
||||
}
|
||||
file.setKnown(TskData.FileKnown.KNOWN);
|
||||
break;
|
||||
}
|
||||
long delta = (System.currentTimeMillis() - lookupstart);
|
||||
totals.totalLookuptime.addAndGet(delta);
|
||||
|
@ -5,7 +5,7 @@ netbeans-plat-version=8.1
|
||||
suite.dir=${basedir}
|
||||
nbplatform.active.dir=${suite.dir}/netbeans-plat/${netbeans-plat-version}
|
||||
harness.dir=${nbplatform.active.dir}/harness
|
||||
bootstrap.url=http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/netbeans/harness/tasks.jar
|
||||
bootstrap.url=http://bits.netbeans.org/dev/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/netbeans/harness/tasks.jar
|
||||
# Where we get the platform from. To see what versions are available, open URL in browser up to the .../updates part of the URL
|
||||
autoupdate.catalog.url=http://updates.netbeans.org/netbeans/updates/${netbeans-plat-version}/uc/final/distribution/catalog.xml.gz
|
||||
cluster.path=\
|
||||
|
@ -190,7 +190,7 @@ public enum FileTypeUtils {
|
||||
*
|
||||
* @return true if this file is supported or false if not
|
||||
*/
|
||||
public static boolean isDrawable(AbstractFile file) throws TskCoreException, FileTypeDetector.FileTypeDetectorInitException {
|
||||
public static boolean isDrawable(AbstractFile file) throws FileTypeDetector.FileTypeDetectorInitException {
|
||||
return hasDrawableMIMEType(file);
|
||||
}
|
||||
|
||||
@ -219,8 +219,8 @@ public enum FileTypeUtils {
|
||||
* type. False if a non image/video mimetype. empty Optional if a
|
||||
* mimetype could not be detected.
|
||||
*/
|
||||
static boolean hasDrawableMIMEType(AbstractFile file) throws TskCoreException, FileTypeDetector.FileTypeDetectorInitException {
|
||||
String mimeType = getFileTypeDetector().detect(file).toLowerCase();
|
||||
static boolean hasDrawableMIMEType(AbstractFile file) throws FileTypeDetector.FileTypeDetectorInitException {
|
||||
String mimeType = getFileTypeDetector().detectMIMEType(file).toLowerCase();
|
||||
return isDrawableMimeType(mimeType) || (mimeType.equals("audio/x-aiff") && "tiff".equalsIgnoreCase(file.getNameExtension()));
|
||||
}
|
||||
|
||||
@ -235,9 +235,9 @@ public enum FileTypeUtils {
|
||||
*/
|
||||
public static boolean hasVideoMIMEType(AbstractFile file) {
|
||||
try {
|
||||
String mimeType = getFileTypeDetector().detect(file).toLowerCase();
|
||||
String mimeType = getFileTypeDetector().detectMIMEType(file).toLowerCase();
|
||||
return mimeType.startsWith("video/") || videoMimeTypes.contains(mimeType);
|
||||
} catch (FileTypeDetector.FileTypeDetectorInitException | TskCoreException ex) {
|
||||
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error determining MIME type of " + getContentPathSafe(file), ex);
|
||||
return false;
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ public final class ImageGalleryController {
|
||||
}
|
||||
|
||||
@Override
|
||||
void processFile(AbstractFile f, DrawableDB.DrawableTransaction tr) throws TskCoreException {
|
||||
void processFile(AbstractFile f, DrawableDB.DrawableTransaction tr) {
|
||||
final boolean known = f.getKnown() == TskData.FileKnown.KNOWN;
|
||||
|
||||
if (known) {
|
||||
|
@ -41,7 +41,6 @@ import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
|
||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.datamodel.TskData.FileKnown;
|
||||
|
||||
@ -509,16 +508,10 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
|
||||
return;
|
||||
}
|
||||
|
||||
String fileType;
|
||||
try {
|
||||
if (context.fileIngestIsCancelled()) {
|
||||
return;
|
||||
}
|
||||
fileType = fileTypeDetector.getFileType(aFile);
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, String.format("Could not detect format using fileTypeDetector for file: %s", aFile), ex); //NON-NLS
|
||||
if (context.fileIngestIsCancelled()) {
|
||||
return;
|
||||
}
|
||||
String fileType = fileTypeDetector.detectMIMEType(aFile);
|
||||
|
||||
// we skip archive formats that are opened by the archive module.
|
||||
// @@@ We could have a check here to see if the archive module was enabled though...
|
||||
|
@ -6,7 +6,7 @@ netbeans-plat-version=8.1
|
||||
suite.dir=${basedir}
|
||||
nbplatform.active.dir=${suite.dir}/netbeans-plat/${netbeans-plat-version}
|
||||
harness.dir=${nbplatform.active.dir}/harness
|
||||
bootstrap.url=http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/netbeans/harness/tasks.jar
|
||||
bootstrap.url=http://bits.netbeans.org/dev/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/netbeans/harness/tasks.jar
|
||||
# Where we get the platform from. To see what versions are available, open URL in browser up to the .../updates part of the URL
|
||||
autoupdate.catalog.url=http://updates.netbeans.org/netbeans/updates/${netbeans-plat-version}/uc/final/distribution/catalog.xml.gz
|
||||
cluster.path=\
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Updated by build script
|
||||
#Mon, 18 Dec 2017 14:43:20 -0500
|
||||
#Fri, 05 Jan 2018 10:31:22 -0500
|
||||
LBL_splash_window_title=Starting Autopsy
|
||||
SPLASH_HEIGHT=314
|
||||
SPLASH_WIDTH=538
|
||||
|
@ -1,4 +1,4 @@
|
||||
#Updated by build script
|
||||
#Mon, 18 Dec 2017 14:43:20 -0500
|
||||
#Fri, 05 Jan 2018 10:31:22 -0500
|
||||
CTL_MainWindow_Title=Autopsy 4.5.0
|
||||
CTL_MainWindow_Title_No_Project=Autopsy 4.5.0
|
||||
|
@ -5,7 +5,7 @@ netbeans-plat-version=8.2
|
||||
suite.dir=${basedir}
|
||||
nbplatform.active.dir=${suite.dir}/netbeans-plat/${netbeans-plat-version}
|
||||
harness.dir=${nbplatform.active.dir}/harness
|
||||
bootstrap.url=http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/netbeans/harness/tasks.jar
|
||||
bootstrap.url=http://bits.netbeans.org/dev/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/netbeans/harness/tasks.jar
|
||||
# Where we get the platform from. To see what versions are available, open URL in browser up to the .../updates part of the URL
|
||||
autoupdate.catalog.url=http://updates.netbeans.org/netbeans/updates/${netbeans-plat-version}/uc/final/distribution/catalog.xml.gz
|
||||
cluster.path=\
|
||||
@ -132,4 +132,4 @@ org.apache.tools.ant.module,\
|
||||
org.netbeans.modules.whitelist,\
|
||||
org.netbeans.modules.xml.jaxb,\
|
||||
org.netbeans.modules.xml.tools.java,\
|
||||
org.netbeans.spi.java.hints
|
||||
org.netbeans.spi.java.hints
|
||||
|
Loading…
x
Reference in New Issue
Block a user