GithubHelp home page GithubHelp logo

Comments (13)

PeterMatula avatar PeterMatula commented on June 28, 2024 1

Looks like another problem with Bash. We can try to get back to this after Bash is replaced with Python implementation (soon I hope) - hopefully, it will be fixed.

from retdec-idaplugin.

PeterMatula avatar PeterMatula commented on June 28, 2024 1

So, in 05c7c47 i did the following:

  • Python interpreter-related checks are not done at plugin initialization. For unknown reason it was crashing IDA on Windows (on Linux, it was ok).
  • Python interpreter-related checks are done before each decompilation.
    • Cons: More checks, more external command invocations from plugin. Should not be a problem.
    • Pros: No crashes - safer (I never know what can and cannot be done in plugin's init function). Users are not bothered at every IDA start if they have a misconfigured plugin but don't use it. Checks can react to the current system state - state can change during one IDA session.
  • New check for python interpreter version - must be at least 3.4, otherwise decompilation will not be attempted. Therefore if python is used, and it is Python 2, as it was in your case, you would be notified. Also PATH is printed in the warning message, so it would be clearer what happened.
  • It is possible to configure path to the Python interpreter in plugin's config window - you do not have to hack your system just for RetDec IDA plugin. Once configured, it will be remembered.

I'm closing this as solved. You can try it and if there is a problem re-open, or open a new issue. I'm still solving some problems with empty warning windows on Windows, it is caused by some code related to this, but the issue is not really related to the original problem, so this can be closed.

from retdec-idaplugin.

Maroc-OS avatar Maroc-OS commented on June 28, 2024

Because bash script doesn't work great on macOS.

Try python branch.

BTW: what is the output of :

/usr/local/bin/retdec-decompiler.sh --help

from retdec-idaplugin.

HarukaMa avatar HarukaMa commented on June 28, 2024
$ /usr/local/bin/retdec-decompiler.sh --help
Decompiles the given file into the selected target high-level language.

Usage:
    /usr/local/bin/retdec-decompiler.sh [ options ] file

Options:
...(lists all options available)

It seems bash-to-python branch is actually behind master though.

from retdec-idaplugin.

PeterMatula avatar PeterMatula commented on June 28, 2024

Can you try it now after we got rid of Bash?

from retdec-idaplugin.

HarukaMa avatar HarukaMa commented on June 28, 2024

It worked, but only after changing /usr/bin/python to point that to python 3. It seems when we are in RdGlobalInfo::isDecompilerInSpecifiedPath the pythonCmd is python, initPythonCommand was not being run to set it to python3. I think /usr/bin normally could not be modified because of SIP, so the plugin would stuck to python 2 which will fail to run the decompiler.

from retdec-idaplugin.

PeterMatula avatar PeterMatula commented on June 28, 2024

pythonCmd has no default value, initPythonCommand() should always run in plugin initialization and set it up. If it does not, it is a bug. But I think it is very likely it did run and set up pythonCmd to python.

  • How did you figure out it did not run?
  • Does python3 --version or py -3 --version work in your command line? If not, python is used.

from retdec-idaplugin.

HarukaMa avatar HarukaMa commented on June 28, 2024

I added some info message output in corresponding functions, and they are not printed out. Will try to confirm that later.

python3 works on my command line.

from retdec-idaplugin.

HarukaMa avatar HarukaMa commented on June 28, 2024

Sorry if the email of this reply have different content, I missed one output. Please read the new version below.

I made some very crude logs to check if they were run:

@@ -116,8 +116,10 @@ bool RdGlobalInfo::isSelectiveDecompilation()
  */
 bool RdGlobalInfo::initPythonCommand()
 {
+    INFO_MSG("Z");
        if (runCommand("python3", "--version") == 0)
        {
+           INFO_MSG("A");
                pythonCmd = "python3";
                return false;
        }
@@ -137,6 +139,7 @@ bool RdGlobalInfo::initPythonCommand()

 bool RdGlobalInfo::isDecompilerInSpecifiedPath() const
 {
+    INFO_MSG("%s\"%s\" --help\n", pythonCmd.c_str(), decompilerPyPath.c_str());
        return runCommand(pythonCmd, "\"" + decompilerPyPath + "\" --help") == 0;
 }

Only Z is present in the log, so it didn't find the python3 installation (maybe because of the binary location?)

# MrX @ harukanomacbook-pro in ~/src/retdec-idaplugin on git:master x [16:20:33]
$ python3 --version
Python 3.6.2

# MrX @ harukanomacbook-pro in ~/src/retdec-idaplugin on git:master x [16:20:35]
$ which python3
/usr/local/bin/python3

from retdec-idaplugin.

PeterMatula avatar PeterMatula commented on June 28, 2024

Ok, so initPythonCommand() is run, but it does not successfully execute python3 --version even though you can execute it from the terminal.

Is it possible that the PATH is somehow modified in order to find python3 only in your terminal but not globally - so the mechanism in plugin does not see it?

First, can you try to modify initPythonCommand() like this?

if (runCommand("/usr/local/bin/python3", "--version") == 0)
{
	INFO_MSG("A");
	pythonCmd = "/usr/local/bin/python3";
	return false;
}

If this works then python3 can be executed and used, but plugin environment simply does not see it. If it does not, then we have some bigger problem.

Second (if first works), runCommand() is using IDA SDK's launch_process() mechanism, and I don't really know how it works internally. Could you try to replace it with std::system() in initPythonCommand(). First

if (std::system("/usr/local/bin/python3 --version") == 0)
{
	INFO_MSG("A");
	pythonCmd = "/usr/local/bin/python3";
	return false;
}

and then:

if (std::system("python3 --version") == 0)
{
	INFO_MSG("A");
	pythonCmd = "python3";
	return false;
}

If both work (mainly "python3 --version"), then there is some difference between std::system() and launch_process(). If only "/usr/local/bin/python3" works, then whatever environment is plugin using, the PATH is not set in a way python3 can be found.

from retdec-idaplugin.

HarukaMa avatar HarukaMa commented on June 28, 2024

After testing I've found that it is caused by global PATH. For applications launched outside of terminals, the PATH needs to be changed using launchctl setenv PATH ... to make applications see them. After setting the PATH in launchctl the plugin could find python3 successfully.

from retdec-idaplugin.

securebluefox avatar securebluefox commented on June 28, 2024

I want to know how to solve this problem, I still get this error.


My system is Mac os 10.15

from retdec-idaplugin.

s3rvac avatar s3rvac commented on June 28, 2024

@hebtuerror404 Please, create a new issue as this one is closed and very old. Also, attach please the input file and the out from IDA's console.

from retdec-idaplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.