From 942d64289845fac2ab0f727e0dc38bebadfecbdb Mon Sep 17 00:00:00 2001 From: Romain Gayon Date: Mon, 13 Mar 2023 16:37:41 +0100 Subject: [PATCH 1/5] Update manager.py --- auto_forensicate/stamp/manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/auto_forensicate/stamp/manager.py b/auto_forensicate/stamp/manager.py index 6bf7c64..029481b 100644 --- a/auto_forensicate/stamp/manager.py +++ b/auto_forensicate/stamp/manager.py @@ -39,10 +39,14 @@ def BasePathElements(self, stamp): return remote_path_elems - def GetStamp(self): + def GetStamp(self, graphical=True): """Generates the "stamp" metadata to upload. This contains information such as when the script is run, and the host's ID. + + Args: + graphical(bool): Set to False if requesting the Stamp in an non-graphical + environment. Returns: BaseStamp: the content of the stamp. From d7bed585d76836c7eaf2eb0935f39c811f415e13 Mon Sep 17 00:00:00 2001 From: Romain Gayon Date: Fri, 9 Jun 2023 15:12:44 +0200 Subject: [PATCH 2/5] init --- tools/remaster.sh | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/tools/remaster.sh b/tools/remaster.sh index c73272e..2074f06 100644 --- a/tools/remaster.sh +++ b/tools/remaster.sh @@ -25,9 +25,8 @@ # You should end up with a file called gift-image-$(date +%Y%m%d).img, unless # you specify the destination with --image # -# It requires the following packages, on ubuntu: -# gdisk genisoimage grub-efi-amd64-bin syslinux syslinux-utils -# initramfs-tools-core +# It requires the following packages, on ubuntu 22.04: +# gdisk xorriso grub-efi-amd64-bin initramfs-tools-core # # gdisk and grub-efi-amd64-bin are used for the EFI booting part. # @@ -387,7 +386,19 @@ function pack_iso { local -r source_iso_dir=$1 local -r target_iso_file=$2 + readonly mbr="${FLAGS_REMASTERED_ISO}.mbr" + readonly efi="${FLAGS_REMASTERED_ISO}.efi" + + # Extract the MBR template + dd if="$orig" bs=1 count=446 of="$mbr" + + # Extract EFI partition image + readonly skip=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $2}') + readonly size=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $4}') + dd if="$orig" bs=512 skip="$skip" count="$size" of="$efi" + msg "Packing the new ISO from ${source_iso_dir} to ${target_iso_file}" + sudo genisoimage -o "${target_iso_file}" \ -b "isolinux/isolinux.bin" \ -c "isolinux/boot.cat" \ @@ -397,7 +408,22 @@ function pack_iso { -x "${source_iso_dir}"/casper/manifest.diff \ -joliet-long \ "${source_iso_dir}" - sudo isohybrid "${target_iso_file}" + sudo xorriso -as mkisofs \ + -r -V "GIFTSTICK-${TODAY}" -J -joliet-long -l \ + -iso-level 2 \ + -partition_offset 15 \ + --grub1-mbr "$mbr" \ + --mbr-force-bootable \ + -append_partition 1 0xEF "$efi" \ + -appended_part_as_gpt \ + -c /boot.catalog \ + -b /boot/grub/i385-pc/eltorito.img \ + -no-emul-boot -boot-load-size 3 -boot-info-table --grub2-boot-info \ + -eltorito-alt-boot \ + -e '--interval:appended_partition_1:all::' \ + -no-emul-boot \ + -o "${target_iso_file}" \ + "${source_iso_dir}" } # Unpack a LiveCD iso file to a directory. @@ -757,11 +783,9 @@ function main { # checking for package instalation status. set +e check_packages gdisk - check_packages genisoimage + check_packages xorriso check_packages grub-efi-amd64-bin check_packages squashfs-tools - check_packages syslinux - check_packages syslinux-utils set -e parse_arguments "$@" From 1dda4dbfa2ecc1c87c51c33ff9cf5c15144eb7e6 Mon Sep 17 00:00:00 2001 From: Romain Gayon Date: Fri, 9 Jun 2023 16:03:51 +0200 Subject: [PATCH 3/5] fix stuff --- tools/remaster.sh | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/tools/remaster.sh b/tools/remaster.sh index 2074f06..78a3731 100644 --- a/tools/remaster.sh +++ b/tools/remaster.sh @@ -386,11 +386,11 @@ function pack_iso { local -r source_iso_dir=$1 local -r target_iso_file=$2 - readonly mbr="${FLAGS_REMASTERED_ISO}.mbr" - readonly efi="${FLAGS_REMASTERED_ISO}.efi" + readonly mbr="${FLAGS_SOURCE_ISO}.mbr" + readonly efi="${FLAGS_SOURCE_ISO}.efi" # Extract the MBR template - dd if="$orig" bs=1 count=446 of="$mbr" + dd if="$FLAGS_SOURCE_ISO" bs=1 count=446 of="$mbr" # Extract EFI partition image readonly skip=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $2}') @@ -399,28 +399,19 @@ function pack_iso { msg "Packing the new ISO from ${source_iso_dir} to ${target_iso_file}" - sudo genisoimage -o "${target_iso_file}" \ - -b "isolinux/isolinux.bin" \ - -c "isolinux/boot.cat" \ - -p "GiftStick" \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -V "GIFTSTICK-${TODAY}" -cache-inodes -r -J -l \ - -x "${source_iso_dir}"/casper/manifest.diff \ - -joliet-long \ - "${source_iso_dir}" sudo xorriso -as mkisofs \ -r -V "GIFTSTICK-${TODAY}" -J -joliet-long -l \ - -iso-level 2 \ - -partition_offset 15 \ - --grub1-mbr "$mbr" \ + -iso-level 3 \ + -partition_offset 16 \ + --grub2-mbr "$mbr" \ --mbr-force-bootable \ - -append_partition 1 0xEF "$efi" \ + -append_partition 2 0xEF "$efi" \ -appended_part_as_gpt \ -c /boot.catalog \ - -b /boot/grub/i385-pc/eltorito.img \ - -no-emul-boot -boot-load-size 3 -boot-info-table --grub2-boot-info \ + -b /boot/grub/i386-pc/eltorito.img \ + -no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \ -eltorito-alt-boot \ - -e '--interval:appended_partition_1:all::' \ + -e '--interval:appended_partition_2:all::' \ -no-emul-boot \ -o "${target_iso_file}" \ "${source_iso_dir}" From 2b450f5af48142967daa97969c8d57ede18e5cb5 Mon Sep 17 00:00:00 2001 From: Romain Gayon Date: Fri, 9 Jun 2023 16:27:16 +0200 Subject: [PATCH 4/5] fix2 --- tools/remaster.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/remaster.sh b/tools/remaster.sh index 78a3731..3fe6b96 100644 --- a/tools/remaster.sh +++ b/tools/remaster.sh @@ -395,7 +395,7 @@ function pack_iso { # Extract EFI partition image readonly skip=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $2}') readonly size=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $4}') - dd if="$orig" bs=512 skip="$skip" count="$size" of="$efi" + dd if="$FLAGS_SOURCE_ISO" bs=512 skip="$skip" count="$size" of="$efi" msg "Packing the new ISO from ${source_iso_dir} to ${target_iso_file}" From ddd62729733d35e8797e6d3e2a21b37fccbc9b32 Mon Sep 17 00:00:00 2001 From: Romain Gayon Date: Fri, 9 Jun 2023 16:50:56 +0200 Subject: [PATCH 5/5] fix3 --- tools/remaster.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/remaster.sh b/tools/remaster.sh index 3fe6b96..b930f9d 100644 --- a/tools/remaster.sh +++ b/tools/remaster.sh @@ -393,8 +393,8 @@ function pack_iso { dd if="$FLAGS_SOURCE_ISO" bs=1 count=446 of="$mbr" # Extract EFI partition image - readonly skip=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $2}') - readonly size=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $4}') + readonly skip=$(/sbin/fdisk -l "$FLAGS_SOURCE_ISO" | fgrep '.iso2 ' | awk '{print $2}') + readonly size=$(/sbin/fdisk -l "$FLAGS_SOURCE_ISO" | fgrep '.iso2 ' | awk '{print $4}') dd if="$FLAGS_SOURCE_ISO" bs=512 skip="$skip" count="$size" of="$efi" msg "Packing the new ISO from ${source_iso_dir} to ${target_iso_file}"