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.pswp.cn/news/375987.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/375987.shtml
英文地址,請注明出處:http://en.pswp.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;要想訪問父類中的私有成員變…