rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.87k stars 1.15k forks source link

release cutter discard user's provided python version #2101

Open mr-m0nst3r opened 4 years ago

mr-m0nst3r commented 4 years ago

Environment information

Describe the bug I installed angr angrdbg using python3, and put angrcutter folder under plugins/python. Cutter tried to load the plugin, but I guess it's using wrong version of python. By export PYTHONHOME to which python3, the appimage still use it's default python settings.

And, I can't install dependencies under python2.

Here's the whole log:

michael@michael-ubuntu:~$ export PYTHONHOME=`which python3`
michael@michael-ubuntu:~$ cutter 
Setting PYTHONHOME = "/tmp/.mount_cutterGHFyt9/usr"  for AppImage.
PYTHONHOME = "/tmp/.mount_cutterGHFyt9/usr"
Setting r2 prefix = "/tmp/.mount_cutterGHFyt9/usr"  for AppImage.
Setting r2 plugins dir = "/tmp/.mount_cutterGHFyt9/usr/share/radare2/plugins"
Not loading library because it has already been loaded from somewhere else: '/home/michael/.local/share/radare2/plugins/core_ghidra.so'
Module version mismatch /home/michael/.local/share/radare2/plugins/io_frida.so (4.2.0-git) vs (4.3.1)
Module version mismatch /home/michael/.local/share/radare2/plugins/r2golf.so (4.2.0-git) vs (4.3.1)
Plugins are loaded from "/home/michael/.local/share/RadareOrg/Cutter/plugins"
Couldn't load module for plugin: "angrcutter"
Traceback (most recent call last):
  File "/home/michael/.local/share/RadareOrg/Cutter/plugins/python/angrcutter/__init__.py", line 1, in <module>
    from .plugin_interface import create_cutter_plugin
  File "/home/michael/.local/share/RadareOrg/Cutter/plugins/python/angrcutter/plugin_interface.py", line 3, in <module>
    from .plugin import AngrWidget, printMessage, LogLevel
  File "/home/michael/.local/share/RadareOrg/Cutter/plugins/python/angrcutter/plugin.py", line 6, in <module>
    from .debugger import cutterDebugger
  File "/home/michael/.local/share/RadareOrg/Cutter/plugins/python/angrcutter/debugger.py", line 6, in <module>
    from angrdbg import *
ModuleNotFoundError: No module named 'angrdbg'
Loaded 0 plugin(s).
Plugins are loaded from "/usr/share/ubuntu/RadareOrg/Cutter/plugins"
Plugins are loaded from "/usr/local/share/RadareOrg/Cutter/plugins"
Plugins are loaded from "/usr/share/RadareOrg/Cutter/plugins"
Plugins are loaded from "/var/lib/snapd/desktop/RadareOrg/Cutter/plugins"
Plugins are loaded from "/tmp/.mount_cutterGHFyt9/usr/share/RadareOrg/Cutter/plugins"
Loaded 1 plugin(s).
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_init
qt.network.ssl: QSslSocket: cannot resolve sk_new_null
qt.network.ssl: QSslSocket: cannot resolve sk_push
qt.network.ssl: QSslSocket: cannot resolve sk_free
qt.network.ssl: QSslSocket: cannot resolve sk_num
qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve sk_value
qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: Incompatible version of OpenSSL
QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once QUrl("https://api.github.com/repos/radareorg/cutter/releases/latest")
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed

To Reproduce

Steps to reproduce the behavior:

  1. clone angrcutter, and put angrcutter/angrcutter folder to plugin/python

Expected behavior Should use user provided python

karliss commented 4 years ago

That's not how pythonhome configuration works, it shouldn't be pointing to the executable. You should read Pythyon documentation on what pythonhome means.

mr-m0nst3r commented 4 years ago

@karliss Hi, also tried export PYTHONHOME=/usr/local, not working. The console says: Setting PYTHONHOME = "/tmp/.mount_cutterKMtoV3/usr" for AppImage.

If you know how to set this, pls write it down. I'm no developper, I just want to use it, and want to use the plugin.

Or, you got busy, I'll wait for others. thanks

karliss commented 4 years ago

There is a command line argument for pythonhome, but setting python home to /usr/local will not work unless you have the same version of python as one inside Cutter appimage. That would also need some of the python packages that are inside Appimage. Most importantly the cutter python bindings and correct Qt bindings.

Here are two approaches that work for me:

mr-m0nst3r commented 4 years ago

@karliss thank you very much, karliss. I think it may be the angrcutter plugin's improper design. I'll update here after fixed.