The open source project MASTIFF was developed to help users extract key characteristics from a number of different file formats. Actually, MASTIFF is a static analysis framework that automates the process of file analysis and data extraction.
Although, the original purpose of MASTIFF was to support malware, intrusion, and forensic analysis, the framework can also be used for broader range of analytic needs.
Read more and download the code from here – http://sourceforge.net/projects/mastiff/