Skip to content
Snippets Groups Projects
Commit 610a4c71 authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

Revert "remove snap for other getting ready items"

This reverts commit 206f8579.
parent 206f8579
No related branches found
No related tags found
No related merge requests found
## Installing Snap
An Autopsy [snap package](https://snapcraft.io/) file can be installed by running `sudo snap install autopsy.snap --classic --dangerous`. The `--classic` flag gives the snap package access to necessary system resources (see [confinement](https://snapcraft.io/docs/snap-confinement) for more information) and `--dangerous` needs to be specified because the snap package isn't signed (see [install modes](https://snapcraft.io/docs/install-modes#heading--dangerous) for more information).
## Generating The Snap Package
A [snap package](https://snapcraft.io/) of Autopsy can be generated using the [`snapcraft.yml`](./snapcraft.yaml) file. You will need [snapcraft](https://snapcraft.io/) on your system and [lxd](https://snapcraft.io/lxd) works well for virtualization while building the snap package. Since snapcraft needs virtualization to create the snap package, your computer's hardware will need to support virtualization and any relevant settings will need to be enabled. From testing as of November 2022, VirtualBox and WSL are not good build environments. Once the development environment has been set up, a snap package can be built with this command: `snapcraft --use-lxd --debug` run from this directory.
## Updating Versions for Snap
The version of Autopsy in the [`snapcraft.yml`](./snapcraft.yaml) can be updated by calling [`version_update.py`](./version_update/version_update.py) with a command like `python version_update.py -s sleuthkit_release_tag -a autopsy_release_tag -v snapcraft_version_name`. You will likely need to install the python dependencies in the [requirements.txt](./version_update/requirements.txt) with a command like: `pip install -r requirements.txt`.
The version of Autopsy can be updated manually by modifying fields relating to git repositories and commits in [`snapcraft.yml`](./snapcraft.yaml) under `parts.autopsy` and `parts.sleuthkit`. Specifically `source`, `source-branch`, and `source-tag`. More information can be found [here](https://snapcraft.io/docs/snapcraft-yaml-reference).
*There is more information in Jira 8425.*
[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
Type=Application
Categories=Forensics;DFIR
Keywords=autopsy;sleuth;kit;dfir;forensics
snap/gui/autopsy.png

47.4 KiB

name: autopsy
# core22 brings along linting for share object library paths as well as improvements to get java gstreamer working
base: core20
version: 4.20.0
summary: A graphical interface to The Sleuth Kit and other digital forensics tools. # 79 char long summary
description: Autopsy is a graphical interface to The Sleuth Kit and other open source
digital forensics tools.
grade: stable # must be 'stable' to release into candidate/stable channels
# TODO look into turning back to strict for easier store inclusion but more limited usage
confinement: classic # use 'strict' once you have the right plugs and slots
architectures: [amd64]
compression: lzo
icon: snap/gui/autopsy.png
plugs:
system-files-autopsy:
interface: system-files
read: [/dev]
apps:
autopsy:
environment:
jdkhome: $SNAP/usr/lib/jvm/java-17-openjdk-amd64
# provide means for java gstreamer to find gstreamer libs
jreflags: $jreflags "-Djna.library.path=$SNAP/usr/lib/x86_64-linux-gnu"
LD_LIBRARY_PATH: $SNAP/usr/local/lib:$LD_LIBRARY_PATH
# make sure path is set up to ensure things like photorec are found
PATH: $SNAP/usr/bin:$SNAP/usr/local/bin:$PATH
# gstreamer scans for plugins (i.e. app integration plugins). this tells gstreamer where to look for the scanner and libraries
GST_PLUGIN_SYSTEM_PATH: $SNAP/usr/lib/x86_64-linux-gnu/gstreamer-1.0
GST_PLUGIN_SCANNER: $SNAP/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner
SOLR_LOGS_DIR: $HOME/.autopsy/dev/solr/logs
SOLR_PID_DIR: $HOME/.autopsy/dev/solr/logs
command: autopsy/bin/autopsy
common-id: org.sleuthkit.autopsy
plugs:
# taken from https://snapcraft.io/docs/supported-interfaces
- audio-playback
- avahi-observe
- block-devices
- cifs-mount
- daemon-notify
- desktop
- desktop-launch
- desktop-legacy
- dm-crypt
- firewall-control
- fuse-support
- hardware-observe
- home
- kernel-crypto-api
- log-observe
- mount-observe
- network
- network-manager
- network-observe
- network-setup-observe
- network-status
- opengl
- optical-drive
- pulseaudio
- raw-input
- raw-usb
- removable-media
- sd-control
- system-files-autopsy
- system-observe
- system-trace
- udisks2
- unity7
- unity8
- wayland
- x11
parts:
sleuthkit:
plugin: autotools
source: https://github.com/sleuthkit/sleuthkit.git
source-branch: develop
#source-tag: sleuthkit-4.12.0
build-environment: [JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64]
build-packages:
- build-essential
- autoconf
- libtool
- automake
- zip
- openjdk-17-jdk
- openjdk-17-jre
- ant
- ant-contrib
- ant-optional
- libpq-dev
- testdisk
- libafflib-dev
- libewf-dev
- libvhdi-dev
- libvmdk-dev
stage-packages:
- build-essential
- libpq-dev
- testdisk
- libafflib-dev
- libewf-dev
- libvhdi-dev
- libvmdk-dev
autopsy:
after: [sleuthkit]
build-packages:
- zip
- unzip
- openjdk-17-jdk
- openjdk-17-jre
- ant
- doxygen
stage-packages:
- libde265-dev
- libheif-dev
- libpq-dev
- testdisk
- libgstreamer1.0-0
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad
- gstreamer1.0-plugins-ugly
- gstreamer1.0-libav
- gstreamer1.0-tools
- gstreamer1.0-x
- gstreamer1.0-alsa
- gstreamer1.0-gl
- gstreamer1.0-gtk3
- gstreamer1.0-qt5
- gstreamer1.0-pulseaudio
- openjdk-17-jdk
- openjdk-17-jre
- perl
plugin: nil
# source: https://github.com/sleuthkit/autopsy.git
source: https://github.com/gdicristofaro/autopsy.git
# source-branch: develop
source-branch: 8425-snap
build-environment:
- JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
- TSK_JAVA_LIB_PATH: $SNAPCRAFT_STAGE/usr/local/share/java
override-build: |
# ----- BUILD ZIP -----
AUTOPSY_SRC_PATH=$(pwd)
NETBEANS_PLAT_VER=$(grep "netbeans-plat-version=" "$AUTOPSY_SRC_PATH/nbproject/platform.properties" | cut -d'=' -f2)
AUTOPSY_PLATFORM_PATH="$AUTOPSY_SRC_PATH/netbeans-plat/$NETBEANS_PLAT_VER"
AUTOPSY_HARNESS_PATH="$AUTOPSY_PLATFORM_PATH/harness"
export TSK_HOME="$HOME/parts/sleuthkit/build"
ant -Dnbplatform.active.dir="$AUTOPSY_PLATFORM_PATH" -Dnbplatform.default.harness.dir="$AUTOPSY_HARNESS_PATH" build build-zip
# ----- SETUP EXTRACT DIRECTORY -----
AUTOPSY_LOCATION="$SNAPCRAFT_PART_INSTALL/autopsy"
mkdir -p $AUTOPSY_LOCATION
AUTOPSY_ZIP=$(find ./dist -maxdepth 1 -name "autopsy-*.*.*.zip")
AUTOPSY_ZIP_TMP_LOC=./dist/autopsy_tmp_zip_loc
mkdir -p $AUTOPSY_ZIP_TMP_LOC
unzip $AUTOPSY_ZIP -d $AUTOPSY_ZIP_TMP_LOC
AUTOPSY_EXTRACTED_TMP_LOC=$(find $AUTOPSY_ZIP_TMP_LOC -maxdepth 1 -name "autopsy-*.*.*")
cp -r $AUTOPSY_EXTRACTED_TMP_LOC/* $AUTOPSY_LOCATION
# ----- RUN UNIX SETUP SCRIPT -----
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"
# include this line to print all set variables
# sed -i '129 i set -o posix ; echo $(set) >&2 ; ls -l "${jdkhome}/bin/java"' "$AUTOPSY_LOCATION/platform/lib/nbexec"
/.idea
/venv
\ No newline at end of file
argparse==1.4.0
ruamel.yaml==0.17.21
\ No newline at end of file
import sys
import argparse
import ruamel.yaml
from typing import Union
from os.path import join, dirname, abspath, realpath
SNAPCRAFT_YAML_PATH = join(dirname(dirname(abspath(realpath(__file__)))), 'snapcraft.yaml')
SLEUTHKIT_REPO = 'https://github.com/sleuthkit/sleuthkit.git'
AUTOPSY_REPO = 'https://github.com/sleuthkit/autopsy.git'
def update_versions(sleuthkit_version_tag: str,
autopsy_version_tag: str,
snapcraft_version: str,
snapcraft_yaml_path: Union[str, None],
sleuthkit_repo: Union[str, None],
autopsy_repo: Union[str, None]):
snapcraft_yaml_path = snapcraft_yaml_path if snapcraft_yaml_path is not None and len(
snapcraft_yaml_path.strip()) > 0 else SNAPCRAFT_YAML_PATH
sleuthkit_repo = sleuthkit_repo if sleuthkit_repo is not None and len(
sleuthkit_repo.strip()) > 0 else SLEUTHKIT_REPO
autopsy_repo = autopsy_repo if autopsy_repo is not None and len(
autopsy_repo.strip()) > 0 else AUTOPSY_REPO
yaml = ruamel.yaml.YAML()
with open(snapcraft_yaml_path) as snapcraft_file:
yaml_dict = yaml.load(snapcraft_file)
yaml_dict['version'] = snapcraft_version
yaml_dict['parts']['sleuthkit']['source'] = sleuthkit_repo
yaml_dict['parts']['sleuthkit']['source-tag'] = sleuthkit_version_tag
yaml_dict['parts']['sleuthkit'].pop('source-branch', None)
yaml_dict['parts']['autopsy']['source'] = autopsy_repo
yaml_dict['parts']['autopsy']['source-tag'] = autopsy_version_tag
yaml_dict['parts']['autopsy'].pop('source-branch', None)
with open(snapcraft_yaml_path, "w") as snapcraft_file:
yaml.dump(yaml_dict, snapcraft_file)
def main():
parser = argparse.ArgumentParser(
description="Updates snapcraft.yml file with current versions of autopsy and sleuthkit",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-s', '--sleuthkit_tag', required=True, dest='sleuthkit_version_tag', type=str,
help='The git tag to use for sleuthkit.')
parser.add_argument('-a', '--autopsy_tag', required=True, dest='autopsy_version_tag', type=str,
help='The git tag to use for autopsy.')
parser.add_argument('-v', '--version', required=True, dest='snapcraft_version', type=str,
help='Version for snapcraft metadata.')
parser.add_argument('-p', '--snapcraft_path', dest='snapcraft_yaml_path', type=str, default=SNAPCRAFT_YAML_PATH,
help='Path to snapcraft.yaml.')
parser.add_argument('--sleuthkit_repo', dest='sleuthkit_repo', type=str, default=SLEUTHKIT_REPO,
help='Location of sleuthkit repo.')
parser.add_argument('--autopsy_repo', dest='autopsy_repo', type=str, default=AUTOPSY_REPO,
help='Location of sleuthkit repo.')
args = parser.parse_args()
update_versions(
sleuthkit_version_tag=args.sleuthkit_version_tag,
autopsy_version_tag=args.autopsy_version_tag,
snapcraft_version=args.snapcraft_version,
snapcraft_yaml_path=args.snapcraft_yaml_path,
sleuthkit_repo=args.sleuthkit_repo,
autopsy_repo=args.autopsy_repo
)
if __name__ == '__main__':
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment