mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
introduce ArtifactExtractor
This commit is contained in:
parent
359dc16ee5
commit
1a70a4e8b2
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
|
||||
public class ArtifactExtractor extends TextProvider<Void, BlackboardArtifact> {
|
||||
|
||||
@Override
|
||||
boolean noExtractionOptionsAreEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
void logWarning(String msg, Exception ex) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
Void newAppendixProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
InputStream getInputStream(BlackboardArtifact source) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
Reader getReader(InputStream stream, BlackboardArtifact source, Void appendix) throws Ingester.IngesterException {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
@ -328,7 +328,7 @@ class Ingester {
|
||||
*
|
||||
* @throws org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException
|
||||
*/
|
||||
private void indexContentStream(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException {
|
||||
void indexContentStream(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException {
|
||||
if (fields.get(Server.Schema.IMAGE_ID.toString()) == null) {
|
||||
//skip the file, image id unknown
|
||||
String msg = NbBundle.getMessage(this.getClass(),
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2015 Basis Technology Corp.
|
||||
* Copyright 2011-2016 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,24 +19,24 @@
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.MissingResourceException;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||
import org.apache.solr.common.util.ContentStreamBase.StringStream;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.openide.util.NbBundle;
|
||||
import java.net.InetAddress;
|
||||
import java.util.MissingResourceException;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* An implementation of the KeywordSearchService interface that uses Solr for
|
||||
|
@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
@ -28,11 +26,7 @@ import org.sleuthkit.datamodel.AbstractFile;
|
||||
* Common methods for utilities that extract text and content and divide into
|
||||
* chunks
|
||||
*/
|
||||
abstract class TextExtractor<AppendixProvider> {
|
||||
|
||||
Ingester getIngester() {
|
||||
return Server.getIngester();
|
||||
}
|
||||
abstract class TextExtractor<AppendixProvider> extends TextProvider<AppendixProvider, AbstractFile> {
|
||||
|
||||
/**
|
||||
* Common options that can be used by some extractors
|
||||
@ -86,16 +80,6 @@ abstract class TextExtractor<AppendixProvider> {
|
||||
"application/x-z", //NON-NLS
|
||||
"application/x-compress"); //NON-NLS
|
||||
|
||||
// /**
|
||||
// * Index the Abstract File
|
||||
// *
|
||||
// * @param sourceFile file to index
|
||||
// *
|
||||
// * @return true if indexed successfully, false otherwise
|
||||
// *
|
||||
// * @throws org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException
|
||||
// */
|
||||
// boolean chunkText(AbstractFile sourceFile, IngestJobContext context) throws Ingester.IngesterException;
|
||||
/**
|
||||
* Determines if the extractor works only for specified types is
|
||||
* supportedTypes() or whether is a generic content extractor (such as
|
||||
@ -117,17 +101,6 @@ abstract class TextExtractor<AppendixProvider> {
|
||||
*/
|
||||
abstract boolean isSupported(AbstractFile file, String detectedFormat);
|
||||
|
||||
abstract boolean noExtractionOptionsAreEnabled();
|
||||
|
||||
abstract void logWarning(final String msg, Exception ex);
|
||||
|
||||
void appendDataToFinalChunk(StringBuilder sb, AppendixProvider dataProvider) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
abstract AppendixProvider newAppendixProvider();
|
||||
|
||||
abstract InputStream getInputStream(AbstractFile sourceFile1);
|
||||
|
||||
abstract Reader getReader(InputStream stream, AbstractFile sourceFile, AppendixProvider appendix) throws Ingester.IngesterException;
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-16 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
abstract class TextProvider<AppendixProvider, TextSource> {
|
||||
|
||||
abstract boolean noExtractionOptionsAreEnabled();
|
||||
|
||||
abstract void logWarning(final String msg, Exception ex);
|
||||
|
||||
void appendDataToFinalChunk(StringBuilder sb, AppendixProvider dataProvider) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
abstract AppendixProvider newAppendixProvider();
|
||||
|
||||
abstract InputStream getInputStream(TextSource source);
|
||||
|
||||
abstract Reader getReader(InputStream stream, TextSource source, AppendixProvider appendix) throws Ingester.IngesterException;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user