• MalObjClass.py – Interact with your samples!

    by  • April 10, 2011 • Uncategorized

    During my research I often find myself needing to take the output JSON from malpdfobj and get some information from it. I coded up quick scripts here and there, but quickly saw that I was typing the same thing over and over. Rather then having to continue doing this, I wrote a quick class respectively named malobjclass that will parse the whole JSON object out into a python object with a bunch of helpful properties to access my data. 

    For this to work, you just need to send your JSON output from malpdfobj to the class and you are done. To do that you have a few options. You could call the build object from another Python file and save the output in a local variable that gets passed to the class or you could store the output in a file, read it, load it as JSON and then send it to the class. The choices are up to the end user, but in the end it takes no more then 10 lines of code to make use of the class and it saves a whole lot of time.

    Instead of listing all the methods here in the blog, I have just included the PyDoc HTML output in the githib repository. Feel free to visit here to take a look at the documentation. Comments are sparse as the method names describe what aspect of the object it is getting. If you have any questions or feedback then shoot me an email or post a comment.