How to use jtool to extract speicific arch binary

Used for discussing the various tools in the book as well as encouraging members to share tools

How to use jtool to extract speicific arch binary

Postby Wingzero » Wed Aug 09, 2017 3:34 am

I found jtool seems supports extract specific arch for a binary, just like what lipo does.
But I am stuck at how to use it:
Code: Select all
xuan:jtool xuan$ ./jtool -arch arm64 -e ~/Desktop/6240854.decrypted
File name not specified


I don't find option to specify output file neither
Please help, thanks

Answer: use -arch arm64 -e arch. this tells jtool you want to extract the architecture slice. Otherwise -e takes segment names or dylib/framework names as well for SLC.
Wingzero
 
Posts: 34
Joined: Thu Jul 27, 2017 2:35 am

Re: How to use jtool to extract speicific arch binary

Postby Wingzero » Fri Aug 11, 2017 2:53 am

I tried it print something like:

Code: Select all
xuanliu:jtool xuanliu$ ./jtool -arch arm64 -e arch ~/Desktop/6240854.decrypted
Warning: Binding offset (12864184) is past end of file (10000000) - File may be truncated, or header may be corrupt
Selected architecture (arm64) starts at 11747328 and spans 13338704 bytes - written to /Users/xuanliu/Desktop/6240854.decrypted.arch_arm64


However, I compared it with what lipo extracted:

Code: Select all
xuanliu:jtool xuanliu$ ls -l ~/Desktop/6240854.decrypted.arch_arm64
-rw-------  1 xuanliu  staff  13338704 Aug 11 10:41 /Users/xuanliu/Desktop/6240854.decrypted.arch_arm64
xuanliu:jtool xuanliu$ ls -l arm64.d
-rw-r--r--  1 xuanliu  staff  13355088 Aug 11 10:40 arm64.decrypted


Does the size matters?
Wingzero
 
Posts: 34
Joined: Thu Jul 27, 2017 2:35 am

Re: How to use jtool to extract speicific arch binary

Postby Wingzero » Fri Aug 11, 2017 3:10 am

OK, so I did further investigation,

lipo will export the binary with a fat header before the true bin header begins, although the binary only have arm64 included.
jtool just export the specified arch without the fat header. So no data loss thank god.

And J adds: If you want lipo to do the same as jtool, use -thin and not -extract. But lipo sucks (literally :-) . Jtool is better
Wingzero
 
Posts: 34
Joined: Thu Jul 27, 2017 2:35 am


Return to Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron