Better Codedirectory Parsing and Added Requirements(_Code) Parsing#195
Better Codedirectory Parsing and Added Requirements(_Code) Parsing#195abpolym wants to merge 6 commits intocrits:masterfrom
Conversation
|
I'll try to get to checking this out when I can :) When you say you had to modify the Parser, which parser are you referring to? Is that something you have to do on top of accepting these changes to make stuff work? |
|
What I mean is this script - you have to edit this file if you want to display the information that can be extracted using the new Parser methods. I mixed up some terminology here. The stuff I implemented works so far, however it still has some flaws (mentioned above) that I or someone else has to fix or have a look into. I can try to add it in the coming days, but I got a lot of other workload that I have to finish first. |
|
Sorry this took ages to get back to. I can run this and I do get some output. But it errors out and in the log it says |
|
@mgoffin Can you give me the/an example MACH-O file, in which this error occurs, for me to reproduce? |
|
I believe i used |
The current CodeDirectory Parsing is not sufficient.
I used freely accessible information from the opensourced source code:
Tested on OS X
You have to modify the Parser, though.
My current Parser Version looks like this:
[...] if sig['type'] == MachOEntity.CODE_DIRECTORY: print " [-] Length: %s" % sig['length'] print " [-] Version: %s" % sig['version'] print " [+] nSpecialSlots: %s" % sig['nSpecialSlots'] for (slotname, hash) in sig['specialSlots']: print " [-] %s: %s" % (slotname, hash) print " [+] nCodeSlots: %s" % sig['nCodeSlots'] for (slotname, hash) in sig['codeSlots']: print " [-] %s: %s" % (slotname, hash) print " [-] Identifier: %s" % sig['identifier'] print " [-] Hash type: %s" % sig['hashtype'] print " [-] Hash: %s" % sig['hash'] [...]Edit: I've also implemented requirements parsing.
Source Code:
The Parser Version thus looks like this:
The Requirements Parsing still needs a lot of boundary checks and some parsing for the
OP_CERTGENERICandOP_CERTPOLICYis missing (and breaks the parsing if it is encountered)Match expressions also don't seem to work right now.