I would like to create a shell script that will check to make sure all files in a directory that appear superficially to be image files (e.g. have typical image file extensions like .jpg, .bmp etc.) are actually image files.
We recently had an issue where a hacker was able to generate a file in a directory and mask it as a .jpg file. I would like to create a shell script to check all files in the directory to make sure they are real jpg, gif or png files.