Linux怎么处理binray文件,Linux下如何反汇编arm raw binary文件

有一个arm elf文件经过objcopy -O binary 命令处理生成bin文件

进行反汇编:

指令1:

arm_v5t_le-objdump  -b binary -m armv5te -D  u-boot.bin|head

指令2:

arm-linux-objdump  -D -b binary test.bin --architecture=arm  > /tmp/raw.txt

http://linux.chinaunix.net/bbs/thread-1145255-1-1.html

http://chdk.wikia.com/wiki/GPL_Disassembling

Meanwhile I wrote a perl script, which does all the jobs. Also it lookup references and add this to the disassemble output.

Disassembling with GNU/GPL tools

The gnu/gpl tools are not made for analysing alien binary dumps because we usually have the source code if we need to debug. This is not really an replacement for IDA but for me it's was sufficient.

Installing software is not explained in this tutorials.

Prerequisites:

You have a raw binary firmware dump to look at. I'll use here "dump.bin"

In this toybox we have:

arm-elf-objcopy | arm-linux-gnu-objcopy

arm-elf-objdump | arm-linux-gnu-objdump

Here we go:

strings -t x dump.bin > dump.strings

hexdump -C dump.bin > dump.hex

arm-linux-gnu-objdump -m arm -b binary -D dump.bin > dump.dis

However, theres a problem: all files start with an offset of 0x00. Here comes my renumber.pl script:

strings -t x dump.bin | ./renumber.pl 0xff810000 > dump.strings

hexdump -C dump.bin |./renumber.pl 0xff810000 > dump.hex

Before we disassemble the dump, we pack it into elf format. This meat is good for feeding gdb and the IDA demo version ;)

arm-linux-gnu-objcopy --change-addresses=0xff810000 -I binary -O elf32-littlearm -B arm dump.bin dump.elf

arm-linux-gnu-objcopy --set-section-flags .data=code dump.elf

Verify the elf file:

arm-linux-gnu-objdump -x dump.elf

Disassemble:

arm-linux-gnu-objdump -d dump.elf > dump.dis

So finally we have 3 ascii files to stare at:

dump.dis

dump.strings

dump.hex

and

dump.elf for gdb and qemu

Putting all together

Meanwhile I wrote GPL:disassemble.pl perl script, which does all the jobs. Also it lookup references and add this to the disassemble output.

disassemble.pl 0xff810000 dump.bin

e.g. output:

NSTUB(Capture.Create, 0xff938368):

ff938368: e92d4010 stmdbsp!, {r4, lr}

ff93836c: e59f0020 ldrr0, [pc, #32]; ff938394: (ffac13cc)

ff938370: ebfcc3fd blff86936c <_binary_dump_bin_start>

ff938374: eb01cf03 blff9abf88 <_binary_dump_bin_start>

ff938378: e3a00000 movr0, #0; 0x0

ff93837c: e8bd8010 ldmiasp!, {r4, pc}

// this is obviously an entry point, because ^^ is a "return"

ff938380: e24f1020 subr1, pc, #32; ff938368: (e92d4010)

ff938384: e28f000c addr0, pc, #12; ff938398: (74706143) *"Capture.Create"

ff938388: eafcc355 bff8690e4 <_binary_dump_bin_start>

// another

ff93838c: e28f0004 addr0, pc, #4; ff938398: (74706143) *"Capture.Create"

ff938390: eafcc355 bff8690ec <_binary_dump_bin_start>

// this is data, referenced from 0xff93836c followed by some text

ff938394: ffac13cc undefined instruction 0xffac13cc

"Capture.Create":

ff938398: 74706143 ldrvcbtr6, [r0], #-323

ff93839c: 2e657275 mcrcs2, 3, r7, cr5, cr5, {3}

ff9383a0: 61657243 cmnvsr5, r3, asr #4

ff9383a4: 00006574 andeqr6, r0, r4, ror r5

Note: The entire disassembled file is shown as instructions, including strings and numeric constants. Strings are identified where referenced, as shown above, but the corresponding address still has disassembled (nonsense) instructions. If the instructions you are looking at don't make any sense, they are probably data.

using gcc/gas

Another way to create an elf file with symbols from chdk's stub files: forum However, the disassemble script makes a better format but this one is very good for gdb+qemu ;)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/375987.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

putty连虚拟机中Linux出现Access Denied

环境&#xff1a;VMwarekali Linux出现这个问题&#xff0c;肯定是你想尝试直接通过使用root账户连接你的linux&#xff0c;这样肯定是不行的&#xff0c;why&#xff1f;为了保证服务器安全&#xff0c;几乎所有的服务器都禁止了超级用户直接登录系统&#xff0c;而是通过普通…

Floyd算法应用-医院选址问题

1)问题描述 n个村庄之间的交通图可以用有向网图来表示&#xff0c;图中边<vi, vj>上的权值表示从村庄i到村庄j的道路长度。现在要从这n个村庄中选择一个村庄新建一所医院&#xff0c;问这所医院应建在哪个村庄&#xff0c;才能使所有的村庄离医院都比较近&#xff1f; 2)…

