Skip to content

Instantly share code, notes, and snippets.

@joshterrill
Created December 28, 2022 07:37
Show Gist options
  • Save joshterrill/688645cce28b115e9cdeb94569bbf616 to your computer and use it in GitHub Desktop.
Save joshterrill/688645cce28b115e9cdeb94569bbf616 to your computer and use it in GitHub Desktop.
A shell script that checks files for entropy then orders files by highest entropy and saves the paths to a file called `entropy.txt`
echo "Getting entropy readings from all .php files"
rm -rf entropy.txt entropy.tmp.txt
for entry in $(find . -type f -name "*.php" -maxdepth 4); do
entropy=$(ent $entry | sed -n 's/.*Serial correlation coefficient is //p' | sed "s/ .*//")
echo "$entry $entropy" >> entropy.tmp.txt
done
sort -k2 -n entropy.tmp.txt > entropy.txt
rm -rf entropy.tmp.txt
echo "Entropy readings saved to entropy.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment