Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/crates/aienos-artifact-tool/fixtures/p2_5/pack.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / crates / aienos-artifact-tool / fixtures / p2_5 / pack.sh` 45 lines ยท 1902 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # Pack and sign the P2-5 probes with the TEST ONLY SEED-0B identity into 3 # OUT_DIR as P25EXEC.AIEN, P25WX.AIEN, P25SPIN.AIEN, and P25TAMP.AIEN 4 # (P25EXEC with one payload byte flipped after signing). Also writes 5 # OUT_DIR/ids.txt: "NAME ARTIFACT_ID" per signed probe. 6 # 7 # TOOL must be a debug aienos-artifact-tool built with 8 # --features seed0b-test-signing (release builds refuse that feature). 9 set -euo pipefail 10 11 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 12 tool="${1:?usage: pack.sh TOOL OUT_DIR}" 13 out="${2:?usage: pack.sh TOOL OUT_DIR}" 14 mkdir -p "${out}" 15 : >"${out}/ids.txt" 16 17 pack_one() { # probe, output name 18 local probe="$1" name="$2" 19 "${tool}" pack "${here}/${probe}/manifest.json" "${here}/${probe}/code.bin" \ 20 "${here}/${probe}/data.bin" "${out}/${probe}.unsigned.aien" >/dev/null 21 "${tool}" sign "${out}/${probe}.unsigned.aien" "${out}/${name}" >/dev/null 22 rm -f "${out}/${probe}.unsigned.aien" 23 "${tool}" verify "${out}/${name}" >/dev/null 24 echo "${name} $("${tool}" id "${out}/${name}")" >>"${out}/ids.txt" 25 } 26 27 pack_one p25exec P25EXEC.AIEN 28 pack_one p25wx P25WX.AIEN 29 pack_one p25spin P25SPIN.AIEN 30 31 # Tamper: flip the low bit of the first payload byte (first code byte) of 32 # the signed P25EXEC. Its ArtifactId changes, so the signature must fail. 33 cp "${out}/P25EXEC.AIEN" "${out}/P25TAMP.AIEN" 34 payload_offset=$(od -An -tu4 -j56 -N4 "${out}/P25TAMP.AIEN" | tr -d ' ') 35 byte=$(od -An -tu1 -j"${payload_offset}" -N1 "${out}/P25TAMP.AIEN" | tr -d ' ') 36 printf "$(printf '\\%03o' $((byte ^ 1)))" | 37 dd of="${out}/P25TAMP.AIEN" bs=1 seek="${payload_offset}" conv=notrunc status=none 38 if "${tool}" verify "${out}/P25TAMP.AIEN" >/dev/null 2>&1; then 39 echo "FAIL tampered probe still verifies" >&2 40 exit 1 41 fi 42 if cmp -s "${out}/P25EXEC.AIEN" "${out}/P25TAMP.AIEN"; then 43 echo "FAIL tampering did not change the file" >&2 44 exit 1 45 fi