Fixed linux and mac suport, updated build documentation and renamed the module to Picture Analyzer

This commit is contained in:
U-BASIS\dsmyda 2020-08-18 01:50:54 -04:00
parent 534c110513
commit f96f235766
13 changed files with 76 additions and 38 deletions

View File

@ -21,7 +21,7 @@ package org.sleuthkit.autopsy.discovery;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeIdModuleFactory; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeIdModuleFactory;
import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupModuleFactory; import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupModuleFactory;
import org.sleuthkit.autopsy.modules.pictureanalysis.PictureAnalysisIngestModuleFactory; import org.sleuthkit.autopsy.modules.pictureanalyzer.PictureAnalyzerIngestModuleFactory;
import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestJobInfo;
import org.sleuthkit.datamodel.IngestModuleInfo; import org.sleuthkit.datamodel.IngestModuleInfo;
@ -118,7 +118,7 @@ class DataSourceModulesWrapper {
* data source. * data source.
*/ */
private void updateExifStatus(IngestModuleInfo moduleInfo) { private void updateExifStatus(IngestModuleInfo moduleInfo) {
if (!exifModuleRun && moduleInfo.getDisplayName().equals(PictureAnalysisIngestModuleFactory.getModuleName())) { if (!exifModuleRun && moduleInfo.getDisplayName().equals(PictureAnalyzerIngestModuleFactory.getModuleName())) {
exifModuleRun = true; exifModuleRun = true;
} }
} }

View File

@ -39,7 +39,7 @@ import org.sleuthkit.autopsy.modules.photoreccarver.PhotoRecCarverIngestModuleFa
import org.sleuthkit.autopsy.modules.embeddedfileextractor.EmbeddedFileExtractorModuleFactory; import org.sleuthkit.autopsy.modules.embeddedfileextractor.EmbeddedFileExtractorModuleFactory;
import org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionModuleFactory; import org.sleuthkit.autopsy.modules.encryptiondetection.EncryptionDetectionModuleFactory;
import org.sleuthkit.autopsy.centralrepository.ingestmodule.CentralRepoIngestModuleFactory; import org.sleuthkit.autopsy.centralrepository.ingestmodule.CentralRepoIngestModuleFactory;
import org.sleuthkit.autopsy.modules.pictureanalysis.PictureAnalysisIngestModuleFactory; import org.sleuthkit.autopsy.modules.pictureanalyzer.PictureAnalyzerIngestModuleFactory;
import org.sleuthkit.autopsy.modules.vmextractor.VMExtractorIngestModuleFactory; import org.sleuthkit.autopsy.modules.vmextractor.VMExtractorIngestModuleFactory;
import org.sleuthkit.autopsy.python.JythonModuleLoader; import org.sleuthkit.autopsy.python.JythonModuleLoader;
@ -60,7 +60,7 @@ final class IngestModuleFactoryLoader {
add(FileTypeIdModuleFactory.class.getCanonicalName()); add(FileTypeIdModuleFactory.class.getCanonicalName());
add(FileExtMismatchDetectorModuleFactory.class.getCanonicalName()); add(FileExtMismatchDetectorModuleFactory.class.getCanonicalName());
add(EmbeddedFileExtractorModuleFactory.class.getCanonicalName()); add(EmbeddedFileExtractorModuleFactory.class.getCanonicalName());
add(PictureAnalysisIngestModuleFactory.class.getCanonicalName()); add(PictureAnalyzerIngestModuleFactory.class.getCanonicalName());
add("org.sleuthkit.autopsy.keywordsearch.KeywordSearchModuleFactory"); //NON-NLS add("org.sleuthkit.autopsy.keywordsearch.KeywordSearchModuleFactory"); //NON-NLS
add("org.sleuthkit.autopsy.thunderbirdparser.EmailParserModuleFactory"); //NON-NLS add("org.sleuthkit.autopsy.thunderbirdparser.EmailParserModuleFactory"); //NON-NLS
add(EncryptionDetectionModuleFactory.class.getCanonicalName()); add(EncryptionDetectionModuleFactory.class.getCanonicalName());

View File

@ -1,3 +0,0 @@
PictureAnalysisIngestModule.cannot_run_file_type=Cannot run file type detection.
PictureAnalysisIngestModuleFactory.module_description=Performs general analysis on picture files, including extracting EXIF metadata and converting between formats.
PictureAnalysisIngestModuleFactory.module_name=Picture Analysis

View File

@ -0,0 +1,3 @@
PictureAnalyzerIngestModule.cannot_run_file_type=Cannot run file type detection.
PictureAnalyzerIngestModuleFactory.module_description=Performs general analysis on picture files, including extracting EXIF metadata and converting between formats.
PictureAnalyzerIngestModuleFactory.module_name=Picture Analyzer

View File

@ -1 +1 @@
PictureAnalysisIngestModule.cannot_run_file_type=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u306e\u691c\u51fa\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002 PictureAnalyzerIngestModule.cannot_run_file_type=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u306e\u691c\u51fa\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002

View File

@ -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.modules.pictureanalysis; package org.sleuthkit.autopsy.modules.pictureanalyzer;
import java.util.Collection; import java.util.Collection;
@ -25,7 +25,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter;
import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.autopsy.modules.pictureanalysis.spi.PictureProcessor; import org.sleuthkit.autopsy.modules.pictureanalyzer.spi.PictureProcessor;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -37,7 +37,7 @@ import org.sleuthkit.datamodel.TskData;
* module acts as a container for multiple PictureProcessors, which are the * module acts as a container for multiple PictureProcessors, which are the
* classes that do the work mentioned in the examples above. * classes that do the work mentioned in the examples above.
*/ */
public class PictureAnalysisIngestModule extends FileIngestModuleAdapter { public class PictureAnalyzerIngestModule extends FileIngestModuleAdapter {
private FileTypeDetector fileTypeDetector; private FileTypeDetector fileTypeDetector;
private Collection<? extends PictureProcessor> registry; private Collection<? extends PictureProcessor> registry;
@ -71,7 +71,7 @@ public class PictureAnalysisIngestModule extends FileIngestModuleAdapter {
@Override @Override
@NbBundle.Messages({ @NbBundle.Messages({
"PictureAnalysisIngestModule.cannot_run_file_type=Cannot run file type detection." "PictureAnalyzerIngestModule.cannot_run_file_type=Cannot run file type detection."
}) })
public void startUp(IngestJobContext context) throws IngestModuleException { public void startUp(IngestJobContext context) throws IngestModuleException {
registry = Lookup.getDefault().lookupAll(PictureProcessor.class); registry = Lookup.getDefault().lookupAll(PictureProcessor.class);
@ -79,7 +79,7 @@ public class PictureAnalysisIngestModule extends FileIngestModuleAdapter {
try { try {
fileTypeDetector = new FileTypeDetector(); fileTypeDetector = new FileTypeDetector();
} catch (FileTypeDetector.FileTypeDetectorInitException ex) { } catch (FileTypeDetector.FileTypeDetectorInitException ex) {
throw new IngestModuleException(Bundle.PictureAnalysisIngestModule_cannot_run_file_type(), ex); throw new IngestModuleException(Bundle.PictureAnalyzerIngestModule_cannot_run_file_type(), ex);
} }
} }

View File

@ -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.modules.pictureanalysis; package org.sleuthkit.autopsy.modules.pictureanalyzer;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
@ -30,13 +30,13 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
* Factory for the Picture Analysis ingest module. * Factory for the Picture Analysis ingest module.
*/ */
@ServiceProvider(service = IngestModuleFactory.class) @ServiceProvider(service = IngestModuleFactory.class)
public class PictureAnalysisIngestModuleFactory extends IngestModuleFactoryAdapter { public class PictureAnalyzerIngestModuleFactory extends IngestModuleFactoryAdapter {
@NbBundle.Messages({ @NbBundle.Messages({
"PictureAnalysisIngestModuleFactory.module_name=Picture Analysis" "PictureAnalyzerIngestModuleFactory.module_name=Picture Analyzer"
}) })
public static String getModuleName() { public static String getModuleName() {
return Bundle.PictureAnalysisIngestModuleFactory_module_name(); return Bundle.PictureAnalyzerIngestModuleFactory_module_name();
} }
@Override @Override
@ -46,12 +46,12 @@ public class PictureAnalysisIngestModuleFactory extends IngestModuleFactoryAdapt
@Override @Override
@NbBundle.Messages({ @NbBundle.Messages({
"PictureAnalysisIngestModuleFactory.module_description=Performs general" "PictureAnalyzerIngestModuleFactory.module_description=Performs general"
+ " analysis on picture files, including extracting EXIF metadata" + " analysis on picture files, including extracting EXIF metadata"
+ " and converting between formats." + " and converting between formats."
}) })
public String getModuleDescription() { public String getModuleDescription() {
return Bundle.PictureAnalysisIngestModuleFactory_module_description(); return Bundle.PictureAnalyzerIngestModuleFactory_module_description();
} }
@Override @Override
@ -61,7 +61,7 @@ public class PictureAnalysisIngestModuleFactory extends IngestModuleFactoryAdapt
@Override @Override
public FileIngestModule createFileIngestModule(IngestModuleIngestJobSettings ingestOptions) { public FileIngestModule createFileIngestModule(IngestModuleIngestJobSettings ingestOptions) {
return new PictureAnalysisIngestModule(); return new PictureAnalyzerIngestModule();
} }
@Override @Override

View File

@ -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.modules.pictureanalysis.impls; package org.sleuthkit.autopsy.modules.pictureanalyzer.impls;
import com.drew.imaging.ImageMetadataReader; import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException; import com.drew.imaging.ImageProcessingException;
@ -54,7 +54,7 @@ import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.modules.pictureanalysis.spi.PictureProcessor; import org.sleuthkit.autopsy.modules.pictureanalyzer.spi.PictureProcessor;
/** /**
* Extracts EXIF metadata from JPEG, TIFF, and WAV files. Currently only date, * Extracts EXIF metadata from JPEG, TIFF, and WAV files. Currently only date,

View File

@ -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.modules.pictureanalysis.impls; package org.sleuthkit.autopsy.modules.pictureanalyzer.impls;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -41,7 +41,7 @@ import org.apache.commons.io.FilenameUtils;
import org.openide.modules.InstalledFileLocator; import org.openide.modules.InstalledFileLocator;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.modules.pictureanalysis.spi.PictureProcessor; import org.sleuthkit.autopsy.modules.pictureanalyzer.spi.PictureProcessor;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.ExecUtil; import org.sleuthkit.autopsy.coreutils.ExecUtil;
@ -91,18 +91,19 @@ public class HEICProcessor implements PictureProcessor {
private Path findImageMagick() { private Path findImageMagick() {
final Path windowsLocation = Paths.get(IMAGE_MAGICK_FOLDER, IMAGE_MAGICK_EXE); final Path windowsLocation = Paths.get(IMAGE_MAGICK_FOLDER, IMAGE_MAGICK_EXE);
final Path linuxLocation = Paths.get("usr", "bin", "magick"); final Path macAndLinuxLocation = Paths.get("/usr", "local", "bin", "magick");
final Path macOsLocation = Paths.get("usr", "local", "bin", "magick");
final String osName = PlatformUtil.getOSName().toLowerCase();
if (PlatformUtil.isWindowsOS() && PlatformUtil.is64BitJVM()) { if (PlatformUtil.isWindowsOS() && PlatformUtil.is64BitJVM()) {
final File locatedExec = InstalledFileLocator.getDefault().locate(windowsLocation.toString(), final File locatedExec = InstalledFileLocator.getDefault().locate(
HEICProcessor.class.getPackage().getName(), false); windowsLocation.toString(), HEICProcessor.class.getPackage().getName(), false);
return (locatedExec != null) ? locatedExec.toPath() : null; return (locatedExec != null) ? locatedExec.toPath() : null;
} else if (Files.isExecutable(linuxLocation) && !Files.isDirectory(linuxLocation)) { } else if ((osName.equals("linux") || osName.startsWith("mac")) &&
return linuxLocation; Files.isExecutable(macAndLinuxLocation) &&
} else if (Files.isExecutable(macOsLocation) && !Files.isDirectory(macOsLocation)) { !Files.isDirectory(macAndLinuxLocation)) {
return macOsLocation; return macAndLinuxLocation;
} else { } else {
return null; return null;
} }
@ -158,8 +159,8 @@ public class HEICProcessor implements PictureProcessor {
/** /**
* Copies the HEIC container to disk in order to run ImageMagick. * Copies the HEIC container to disk in order to run ImageMagick.
*/ */
private Path extractToDisk(AbstractFile heicFile) throws IOException { private Path extractToDisk(AbstractFile heicFile) throws IOException, NoCurrentCaseException {
final String tempDir = Case.getCurrentCase().getTempDirectory(); final String tempDir = Case.getCurrentCaseThrows().getTempDirectory();
final String heicFileName = FileUtil.escapeFileName(heicFile.getName()); final String heicFileName = FileUtil.escapeFileName(heicFile.getName());
final Path localDiskCopy = Paths.get(tempDir, heicFileName); final Path localDiskCopy = Paths.get(tempDir, heicFileName);
@ -206,7 +207,7 @@ public class HEICProcessor implements PictureProcessor {
final String glob = String.format("{%1$s.jpg,%1$s-*.jpg}", baseFileName); final String glob = String.format("{%1$s.jpg,%1$s-*.jpg}", baseFileName);
try (DirectoryStream<Path> stream = Files.newDirectoryStream(moduleOutputFolder, glob)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(moduleOutputFolder, glob)) {
final Path caseDirectory = Paths.get(Case.getCurrentCase().getCaseDirectory()); final Path caseDirectory = Paths.get(Case.getCurrentCaseThrows().getCaseDirectory());
for (Path candidate : stream) { for (Path candidate : stream) {
if (context.fileIngestIsCancelled()) { if (context.fileIngestIsCancelled()) {
return; return;
@ -215,7 +216,7 @@ public class HEICProcessor implements PictureProcessor {
final BasicFileAttributes attrs = Files.readAttributes(candidate, BasicFileAttributes.class); final BasicFileAttributes attrs = Files.readAttributes(candidate, BasicFileAttributes.class);
final Path localCasePath = caseDirectory.relativize(candidate); final Path localCasePath = caseDirectory.relativize(candidate);
final DerivedFile jpegFile = Case.getCurrentCase().getSleuthkitCase() final DerivedFile jpegFile = Case.getCurrentCaseThrows().getSleuthkitCase()
.addDerivedFile(candidate.getFileName().toString(), .addDerivedFile(candidate.getFileName().toString(),
localCasePath.toString(), attrs.size(), 0L, localCasePath.toString(), attrs.size(), 0L,
attrs.creationTime().to(TimeUnit.SECONDS), attrs.creationTime().to(TimeUnit.SECONDS),

View File

@ -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.modules.pictureanalysis.spi; package org.sleuthkit.autopsy.modules.pictureanalyzer.spi;
import java.util.Set; import java.util.Set;
import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.autopsy.ingest.IngestJobContext;

View File

@ -9,6 +9,43 @@ The following need to be done at least once. They do not need to be repeated for
-- Linux: % sudo apt-get install testdisk -- Linux: % sudo apt-get install testdisk
-- OS X: % brew install testdisk -- OS X: % brew install testdisk
- (Optional) Install ImageMagick for Apple's High Efficiency Photo (HEIC/HEIF) support.
-- OS X: % brew install imagemagick
-- Linux:
% sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
% sudo apt-get update
% sudo apt-get install build-essential autoconf libtool git-core
% sudo apt-get build-dep imagemagick libmagickcore-dev libde265 libheif
% cd /usr/src/
% sudo git clone https://github.com/strukturag/libde265.git
% sudo git clone https://github.com/strukturag/libheif.git
% cd libde265/
% sudo ./autogen.sh
% sudo ./configure
% sudo make
% sudo make install
% cd /usr/src/libheif/
% sudo ./autogen.sh
% sudo ./configure
% sudo make
% sudo make install
% cd /usr/src/
% sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz
% sudo tar xf ImageMagick.tar.gz
% cd ImageMagick-7*
% sudo ./configure --with-heic=yes
% sudo make
% sudo make install
% sudo ldconfig
- Install the BellSoft Java 8 JRE and JavaFX 8 distribution and set JAVA_HOME. - Install the BellSoft Java 8 JRE and JavaFX 8 distribution and set JAVA_HOME.
* The BellSoft distribution bundles OpenJDK and OpenJFX. Other distributions we have tried either don't * The BellSoft distribution bundles OpenJDK and OpenJFX. Other distributions we have tried either don't
bundle OpenJFX (AdoptOpenJDK) or don't include all necessary binaries (Amazon Corretto). bundle OpenJFX (AdoptOpenJDK) or don't include all necessary binaries (Amazon Corretto).