linux ls 命令排序,如何在Linux中使用ls命令按大小对所有文件进行排序

ls命令是列出目录内容的最流行且非常有用的命令。 在本文中&#xff0c;我们将解释如何使用ls sort选项按大小列出目录内容。1)按大小列出目录中的文件(排序)要列出具有大小排序的特定目录的内容&#xff0c;我们将使用-lS选项和ls命令。 它将在顶部显示最大的文件。[linuxidcl…

C​#​获​取​当​前​时​间​的​各​种​格​式

C#获取当前时间的各种格式 DateTime.Now.ToShortTimeString() DateTime dt DateTime.Now; dt.ToString();//2005-11-5 13:21:25 dt.ToFileTime().ToString();//127756416859912816 dt.ToFileTimeUtc().ToString();//127756704859912816 dt.ToLocalTime().ToString(…

基于tcp connect的端口扫描程序

原理&#xff1a;connect()函数用于对于每一个感兴趣的目标计算机的端口进行连接&#xff0c;如果该端口处于侦听状态&#xff0c;那么connect()就会成功&#xff0c;即没有提供服务。如果对于每一个目标端口以串行的方式使用单独的connect()调用&#xff0c;需要较长的时间&am…

UIScrollView

一、UIScrollView 1.常见属性 property(nonatomic) CGPoint contentOffset; // 记录UIScrollView滚动的位置 property(nonatomic) CGSize contentSize; // 内容尺寸&#xff08;能滚动的范围&#xff09; property(nonatomic) UIEdgeInsets contentInset; // 额外增加的滚动区域…

linux如何运行多个硬盘,一个硬盘如何装两个Linux

1个硬盘已安装Fedora 8 Linux系统&#xff0c;并安装grub引导管理程序&#xff0c;现要在这个硬盘的空闲分区中安装Fedora 9&#xff0c;操作如下&#xff1a;1.将Fedora-9-i386-DVD.iso文件放到一个Windows Fat32分区((hd0,4))的根目录&#xff0c;将这个iso文件中的isolinux目…

APIO2015 酱油记

Day 0 昨天CTSC才比完&#xff0c;当然是要浪啦&#xff01; 于是浪了一天。。。午饭都没吃。。。 晚饭。。。貌似也没吃。。。 晚上的时候觉得这样子浪不太好&#xff0c;还是要认真一下&#xff0c;打开bzoj&#xff0c;弃疗了。。。还是浪吧。。。 Day 1 今天要讲课&#xf…

宏定义 #define 和常量 const 的区别

学习笔记&#xff01;参考链接 一、类型和安全检查不同宏定义是字符替换&#xff0c;没有数据类型的区别&#xff0c;同时这种替换没有类型安全检查&#xff0c;可能产生边际效应等错误&#xff1b;const常量是常量的声明&#xff0c;有类型区别&#xff0c;需要在编译阶段进行…

【ibus】设置ibus输入法(pinyin sunpinyin)

