diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7ddee35608..8fceb75791 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,9 +1,10 @@ name: autopsy # core22 brings along linting for share object library paths as well as improvements to get java gstreamer working base: core22 -version: '4.19.3' +version: 4.19.3 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. +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 @@ -13,12 +14,12 @@ icon: snap/gui/autopsy.png # Java package repo to use with snapcraft package-repositories: - - type: apt - formats: [deb] - components: [main] - suites: [stable] - key-id: 99A5C88E3C5B1FA8B05A19D332E9750179FCEA62 - url: https://apt.bell-sw.com/ +- type: apt + formats: [deb] + components: [main] + suites: [stable] + key-id: 99A5C88E3C5B1FA8B05A19D332E9750179FCEA62 + url: https://apt.bell-sw.com/ plugs: system-files-autopsy: @@ -27,10 +28,10 @@ plugs: apps: autopsy: - environment: + environment: jdkhome: $SNAP/usr/lib/jvm/bellsoft-java8-full-amd64 # provide means for java gstreamer to find gstreamer libs - jreflags: "$jreflags \"-Djna.library.path=$SNAP/usr/lib/x86_64-linux-gnu\"" + 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 @@ -43,112 +44,107 @@ apps: 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 + - 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.11.1 build-environment: [JAVA_HOME: /usr/lib/jvm/bellsoft-java8-full-amd64] build-packages: - - build-essential - - autoconf - - libtool - - automake - - zip - - ant - - ant-contrib - - ant-optional - - bellsoft-java8-full - - libpq-dev - - testdisk - - libafflib-dev - - libewf-dev - - libvhdi-dev - - libvmdk-dev + - build-essential + - autoconf + - libtool + - automake + - zip + - ant + - ant-contrib + - ant-optional + - bellsoft-java8-full + - 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 + - build-essential + - libpq-dev + - testdisk + - libafflib-dev + - libewf-dev + - libvhdi-dev + - libvmdk-dev + source-tag: sleuthkit-4.11.1 autopsy: after: [sleuthkit] build-packages: - - zip - - unzip - - ant - - bellsoft-java8-full - - doxygen + - zip + - unzip + - ant + - bellsoft-java8-full + - 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 - - bellsoft-java8-full - - perl + - 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 + - bellsoft-java8-full + - perl plugin: nil - source: https://github.com/gdicristofaro/autopsy.git - source-branch: 8425_linuxMacBuild - # source: https://github.com/sleuthkit/autopsy.git - # source-branch: develop - # source-tag: autopsy-4.19.3 - build-environment: - - JAVA_HOME: /usr/lib/jvm/bellsoft-java8-full-amd64 - - TSK_JAVA_LIB_PATH: $SNAPCRAFT_STAGE/usr/local/share/java - override-build: | + source: https://github.com/sleuthkit/autopsy.git + build-environment: + - JAVA_HOME: /usr/lib/jvm/bellsoft-java8-full-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) @@ -176,4 +172,5 @@ parts: 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" \ 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" + source-tag: autopsy-4.19.3 diff --git a/snap/version_update/.gitignore b/snap/version_update/.gitignore new file mode 100644 index 0000000000..f2d51c2b11 --- /dev/null +++ b/snap/version_update/.gitignore @@ -0,0 +1,2 @@ +/.idea +/venv \ No newline at end of file diff --git a/snap/version_update/requirements.txt b/snap/version_update/requirements.txt new file mode 100644 index 0000000000..c85df6330a --- /dev/null +++ b/snap/version_update/requirements.txt @@ -0,0 +1,3 @@ +argparse==1.4.0 +#PyYAML==6.0 +ruamel.yaml==0.17.21 \ No newline at end of file diff --git a/snap/version_update/snap_version_update.py b/snap/version_update/snap_version_update.py new file mode 100644 index 0000000000..6c16329109 --- /dev/null +++ b/snap/version_update/snap_version_update.py @@ -0,0 +1,75 @@ +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() -> int: + 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__': + sys.exit(main())