dpnishant / appmon

Documentation:
http://dpnishant.github.io/appmon
Apache License 2.0
1.56k stars 276 forks source link

Make getMachOExecutable more general #35

Closed markszabo closed 7 years ago

markszabo commented 7 years ago

I've got the following error by running the current version of the library:

Traceback (most recent call last):
  File "ipa_installer.py", line 167, in <module>
    subprocess.check_output([optool_path, "install", "-c", "load", "-p", "@executable_path/FridaGadget.dylib", "-t", executable_filepath])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['optool/bin/optool', 'install', '-c', 'load', '-p', '@executable_path/FridaGadget.dylib', '-t', '/tmp/appmon_ipa/myApp/Payload/myApp.app/PkgInfo: ASCII text, with no line terminators\n']' returned non-zero exit status 1

The cause of the error was that the function getMachOExecutable returned PkgInfo: ASCII text, with no line terminators.

The reason for that was the fact that file /tmp/appmon_ipa/myApp/Payload/myApp.app/myApp returned myApp: Mach-O executable arm_v7, so getMachOExecutable did not find it.

This PR addresses this issue.

dpnishant commented 7 years ago

Thanks @markszabo! :)