设置ibus-pinyin 在终端中运行 /usr/lib/ibus-pinyin/ibus-setup-pinyin命令可以调出ibus的完整设置对话框 设置ibus-sunpinyin 可以执行ibus-sunpinyin自带的python设置脚本ibus-setup-sunpinyin来全面设置它 : $ /usr/lib/ibus-sunpinyin/ibus-setup-sunpinyin 如果执行此脚…

linux 进程 释放内存,Linux 释放内存方法和原理

今天惊愕地发现&#xff0c;主节点上8G内存被不知道什么进程吃掉了整整6G有余&#xff0c;正常的计算快要维持不下去了&#xff0c;遂处理之。先看看内存使用状况[rootnode1 ~]# free -mtotal used free shared buffers cachedMem: 8004 6557 1446 0 163 5630-/ buffers/cache:…

玩转Win32开发(2):完整的开发流程

上一篇中我给各位说了一般人认为C中较为难的东西——指针。其实对于C&#xff0c;难点当然不局限在指针这玩意儿上&#xff0c;还有一些有趣的概念&#xff0c;如模板类、虚基类、纯虚函数等&#xff0c;这些都是概念性的东西&#xff0c;几乎每一本C书上都会介绍&#xff0c;而…

c++函数传参:值传递、指针传递、引用传递

1、将变量名作为实参和形参&#xff1a; 这时传给形参的是变量的值&#xff0c;传递是单向的。如果在执行函数期间形参的值发生变化&#xff0c;并不传回实参。应为在调用函数时&#xff0c;形参和实参不是同一个存储单元。 2、传递变量的指针&#xff1a; 形参是指针变量&a…

赞!带进度条的 jQuery 文件拖放上传插件

jQuery File Uploader 是一个 jQuery 文件拖放上传插件&#xff0c;包括 Ajax 上传和进度条效果。作者编写这个插件的想法是要保持它非常简单&#xff0c;不像其他的插件&#xff0c;很多的标记&#xff0c;并提供一些 Hack 的方式使之兼容那些古老的浏览器。jQuery File Uploa…

linux系统有几个系统盘,linux操作系统的分区有哪些种类?各分区主要作用是什么?...

满意答案Linux下一切都是文件&#xff0c;不存在分区的概念&#xff0c;在Linux下说的分区只是磁盘管理和数据组织的需要。Linux使用标准的目录结构&#xff0c;在安装的时候&#xff0c;安装程序就已经为用户创建了文件系统和完整而固定的目录组成形式&#xff0c;并指定了每个…

::范围解析运算符

学习笔记&#xff1a;参考链接 ::是范围解析运算符&#xff0c;或者称为域区分符&#xff0c;用来指明一个函数或一个数据属于哪一个类。 ::也可以不跟类名&#xff0c;表示全局函数或者全局数据 eg: #include<iostream> using namespace std;int month;//全局变量 i…

渴望

有些时候 还是会觉得很孤独 因为自己总是一个人 一个人吃饭 一个人学习 一个人生活 心情难免会低落 很想有一个人 可以一直陪伴在自己身边 一起吃饭 一起学习 一起看潮起潮落 以为自己足够坚强 可以耐得住很多孤独 却总还是会 感觉lonely 很多时候很羡慕 那些大学里的小情侣 虽…

linux中可以安装不同版本的gcc么,在linux下安装多个版本的GCC

文章链接&#xff1a;http://blog.csdn.net/chid/article/details/6251781很是有用&#xff0c;转载学习1.查看当前linux版本内核版本&#xff1a;cat /proc/version或者&#xff1a;uname -a2.查看gcc的版本gcc -v或者&#xff1a;gcc --version或者&#xff1a;查看当前安装的…

Python中如何读取xml的数据

<?xml version"1.0" encoding"utf-8" ?> - <catalog><maxid>4</maxid> - <login username"pytest" passwd"123456"><caption>Python</caption> - <item id"4"><ca…

C++中private成员变量和protect成员变量的区别

保护成员和私有成员很相似&#xff0c;但是就是在子类中&#xff0c;保护成员可以访问&#xff0c;而私有成员不能被访问&#xff0c;也就是说子类中的函数&#xff0c;可以访问父类中的保护成员变量&#xff0c;而不能访问私有成员变量&#xff0c;要想访问父类中的私有成员变…