Scan folder of software for hash values and Developer ID and publish csv

This script:

An Apple script to check the 256 hash value, 512 hash value, and developer id, from a macintosh software folder named Ed_Software filled with software on the users desktop full of downloads and extract these values to a labeled and delimited csv file in the same folder

do shell script "
# Change the folder name accordingly, these looks to a folder named Eds_Software on users desktop
cd ~/Desktop/Ed_Software;

echo 'Filename,SHA256,SHA512,DeveloperID' > hash_values.csv;

for file in *;
do
  if [ -f \"$file\" ]; then
    sha256=$(shasum -a 256 \"$file\" | awk '{print $1}');
    sha512=$(shasum -a 512 \"$file\" | awk '{print $1}');
    
    codesign_output=$(codesign -dv --verbose=4 \"$file\" 2>&1);
    developer_id=$(echo \"$codesign_output\" | grep 'Authority=Developer ID Application:' | awk -F': ' '{print $2}');
    
    if [ -z \"$developer_id\" ]; then
      developer_id='N/A';
    fi;
    
    echo \"$file,$sha256,$sha512,$developer_id\" >> hash_values.csv;
  fi;
done;
"

Link:
https://github.com/patent-ed/export_hash_to_csv

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *