#!/bin/bash here=$(dirname "$0") test -n "$here" -a -d "$here" || exit cd $here if ! which osslsigncode > /dev/null 2>&1; then echo "Please install osslsigncode" exit fi # exit if command fails set -e mkdir -p stripped >/dev/null 2>&1 cd signed echo "Found $(ls *.exe | wc -w) files to verify." for signed in $(ls *.exe); do mine="../dist/$signed" out="../stripped/$signed" size=$( wc -c < $mine ) # Step 1: Remove PE signature from signed binary osslsigncode remove-signature -in $signed -out $out > /dev/null 2>&1 # Step 2: Remove checksum and padding from signed binary python3 < 0: assert binary[-n:] == bytearray(n) binary = binary[:size] with open(pe_file, "wb") as f: f.write(binary) EOF chmod +x $out if [ ! $(diff $out $mine) ]; then echo "Success: $signed" #gpg --sign --armor --detach $signed else echo "Failure: $signed" fi done