From 61e0f021b72358d40ea56e76c47d96a99f9b521e Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Tue, 18 Oct 2022 11:14:41 -0400 Subject: [PATCH] updates for photorec --- .../PhotoRecCarverFileIngestModule.java | 21 +++++++------------ snap/gui/autopsy.desktop | 9 +++++++- snap/snapcraft.yaml | 19 ++++------------- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index d94c9eae90..6e27a94c6a 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -632,23 +632,18 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { */ public static File locateExecutable() throws IngestModule.IngestModuleException { File exeFile; - Path execName; - String photorec_linux_directory = "/usr/bin"; if (PlatformUtil.isWindowsOS()) { - execName = Paths.get(PHOTOREC_DIRECTORY, PHOTOREC_SUBDIRECTORY, PHOTOREC_EXECUTABLE); + Path execName = Paths.get(PHOTOREC_DIRECTORY, PHOTOREC_SUBDIRECTORY, PHOTOREC_EXECUTABLE); exeFile = InstalledFileLocator.getDefault().locate(execName.toString(), PhotoRecCarverFileIngestModule.class.getPackage().getName(), false); } else { - File usrBin = new File("/usr/bin/photorec"); - File usrLocalBin = new File("/usr/local/bin/photorec"); - if (usrBin.canExecute() && usrBin.exists() && !usrBin.isDirectory()) { - photorec_linux_directory = "/usr/bin"; - } else if (usrLocalBin.canExecute() && usrLocalBin.exists() && !usrLocalBin.isDirectory()) { - photorec_linux_directory = "/usr/local/bin"; - } else { - throw new IngestModule.IngestModuleException("Photorec not found"); + exeFile = null; + for (String dirName: System.getenv("PATH").split(File.pathSeparator)) { + File testExe = new File(dirName, PHOTOREC_LINUX_EXECUTABLE); + if (testExe.exists()) { + exeFile = testExe; + break; + } } - execName = Paths.get(photorec_linux_directory, PHOTOREC_LINUX_EXECUTABLE); - exeFile = new File(execName.toString()); } if (null == exeFile) { diff --git a/snap/gui/autopsy.desktop b/snap/gui/autopsy.desktop index 24de9544a6..0af2c78126 100644 --- a/snap/gui/autopsy.desktop +++ b/snap/gui/autopsy.desktop @@ -1,2 +1,9 @@ +[Desktop Entry] +Name=Autopsy +Comment=A graphical interface to The Sleuth Kit and other digital forensics tools. +GenericName=DFIR Tool. Exec=autopsy -Icon=${SNAP}/meta/gui/autopsy.png \ No newline at end of file +Icon=${SNAP}/meta/gui/autopsy.png +Type=Application +Categories=Forensics;DFIR +Keywords=autopsy;sleuth;kit;dfir;forensics diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ff3b710015..6404551579 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -7,7 +7,6 @@ grade: stable # must be 'stable' to release into candidate/stable channels # TODO look into turning back to strict for store inclusion confinement: classic # use 'strict' once you have the right plugs and slots architectures: [amd64, arm64] -# TODO improves startup performance compression: lzo icon: snap/gui/autopsy.png @@ -20,14 +19,6 @@ package-repositories: key-id: 99A5C88E3C5B1FA8B05A19D332E9750179FCEA62 url: https://apt.bell-sw.com/ -layout: - /usr/bin/photorec: - symlink: $SNAP/usr/bin/photorec - /usr/local/bin: - bind: $SNAP/usr/local/bin - # /usr/lib/jvm/bellsoft-java8-full-amd64: - # symlink: $SNAP/usr/lib/jvm/bellsoft-java8-full-amd64 - plugs: system-files-autopsy: interface: system-files @@ -44,7 +35,6 @@ apps: command: autopsy/bin/autopsy common-id: org.sleuthkit.autopsy plugs: - # TODO verify these: # taken from https://snapcraft.io/docs/supported-interfaces - audio-playback - avahi-observe @@ -108,8 +98,6 @@ parts: - libvmdk-dev stage-packages: - build-essential - - autoconf - - libtool - libpq-dev - testdisk - libafflib-dev @@ -125,9 +113,6 @@ parts: - bellsoft-java8-full - doxygen stage-packages: - - build-essential - - autoconf - - libtool - libde265-dev - libheif-dev - libpq-dev @@ -179,7 +164,11 @@ parts: UNIX_SETUP_SCRIPT="$AUTOPSY_LOCATION/unix_setup.sh" chmod +x $UNIX_SETUP_SCRIPT $UNIX_SETUP_SCRIPT + + # snaps run applications with different permissions. This ensures applications can run. chmod 755 "$AUTOPSY_LOCATION/bin/autopsy" + find "$AUTOPSY_LOCATION/autopsy/markmckinnon" -name "Export*" -o -name "parse*" | xargs -I{} chmod a+x {} + chmod -R a+x "$AUTOPSY_LOCATION/autopsy/solr/bin" # # ----- INSTALL DESKTOP SHORTCUT ----- # AUTOPSY_DESKTOP_PATH="$SNAPCRAFT_PART_INSTALL/usr/share/applications/"