Resizing mach-o binary?

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

Resizing mach-o binary?

Postby asic84 » Fri Oct 13, 2017 10:47 pm

I noticed jtool has the -r and -m flags. I tried to use them to resize the __TEXT segment of a sample binary but it didn't seem to alter anything. MD5 sums before and after are the same. Am I missing anything?

Code: Select all
./jtool -m __TEXT,0x100000000,0x20000 test2
Modifying section __TEXT: Adjusting offset to 0x100000000 size to 0x20000
Warning: Destructive option. Output (18832 bytes) written to out.bin


Code: Select all
./jtool -l out.bin
LC 00: LC_SEGMENT_64          Mem: 0x000000000-0x100000000   __PAGEZERO
LC 01: LC_SEGMENT_64          Mem: 0x100000000-0x100001000   __TEXT
   Mem: 0x100000ef0-0x100000f6e      __TEXT.__text   (Normal)
   Mem: 0x100000f6e-0x100000f74      __TEXT.__stubs   (Symbol Stubs)
   Mem: 0x100000f74-0x100000f8e      __TEXT.__stub_helper   (Normal)
   Mem: 0x100000f8e-0x100000fa9      __TEXT.__cstring   (C-String Literals)
   Mem: 0x100000fac-0x100000ff4      __TEXT.__unwind_info   
LC 02: LC_SEGMENT_64          Mem: 0x100001000-0x100002000   __DATA
   Mem: 0x100001000-0x100001010      __DATA.__nl_symbol_ptr   (Non-Lazy Symbol Ptrs)
   Mem: 0x100001010-0x100001018      __DATA.__la_symbol_ptr   (Lazy Symbol Ptrs)
   Mem: 0x100001018-0x100001058      __DATA.__cfstring   
   Mem: 0x100001058-0x100001060      __DATA.__objc_imageinfo   
LC 03: LC_SEGMENT_64          Mem: 0x100002000-0x100005000   __LINKEDIT
LC 04: LC_DYLD_INFO         
LC 05: LC_SYMTAB             
   Symbol table is at offset 0x20a8 (8360), 23 entries
   String table is at offset 0x2228 (8744), 368 bytes
LC 06: LC_DYSYMTAB           
      16 local symbols at index     0
       4 external symbols at index  16
       3 undefined symbols at index 20
      No TOC
      No modtab
       4 Indirect symbols at offset 0x2218

LC 07: LC_LOAD_DYLINKER         /usr/lib/dyld
LC 08: LC_UUID                  UUID: 7A663875-BA2F-33DA-8AE1-B718E58E0C6C
LC 09: LC_VERSION_MIN_MACOSX    Minimum OS X version:    10.13.0
LC 10: LC_SOURCE_VERSION        Source Version:          0.0.0.0.0
LC 11: LC_MAIN                  Entry Point:             0xf30 (Mem: 0x100000f30)
LC 12: LC_LOAD_DYLIB            /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
LC 13: LC_LOAD_DYLIB            /usr/lib/libobjc.A.dylib
LC 14: LC_LOAD_DYLIB            /usr/lib/libSystem.B.dylib
LC 15: LC_LOAD_DYLIB            /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
LC 16: LC_FUNCTION_STARTS       Offset: 8352, Size: 8 (0x20a0-0x20a8)
LC 17: LC_DATA_IN_CODE          Offset: 8360, Size: 0 (0x20a8-0x20a8)
asic84
 
Posts: 1
Joined: Fri Oct 13, 2017 10:35 pm

Return to Tools

Who is online

Users browsing this forum: No registered users and 3 guests