Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save cloudscape-germany/37fdf48d6926f1d5073e5262329e6f4a to your computer and use it in GitHub Desktop.

Select an option

Save cloudscape-germany/37fdf48d6926f1d5073e5262329e6f4a to your computer and use it in GitHub Desktop.
Bash SRI Checker for PrivateBin Project
#!/bin/bash
grep -o "js/[^']*\.js" lib/Configuration.php | while read f; do
h=$(openssl dgst -sha512 -binary "$f" | openssl enc -base64 | tr -d '\n')
sed -i.bak "s|'$f' => 'sha512-[^']*'|'$f' => 'sha512-$h'|" lib/Configuration.php
done
rm -f lib/Configuration.php.bak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment