diff --git a/homebrew/autopsy.rb b/homebrew/autopsy.rb new file mode 100644 index 0000000000..2f74412f36 --- /dev/null +++ b/homebrew/autopsy.rb @@ -0,0 +1,63 @@ +# Documentation: https://docs.brew.sh/Formula-Cookbook +# https://rubydoc.brew.sh/Formula +# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! +class Autopsy < Formula + desc "Autopsy® is a digital forensics platform and graphical interface to The Sleuth Kit® and other digital forensics tools. It can be used by law enforcement, military, and corporate examiners to investigate what happened on a computer. You can even use it to recover photos from your camera's memory card. " + homepage "http://www.sleuthkit.org/autopsy/" + url "https://github.com/sleuthkit/autopsy/archive/refs/tags/autopsy-4.19.3.tar.gz" + # sha256 "67299005603af0cadc98c420ce5088187010b71eabcbb6db7a4e5bce325734c5" + license "Apache-2.0" + + depends_on "postgresql@14" + depends_on "testdisk" + depends_on "sleuthkit" + depends_on "ant" => :build + + def install + ENV.deparallelize + # ----- GET ADDITIONAL DEPENDENCIES ----- + # TODO may be a better way to handle this + system "brew", "tap", "bell-sw/liberica" + system "brew", "install", "--cask", "liberica-jdk8-full" + + # TODO may be a better way to handle this + gstreamer_tmp_path = "#{prefix}/gstreamer-1.0-1.20.3-universal.pkg" + gstreamer_bin_path = File.join(prefix, "gstreamer", "bin") + system "curl", "-k", "-o", gstreamer_tmp_path, "https://gstreamer.freedesktop.org/data/pkg/osx/1.20.3/gstreamer-1.0-1.20.3-universal.pkg" + system "mkdir", "-p", gstreamer_bin_path + system "installer", "-pkg", gstreamer_tmp_path, "-target", gstreamer_bin_path + system "rm", gstreamer_tmp_path + + # ----- BUILD ZIP ----- + autopsy_src_path = `pwd` + java_path = `/usr/libexec/java_home -v 1.8` + + netbeans_plat_ver = `grep "netbeans-plat-version=" "$AUTOPSY_SRC_PATH/nbproject/platform.properties" | cut -d'=' -f2` + autopsy_platform_path = File.join(autopsy_src_path, "netbeans-plat", netbeans_plat_ver) + autopsy_harness_path = File.join(autopsy_platform_path, "harness") + + ENV["JAVA_HOME"] = java_path + ENV["TSK_HOME"]= `brew --prefix sleuthkit` + system "ant", "-Dnbplatform.active.dir=\"#{autopsy_platform_path}\"", "-Dnbplatform.default.harness.dir=\"#{autopsy_harness_path}\"", "build", "build-zip" + + # ----- SETUP EXTRACT DIRECTORY ----- + autopsy_zip = `find #{autopsy_src_path}/dist -maxdepth 1 -name "autopsy-*.*.*.zip"` + system "unzip", autopsy_zip, "-d", File.join(autopsy_src_path, "dist") + autopsy_install_dir = `find #{File.join(autopsy_src_path, "dist")} -maxdepth 1 -type d -name "autopsy-*.*.*"` + + # ----- RUN UNIX SETUP SCRIPT ----- + unix_setup_script = File.join(autopsy_install_dir, "unix_setup.sh") + system "chmod", "u+x", unix_setup_script + + base_sleuthkit_path = `brew --prefix sleuthkit` + ENV["TSK_JAVA_LIB_PATH"] = File.join(base_sleuthkit_path, "share", "java") + system "bash", "-c", "cd \"#{autopsy_install_dir}\" && ./unix_setup.sh -j \"#{java_path}\"" + + # TODO do we need to symlink binary? + # TODO do we need env variables before execution? + end + + test do + system "#{bin}/autopsy", "--help" + end +end diff --git a/snap/gui/autopsy.png b/snap/autopsy.png similarity index 100% rename from snap/gui/autopsy.png rename to snap/autopsy.png diff --git a/snap/gui/autopsy.desktop b/snap/gui/autopsy.desktop deleted file mode 100644 index 24de9544a6..0000000000 --- a/snap/gui/autopsy.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Exec=autopsy -Icon=${SNAP}/meta/gui/autopsy.png \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 08d20bee57..ae82165612 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -7,6 +7,8 @@ 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] +# improves startup performance +compression: lzo # Java package repo to use with snapcraft package-repositories: @@ -24,15 +26,8 @@ layout: symlink: $SNAP/usr/bin/photorec /usr/local/bin: bind: $SNAP/usr/local/bin - # /usr/local/lib: - # bind: $SNAP/usr/local/lib - # $HOME/.autopsy: - # bind: $HOME/$SNAP/.autopsy plugs: - # personal-files-autopsy: - # interface: personal-files - # read: [$HOME/.autopsy] system-files-autopsy: interface: system-files read: [/dev] @@ -54,9 +49,7 @@ apps: - avahi-observe - block-devices - cifs-mount - # - custom-device - daemon-notify - # - dbus - desktop - desktop-launch - desktop-legacy @@ -66,25 +59,18 @@ apps: - hardware-observe - home - kernel-crypto-api - #- locale-control - log-observe - #- mount-control - mount-observe - network - # - network-bind - # - network-manager + - network-manager - network-observe - network-setup-observe - network-status - # - online-accounts-service - opengl - optical-drive - # - personal-files-autopsy - # - posix-mq - pulseaudio - raw-input - raw-usb - # - raw-volume - removable-media - sd-control - system-files-autopsy @@ -187,11 +173,16 @@ parts: chmod +x $UNIX_SETUP_SCRIPT $UNIX_SETUP_SCRIPT chmod 755 "$AUTOPSY_LOCATION/bin/autopsy" - # TODO is this necessary? - find "$AUTOPSY_LOCATION/autopsy/markmckinnon" -name "Export*" -o -name "parse*" | xargs -I{} chmod a+x {} - # TODO is this necessary? - chmod -R a+x "$AUTOPSY_LOCATION/autopsy/solr/bin" + + # ----- INSTALL DESKTOP SHORTCUT ----- + AUTOPSY_DESKTOP_PATH="$SNAPCRAFT_PART_INSTALL/usr/share/applications/" + mkdir -p $AUTOPSY_DESKTOP_PATH + sed -i 's|Icon=autopsy|Icon=${SNAP}/usr/share/pixmaps/autopsy.png|g' ${AUTOPSY_DESKTOP_PATH}/autopsy.desktop + sed -i 's|Exec=${SNAP}/autopsy/bin/autopsy|Exec=autopsy|g' ${AUTOPSY_DESKTOP_PATH}/autopsy.desktop + AUTOPSY_ICON_BASE_PATH="usr/share/pixmaps/" + mkdir -p "$SNAPCRAFT_PART_INSTALL/$AUTOPSY_ICON_BASE_PATH" + cp ./snap/autopsy.png "$SNAPCRAFT_PART_INSTALL/$AUTOPSY_ICON_BASE_PATH" # include this line to print all set variables # TODO remove after debugging - sed -i '129 i set -o posix ; echo $(set) >&2' "$AUTOPSY_LOCATION/platform/lib/nbexec" \ No newline at end of file + sed -i '129 i set -o posix ; echo $(set) >&2 ; ls -l "${jdkhome}/bin/java"' "$AUTOPSY_LOCATION/platform/lib/nbexec" \ No newline at end of file