#!/bin/bash # # Quick and dirty extracter to get the EC image out of the iso file # Copyright (C) 2016 Hamish Coleman # # TODO: # - a tool that is portable to Windows # - should output dependancy information INFOFILE="$1" if [ ! -r "$INFOFILE" ]; then echo Need file with source and offset info exit 1 fi shift OUT="$1" if [ -z "$OUT" ]; then echo Need output filename exit 1 fi read SOURCE OFFSET LENGTH <"$INFOFILE" # assume that output filename is blahdyblah.img.orig OUT1=$(basename "$OUT" .orig).enc.orig set -x dd if=$SOURCE bs=$[$OFFSET] skip=1 | dd bs=$[$LENGTH] count=1 of="$OUT1" mec-tools/mec_encrypt -d "$OUT1" >"$OUT"