Merge pull request #1803 from BasisOlivers/custom_artifact_addition

Custom artifact addition
This commit is contained in:
Richard Cordovano 2016-01-08 11:41:51 -05:00
commit 3f66ff6299
2 changed files with 12 additions and 5 deletions

View File

@ -213,9 +213,14 @@ public class ExtractedContent implements AutopsyVisitableItem {
@Override @Override
protected boolean createKeys(List<BlackboardArtifact.ARTIFACT_TYPE> list) { protected boolean createKeys(List<BlackboardArtifact.ARTIFACT_TYPE> list) {
//TEST COMMENT
if (skCase != null) { if (skCase != null) {
try { try {
List<BlackboardArtifact.ARTIFACT_TYPE> inUse = skCase.getBlackboardArtifactTypesInUse(); List<BlackboardArtifact.ARTIFACT_TYPE> inUse = new ArrayList<>();
List<Integer> types = skCase.getArtifactTypesInUse();
for (Integer i: types) {
inUse.add(BlackboardArtifact.ARTIFACT_TYPE.fromID(i));
}
inUse.removeAll(doNotShow); inUse.removeAll(doNotShow);
Collections.sort(inUse, Collections.sort(inUse,
new Comparator<BlackboardArtifact.ARTIFACT_TYPE>() { new Comparator<BlackboardArtifact.ARTIFACT_TYPE>() {

View File

@ -45,7 +45,6 @@ public class FileTypeDetector {
private static final int BUFFER_SIZE = 64 * 1024; private static final int BUFFER_SIZE = 64 * 1024;
private final byte buffer[] = new byte[BUFFER_SIZE]; private final byte buffer[] = new byte[BUFFER_SIZE];
private final List<FileType> userDefinedFileTypes; private final List<FileType> userDefinedFileTypes;
private static Blackboard blackboard;
private static final Logger logger = Logger.getLogger(FileTypeDetector.class.getName()); private static final Logger logger = Logger.getLogger(FileTypeDetector.class.getName());
/** /**
@ -174,7 +173,6 @@ public class FileTypeDetector {
* @throws TskCoreException * @throws TskCoreException
*/ */
public String detect(AbstractFile file) throws TskCoreException { public String detect(AbstractFile file) throws TskCoreException {
blackboard = Case.getCurrentCase().getServices().getBlackboard();
// consistently mark non-regular files (refer TskData.TSK_FS_META_TYPE_ENUM), // consistently mark non-regular files (refer TskData.TSK_FS_META_TYPE_ENUM),
// 0 sized files, unallocated, and unused blocks (refer TskData.TSK_DB_FILES_TYPE_ENUM) // 0 sized files, unallocated, and unused blocks (refer TskData.TSK_DB_FILES_TYPE_ENUM)
// as octet-stream. // as octet-stream.
@ -247,9 +245,13 @@ public class FileTypeDetector {
try { try {
// index the artifact for keyword search // index the artifact for keyword search
blackboard.indexArtifact(artifact); Case.getCurrentCase().getServices().getBlackboard().indexArtifact(artifact);
} catch (Blackboard.BlackboardException ex) { } catch (Blackboard.BlackboardException ex) {
logger.log(Level.SEVERE, NbBundle.getMessage(Blackboard.class, "Blackboard.unableToIndexArtifact.error.msg", artifact.getDisplayName()), ex); //NON-NLS 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());
} catch (IllegalStateException ex) {
logger.log(Level.SEVERE, String.format("Unable to index blackboard artifact %d", artifact.getArtifactID()), ex);
MessageNotifyUtil.Notify.error( MessageNotifyUtil.Notify.error(
NbBundle.getMessage(Blackboard.class, "Blackboard.unableToIndexArtifact.exception.msg"), artifact.getDisplayName()); NbBundle.getMessage(Blackboard.class, "Blackboard.unableToIndexArtifact.exception.msg"), artifact.getDisplayName());
} }