Checking Common File Types
jade
jadec375 at msn.com
Sun Dec 1 13:27:16 EST 2013
Hello,
I'm trying to create a script that checks all the files in my 'downloaded' directory against common file types and then tells me how many of the files in that directory aren't either a GIF or a JPG file. I'm familiar with basic Python but this is the first time I've attempted anything like this and I'm looking for a little help or a point in the right direction?
file_sigs = {'\xFF\xD8\xFF':('JPEG','jpg'), '\x47\x49\x46':('GIF','gif')}
def readFile(): filename = r'c:/temp/downloads' fh = open(filename, 'r') file_sig = fh.read(4) print '[*] check_sig() File:',filename #, 'Hash Sig:', binascii.hexlify(file_sig)
RegardsJade
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131201/ef899f21/attachment.html>
More information about the Python-list
mailing list