一套用于os-x上mach-o可执行文件分析的工具
machobot的Python项目详细描述
用于mach-o文件分析的python工具箱。严重依赖 macholib。
安装
用于
$ [sudo] pip install machobot
用于开发
$ pip install nose macholib $ git clone https://github.com/rodionovd/machobot.git machobot $ cd ./machobot $ nosetests # run the test suite
用法
作为命令行工具:
$ inject_dylib ./target "@rpath/mylib.dylib"
作为python模块:
importmachobot
Example usage:
importmachobot.dylibasdylibdylib.insert_load_command("output.a","@executable_path/../../libk.dylib")
模块
dylib
insert_load_command(target_path,library_install_name)
在目标mach-o中插入新的LC_LOAD_DYLIBload命令 头球。
Argument | Description |
---|---|
^{tt3}$ | A path to the target Mach-O executable file. This file will be overwritten. |
^{tt4}$ | An install name for the library to inject. This string is used as a part of the load command. |
Return value |
---|
Returns ^{tt5}$ if everything is OK. Otherwise rises an exception. |
macho_dependencies_list(target_path,header_magic=None)
生成给定mach-o文件所依赖的库的列表。
在该列表中,单个库由其“安装路径”表示:对于某些 库将是一个完整的文件路径,而对于其他库则是一个相对路径 路径(有时包含dyld模板,如@executable\u path或@rpath)。
注:我不知道为什么有些胖机器的架构会依赖于 在某些库上,而其他库没有,但是在技术上是可能的。 因此,您可能需要为特定的头指定header\u magic值。
Argument | Description |
---|---|
^{tt3}$ | A path to the target Mach-O executable file. |
^{tt7}$ | Mach-O MAGIC value for a header you want to inspect. If this argument is not provided, the function returns a list of the first header’s dependencies. |
Return value |
---|
An object with two properties: ^{tt8}$ and ^{tt9}$ that hold lists of weak and strong dependencies respectively. |
有关用法示例,请参见machobot/tests/test_dylib.py。
找到问题了吗?提交问题!:shipit: