otool工具简介

Mac OS X下二进制可执行文件的动态链接库是dylib文件。

所谓dylib,就是bsd风格的动态库。基本可以认为等价于windows 的dll和linux的so。mac基于bsd,所以也使用的是dylib。

查看 otool 地址

$ otool -help

复制代码

返回:

-f print the fat headers

-a print the archive header

-h print the mach header

-l print the load commands

-L print shared libraries used

-D print shared library id name

-t print the text section (disassemble with -v)

-p start dissassemble from routine name

-s print contents of section

-d print the data section

-o print the Objective-C segment

-r print the relocation entries

-S print the table of contents of a library (obsolete)

-T print the table of contents of a dynamic shared library (obsolete)

-M print the module table of a dynamic shared library (obsolete)

-R print the reference table of a dynamic shared library (obsolete)

-I print the indirect symbol table

-H print the two-level hints table (obsolete)

-G print the data in code table

-v print verbosely (symbolically) when possible

-V print disassembled operands symbolically

-c print argument strings of a core file

-X print no leading addresses or headers

-m don't use archive(member) syntax

-B force Thumb disassembly (ARM objects only)

-q use llvm's disassembler (the default)

-Q use otool(1)'s disassembler

-mcpu=arg use `arg' as the cpu for disassembly

-j print opcode bytes

-P print the info plist section as strings

-C print linker optimization hints

--version print the version of /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool

复制代码

由上可知, otool 的地址:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool

进入地址发现,otool 文件是个软连接。

查看 otool 指向的软连接地址:

cd进入otool所在的目录,使用 ls -l 命令;

Linux下用ldd查看,苹果系统用otool。

$ cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ ls -l

复制代码

结果如下:

total 209368

-rwxr-xr-x 1 root wheel 33920 3 20 11:34 ar

-rwxr-xr-x 1 root wheel 28000 3 20 11:34 as

...

-rwxr-xr-x 1 root wheel 32672 3 20 11:34 llvm-otool

...

lrwxr-xr-x 1 root wheel 10 3 22 15:43 otool -> llvm-otool

...

-rwxr-xr-x 1 root wheel 640352 3 20 11:34 otool-classic

复制代码

可以发现 otool 指向 llvm-otool,llvm-otool 和 otool 在同一个文件夹下。

可以发现,这个文件夹下面还有很多有用的文件,如 lipo。

用法

1、依赖库的查询 otool -L

$ otool -L /Applications/Pomotodo.app/Contents/MacOS/Pomotodo

/Applications/Pomotodo.app/Contents/MacOS/Pomotodo:

复制代码

内容如下:

/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)

/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1504.82.104)

/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)

/System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement (compatibility version 1.0.0, current version 972.50.27)

@rpath/Sparkle.framework/Versions/A/Sparkle (compatibility version 1.6.0, current version 1.14.0)

/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 888.51.1)

/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 603.1.30)

/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0)

/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1349.63.0)

/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)

/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)

/System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork (compatibility version 1.0.0, current version 811.4.18)

/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.64.0)

/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1070.22.0)

/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 775.19.0)

复制代码

otool -l WeChart | grep -B 2 crypt

可以查看微信的是否加密等信息

返回信息类似如下

cryptoff 16384

cryptsize 6651904

cryptid 0

cryptoff 16384

cryptsize 6553600

cryptid 0123456

//其中cryptid代表是否加壳,1代表加壳,0代表已脱壳。我们发现打印了两遍,其实代表着该可执行文件支持两种架构armv7和arm64.

复制代码**2、otool -ov 内容如下**

复制代码

$ otool -ov /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text

/Applications/Sublime Text.app/Contents/MacOS/Sublime Text:

Contents of (__DATA,__objc_classlist) section

0000000100742950 0x1007467a8 _OBJC_CLASS_$_WorkQueueCallback

isa 0x100746780 _OBJC_METACLASS_$_WorkQueueCallback

superclass 0x0 _OBJC_CLASS_$_NSObject

cache 0x0

vtable 0x0

data 0x100742a40 (struct class_ro_t *)

flags 0x0

instanceStart 8

instanceSize 16

reserved 0x0

ivarLayout 0x0

name 0x10064cba3 WorkQueueCallback

baseMethods 0x100742a88 (struct method_list_t *)

entsize 24

count 1

name 0x10064a14e processItems:

types 0x10064cd14 v24@0:8@16

imp -[WorkQueueCallback processItems:]

baseProtocols 0x0

ivars 0x100742aa8

entsize 32

count 1

offset 0x1007466d8 8

name 0x10064a147 runner

type 0x10064cce9 ^{ns_work_queue_runner=^^?^{work_queue}@@}

alignment 3

size 8

weakIvarLayout 0x0

baseProperties 0x0

Meta Class

isa 0x0

superclass 0x0 _OBJC_METACLASS_$_NSObject

cache 0x0

vtable 0x0

data 0x1007429f8 (struct class_ro_t *)

复制代码

汇编码 otool -tV

> 则整个ARM的汇编码就都显示出来了,数据量如瀑布

复制代码

查看 Mach-O头结构等

$ otool -h /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text

Mach header

magic cputype cpusubtype caps filetype ncmds sizeofcmds flags

0xfeedfacf 16777223 3 0x80 2 27 4336 0x00218085

复制代码一个 Mach-O 的文件头结构为:

magic(魔数)- 0xfeedfacf

cputype(CPU类型)- 16777223

cpusubtype(CPU子类型)- 3

caps - 0x80

filetype(文件类型) - 2

ncmds - 27

sizeofcmds(加载命令大小) - 4336

flags(动态连接器dyld标志) - 0x00218085

linux下的逆向工具有哪些,iOS逆向(八)逆向工具 otool 介绍相关推荐

  1. linux 监控微信通知,一个 Linux 下基于 Bash 的文件和数据库监控及备份工具,可发送微信报警通知...

    shellMonitor 一个 Linux 下基于 bash 的文件和数据库监控及备份工具. 写这个工具的原因,在于一个朋友的一个小电商网站,因为未明原因被黑了,总是会被增加超级管理员,并将收款账号改 ...

  2. Linux下几款C++程序中的内存泄露检查工具

    Linux下编写C或者C++程序,有很多工具,但是主要编译器仍然是gcc和g++.最近用到STL中的List编程,为了检测写的代码是否会发现内存泄露,了解了一下相关的知识. 所有使用动态内存分配(dy ...

  3. linux下c语言抓包,C语言实现抓包工具

    本文使用libpcap库在linux下面开发自定义抓包工具,同学们也可以在win下编写同样的代码. 抓包的目的: 1.分析协议 2.伪造数据包 3.获取重要信息,例如用户名和密码 4.做某些攻击使用 ...

  4. noi linux下如何安装视频播放器 和 播放swf文件的工具

    因为考试需要,孩子们必须要在赛前掌握使用noilinux了,可是使用起来诸多不方便,这不,在linux里用什么看视频和swf教程呢. 下面提供我搜集到的方法: 1.用noilinux自带的smplay ...

  5. raw文件 linux,Linux下处理(包括raw,HDR)和管理照片软件介绍

    Linux下处理(包括raw,HDR)和管理照片软件介绍写这个帖子算是为论坛做点贡献吧(平时还是潜水的多),虽然估计对大部分人没用,但是万一有用Linux的兄弟搜索一下论坛能看到这个帖子还是有帮助的 ...

  6. 在 Linux 下使用 RAID(九):如何使用 ‘Mdadm’ 工具管理软件 RAID

    无论你以前有没有使用 RAID 阵列的经验,以及是否完成了 此 RAID 系列 的所有教程,一旦你在 Linux 中熟悉了 mdadm --manage 命令的使用,管理软件 RAID 将不是很复杂的 ...

  7. Kali linux下图片隐写,图片隐写信息快速检测工具——zsteg

    CTF的图片隐写题中有一种常见的题型--基于LSB原理的图片隐写,而最常用工具就是Stegsolve,但是过程还是有些缓慢和复杂,终于在一次比赛中发现了一个强大的工具--zsteg,这是一个用于检测P ...

  8. 发现了一个在freebsd12和linux下比较好用的刻录u盘的工具可以刻录win8.1启动盘

    名字叫Unetbootin,官网为https://unetbootin.github.io/ 1.可以在线刻录各linux发行版和bsd系统,也可以使用本地ISO文件刻录 2.还有就算可以刻录win8 ...

  9. linux 抓包生成文件,Linux下使用libpcap进行网络抓包并保存到文件(函数介绍)

    libpcap是一个抓取网络数据报文的C语言函数库,使用这个库可以非常方便的抓取网络上的报文,方便我们分析经过我们设备上的各种报文: 使用libcap库编译时都要在后面加上-lpcap选项 使用pca ...

  10. Linux下C++开发工具介绍

    概述     就C++开发工具而言,与Windows下微软(VC, VS2005等)一统天下相比,Linux/Unix下C++开发,可谓五花八门,各式各样.Emacs, vi, eclipse, an ...

最新文章

  1. QCon北京2015:18个热门专题,出品人全部确认,新版网站上线
  2. Xamarin.Forms特殊的视图BoxView
  3. Sage CRM升级注意事项一
  4. Java反射技术概述
  5. 时过境迁:Oracle跨平台迁移之XTTS方案与实践
  6. StringBuffer练习
  7. python simple example
  8. LINUX命令之stat及显示的三个时间戳
  9. activiti处理当前用户的任务
  10. select选择框在谷歌火狐和IE样式的不同
  11. STM32中assert_param的使用
  12. _block 的使用 详细介绍
  13. 科技云报道:新基建已到来,网络安全建设跟上了吗?
  14. Encoder-Decoder 模型架构详解
  15. PHP表单验证及安全
  16. 【数据库开发】MySQL绿色版的下载和安装
  17. gcc -shared -o libJava.so Java.o ./libdemo.a
  18. 米家和HomeKit等智能家居联动的重要性
  19. 有未经处理的异常 0xC00000FD Stack overflow (参数: 0x00000000, 0x00842000)
  20. python统计水仙花数个数_Python一句代码实现找出所有水仙花数的方法

热门文章

  1. 电容基础知识 之 电容容值越大越好么?
  2. CSS 框模型概述 CSS 框模型 (Box Model) 规定了元素框处理元素内容、内边距、边框 和 外边距 的方式...
  3. C语言 操作系统实验 四种调度(最高响应比优先算法 HRN)
  4. 计算机操作系统(第3版)(微课版)课后习题答案全
  5. 安卓逆向小案例——某新闻APP请求头urlSign还原
  6. 开源一款娱乐的qq机器人-QQRobot
  7. Android四大组件及其作用
  8. 微雪新款HDMI液晶框架安装
  9. 面试恒安嘉新运维/项目经理面经 2019-06
  10. SAS初学者笔记---001