zardus / idalink

Some glue facilitating remote use of IDA (the Interactive DisAssembler) Python API.
BSD 2-Clause "Simplified" License
77 stars 18 forks source link

Make the launched IDA use the right python even on macOS #16

Closed TheRealTroff closed 7 years ago

TheRealTroff commented 7 years ago

Dynamic linking on OS X/macOS is "special" and so are python installations. Each dynamic library has an embedded identifier that typically includes a file path. This is e.g. what the (link) in my ida virtualenv looks like:

$ otool -D .Python
.Python:
/Library/Frameworks/Python.framework/Versions/2.7/Python

which is supposed to match the dependencies

$ otool -L python.pmc64
python.pmc64:
    @executable_path/plugins/python.pmc64 (compatibility version 1.0.0, current version 1.0.0)
    @executable_path/libida64.dylib (compatibility version 1.0.0, current version 1.0.0)
        ...
    /Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.1)

python in turn appears to pick up its prefix from where the shared library was loaded from and I have been able to get dyld to load it on demand. Pre-inserting it seems to work though.