项目作者: aaronst

项目描述 :
Mach-O & Universal Binary Parser
高级语言: Python
项目地址: git://github.com/aaronst/macholibre.git
创建时间: 2016-06-08T21:10:24Z
项目社区:https://github.com/aaronst/macholibre

开源协议:Apache License 2.0

下载


macholibre

Description

macholibre is a Mach-O and Universal binary parser. It extracts information
such as architectures, load commands, dynamic libraries, symbols, function
imports, and tons more. Then it packs all of that information into JSON for
ease of analysis and integration.

Python 2

With Python 2 in its sunset years, macholibre has moved on to Python 3.
However, for those of you that are stuck on Python 2, see the python2
branch. No promises on long-term support, but the code differences right now
are minimal and should be fairly easy to maintain.

Dependencies

This project requires Python 3.4+ to run, due to API changes in plistlib.

I tried to make this tool with as little external dependencies as possible, and
I think I did pretty well on that front. The only module I import is for
parsing CMS signatures. I’ve configured setup.py to automatically install
it with the module, but you can also install it seperately with pip or manually
from github.

How To

Installation

I recommend using pip to install macholibre.

  1. pip3 install git+https://github.com/aaronst/macholibre.git

Usage

As a Module

  1. from macholibre import parse
  2. # mach-o file path
  3. path = '/home/aaron/my_macho'
  4. # return dict
  5. data = parse(path)
  6. # write json to file
  7. out_file = open('/home/aaron/macholibre_output.json', 'w')
  8. parse(path, out=out_file)

As a Script

  1. usage: macholibre [-h] [-c] [-o OUTPUT] input [input ...]
  2. MachoLibre: Mach-O & Universal Binary Parser
  3. aaronjst93@gmail.com
  4. positional arguments:
  5. input input mach-o file(s) to parse
  6. optional arguments:
  7. -h, --help show this help message and exit
  8. -c, --certificates extract certificates
  9. -o OUTPUT, --output OUTPUT
  10. output JSON file
  11. examples:
  12. macholibre macho
  13. macholibre -o output.json macho
  14. macholibre -o output.json machos/*

Output Format

macholibre formats all of its output into a JSON blob. Check out
app_store.json as an example using the App Store app.