mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Public API fixes/removes for release 4.7.0
This commit is contained in:
parent
fef6c5f510
commit
bee4d28c14
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Sleuth Kit Data Model
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
* Copyright 2015-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -65,7 +65,7 @@ public final class Blackboard implements Closeable {
|
|||||||
throw new BlackboardException("Keyword search service not found");
|
throw new BlackboardException("Keyword search service not found");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
searchService.indexArtifact(artifact);
|
searchService.index(artifact);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
throw new BlackboardException("Error indexing artifact", ex);
|
throw new BlackboardException("Error indexing artifact", ex);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.corecomponentinterfaces;
|
package org.sleuthkit.autopsy.contentviewers;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -26,7 +26,7 @@ import org.sleuthkit.datamodel.AbstractFile;
|
|||||||
* Defines an interface for application specific content viewer
|
* Defines an interface for application specific content viewer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface FileTypeViewer {
|
interface FileTypeViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of MIME types supported by this viewer
|
* Returns list of MIME types supported by this viewer
|
||||||
@ -45,6 +45,11 @@ public interface FileTypeViewer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the data in the panel
|
* Clears the data in the panel
|
||||||
|
*
|
||||||
|
* IMPORTANT IF MAKING THIS PUBLIC: I (RC) am not sure that this method
|
||||||
|
* belongs in this interface. If we are not going to use setFile(null) as a
|
||||||
|
* reset method as in DataContentViewer and DataResultViewer, then this is
|
||||||
|
* fine. Otherwise, it is ambiguous.
|
||||||
*/
|
*/
|
||||||
void resetComponent();
|
void resetComponent();
|
||||||
}
|
}
|
@ -31,7 +31,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic Application content viewer
|
* Generic Application content viewer
|
||||||
|
@ -24,7 +24,6 @@ import java.awt.Dimension;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PListViewer - a file viewer for binary plist files.
|
* PListViewer - a file viewer for binary plist files.
|
||||||
|
@ -50,7 +50,6 @@ import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
|||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,6 +197,7 @@ public final class IngestServices {
|
|||||||
*
|
*
|
||||||
* @deprecated Use getCase instead.
|
* @deprecated Use getCase instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Case getCurrentCase() {
|
public Case getCurrentCase() {
|
||||||
return Case.getCurrentCase();
|
return Case.getCurrentCase();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2018 Basis Technology Corp.
|
* Copyright 2015-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -68,46 +68,56 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
|||||||
private static final Logger logger = Logger.getLogger(SolrSearchService.class.getName());
|
private static final Logger logger = Logger.getLogger(SolrSearchService.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an artifact to the keyword search text index as a concantenation of
|
* Indexes the given content for keyword search.
|
||||||
* all of its attributes.
|
|
||||||
*
|
*
|
||||||
* @param artifact The artifact to index.
|
* IMPORTANT: Currently, there are two correct uses for this code:
|
||||||
*
|
*
|
||||||
* @throws org.sleuthkit.datamodel.TskCoreException
|
* 1) Indexing an artifact created during while either the file level ingest
|
||||||
|
* module pipeline or the first stage data source level ingest module
|
||||||
|
* pipeline of an ingest job is running.
|
||||||
|
*
|
||||||
|
* 2) Indexing a report.
|
||||||
|
*
|
||||||
|
* @param content The content to index.
|
||||||
|
*
|
||||||
|
* @throws TskCoreException If there is a problem indexing the content.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void indexArtifact(BlackboardArtifact artifact) throws TskCoreException {
|
public void index(Content content) throws TskCoreException {
|
||||||
if (artifact == null) {
|
/*
|
||||||
return;
|
* TODO (JIRA-1099): The following code has some issues that need to be
|
||||||
}
|
* resolved. For artifacts, it is assumed that the posting of artifacts
|
||||||
|
* is only occuring during an ingest job with an enabled keyword search
|
||||||
// We only support artifact indexing for Autopsy versions that use
|
* ingest module handling index commits; it also assumes that the
|
||||||
// the negative range for artifact ids.
|
* artifacts are only posted by modules in the either the file level
|
||||||
if (artifact.getArtifactID() > 0) {
|
* ingest pipeline or the first stage data source level ingest pipeline,
|
||||||
|
* so that the artifacts will be searched during a periodic or final
|
||||||
|
* keyword search. It also assumes that the only other type of Content
|
||||||
|
* for which this API will be called are Reports generated at a time
|
||||||
|
* when doing a commit is required and desirable, i.e., in a context
|
||||||
|
* other than an ingest job.
|
||||||
|
*/
|
||||||
|
if (content == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Ingester ingester = Ingester.getDefault();
|
final Ingester ingester = Ingester.getDefault();
|
||||||
|
if (content instanceof BlackboardArtifact) {
|
||||||
|
BlackboardArtifact artifact = (BlackboardArtifact) content;
|
||||||
|
if (artifact.getArtifactID() > 0) {
|
||||||
|
/*
|
||||||
|
* Artifact indexing is only supported for artifacts that use
|
||||||
|
* negative artifact ids to avoid overlapping with the object
|
||||||
|
* ids of other types of Content.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ingester.indexMetaDataOnly(artifact);
|
ingester.indexMetaDataOnly(artifact);
|
||||||
ingester.indexText(new ArtifactTextExtractor(), artifact, null);
|
ingester.indexText(new ArtifactTextExtractor(), artifact, null);
|
||||||
} catch (Ingester.IngesterException ex) {
|
} catch (Ingester.IngesterException ex) {
|
||||||
throw new TskCoreException(ex.getCause().getMessage(), ex);
|
throw new TskCoreException(ex.getCause().getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given Content object to the text index.
|
|
||||||
* @param content The content to index.
|
|
||||||
* @throws TskCoreException
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void index(Content content) throws TskCoreException {
|
|
||||||
if (content == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Ingester ingester = Ingester.getDefault();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ingester.indexText(new TikaTextExtractor(), content, null);
|
ingester.indexText(new TikaTextExtractor(), content, null);
|
||||||
} catch (Ingester.IngesterException ex) {
|
} catch (Ingester.IngesterException ex) {
|
||||||
@ -118,12 +128,9 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
|||||||
throw new TskCoreException(ex.getCause().getMessage(), ex1);
|
throw new TskCoreException(ex.getCause().getMessage(), ex1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Review whether this is the right thing to do. We typically use
|
|
||||||
// a combination of autoCommit and the SearchRunner to ensure that data
|
|
||||||
// is committed but that might not be sufficient for reports (or artifacts).
|
|
||||||
ingester.commit();
|
ingester.commit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to connect to the keyword search service.
|
* Tries to connect to the keyword search service.
|
||||||
@ -231,6 +238,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
|||||||
* Creates/opens the Solr core/text index for a case
|
* Creates/opens the Solr core/text index for a case
|
||||||
*
|
*
|
||||||
* @param context The case context.
|
* @param context The case context.
|
||||||
|
*
|
||||||
* @throws
|
* @throws
|
||||||
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
||||||
*/
|
*/
|
||||||
@ -379,6 +387,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
|||||||
* Closes the open core.
|
* Closes the open core.
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
|
*
|
||||||
* @throws
|
* @throws
|
||||||
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
||||||
*/
|
*/
|
||||||
@ -403,4 +412,36 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
|||||||
throw new AutopsyServiceException(String.format("Failed to close core for %s", context.getCase().getCaseDirectory()), ex);
|
throw new AutopsyServiceException(String.format("Failed to close core for %s", context.getCase().getCaseDirectory()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an artifact to the keyword search text index as a concantenation of
|
||||||
|
* all of its attributes.
|
||||||
|
*
|
||||||
|
* @param artifact The artifact to index.
|
||||||
|
*
|
||||||
|
* @throws org.sleuthkit.datamodel.TskCoreException
|
||||||
|
* @deprecated Call index(Content) instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public void indexArtifact(BlackboardArtifact artifact) throws TskCoreException {
|
||||||
|
if (artifact == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We only support artifact indexing for Autopsy versions that use
|
||||||
|
// the negative range for artifact ids.
|
||||||
|
if (artifact.getArtifactID() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Ingester ingester = Ingester.getDefault();
|
||||||
|
|
||||||
|
try {
|
||||||
|
ingester.indexMetaDataOnly(artifact);
|
||||||
|
ingester.indexText(new ArtifactTextExtractor(), artifact, null);
|
||||||
|
} catch (Ingester.IngesterException ex) {
|
||||||
|
throw new TskCoreException(ex.getCause().getMessage(), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user