deepinstinct / dsc_fix

Aids in reverse engineering libraries from dyld_shared_cache in IDA
GNU General Public License v3.0
101 stars 28 forks source link

'NoneType' object is not iterable #2

Open nikias opened 7 years ago

nikias commented 7 years ago

I get this error when trying to use dsc_fix on MobileCoreServices (tried different version, 9.3.3, 10.0.1, 10.0.2, 10.1) directly opened as a 'single image' from the matching dyld_shared_cache_arm64 which I select in the open dialog presented by dsc_fix:

/Users/nikias/coding/dsc_fix/dsc_fix.py: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/Applications/IDA Pro 6.95/idaq64.app/Contents/MacOS/python/ida_idaapi.py", line 509, in IDAPython_ExecScript
    execfile(script, g)
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 760, in <module>
    main()
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 745, in main
    map_shared_bridges(dsc_file, adrfind)
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 629, in map_shared_bridges
    label_and_fix_branch_islands(dsc_file, adrfind, jmp_to_code)
  File "/Users/nikias/coding/dsc_fix/dsc_fix.py", line 645, in label_and_fix_branch_islands
    dylib_path, dsc_offset, macho_offset = res
TypeError: 'NoneType' object is not iterable

I changed the code to continue anyway like this:

diff --git a/dsc_fix.py b/dsc_fix.py
index 68443f8..e96eabf 100644
--- a/dsc_fix.py
+++ b/dsc_fix.py
@@ -642,6 +642,8 @@ def label_and_fix_branch_islands(dsc_file, adrfind, jmp_to_code):
         res = adrfind.find(addr)
         if not res:
             print "[!] coudln't find addr for addr:", addr
+            i += 1
+            continue
         dylib_path, dsc_offset, macho_offset = res
         exportname = adrfind.get_export_name_for_addr(addr)
         if _IN_IDA:

However in the end, it created the additional segements, but instead of things like B objc_msgSend_0 I see a B loc_<original_address in new segment> that is undefined code, for example something like this:

CPS #0x1F   (hex: 1F 00 00 F1)

Any idea what is wrong here? What is the file you used for your example screenshots so I can try if that works at least?

ioudeveldhuis commented 7 years ago

Is there any way to resolve this ? I am running into the same problem...

qdk0901 commented 7 years ago

same problem for me when processing dyld_shared_cache_arm64 from apple tv of ios 9.0

daniel-bluesea commented 6 years ago

same problem.. and as i can see in this thread - no solution.. :(