Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Running PyCript on Macbook Air M1 | command not found #8

Closed
gchib297 opened this issue May 6, 2024 · 5 comments · Fixed by #11 or PortSwigger/pycript#2
Closed

Error Running PyCript on Macbook Air M1 | command not found #8

gchib297 opened this issue May 6, 2024 · 5 comments · Fixed by #11 or PortSwigger/pycript#2
Assignees
Labels
enhancement New feature or request

Comments

@gchib297
Copy link

gchib297 commented May 6, 2024

Have you gone through the Documentation or Video Tutorial

Describe the bug
Documenting it here for reference if someone faces same issue in future. Thank you for the awesome work!

PyCript could not correctly determine path of installed python and node and logged following error on Log tab:
/bin/sh: python: command not found

Workaround for me was to use absolute paths in file ./pycript/execution.py at L8 and L10 as suggested in python doc here

        if selectedlang == "JavaScript":
            command.extend(["/usr/local/bin/node", '"' + path + '"'])  # Surround path with double quotes
        elif selectedlang == "Python":
            command.extend(["/usr/local/bin/python3", '"' + path + '"'])  # Surround path with double quotes

@Anof-cyber maybe determining path at runtime using shutil.which() would help here?

To Reproduce
Steps to reproduce the behavior:

  1. Install PyCript from BAppStore or github
  2. Configure the required options in Config tab
  3. Enable logging in Log tab
  4. Try to encrypt or decrypt values
  5. Error as stated above is displayed

Expected behavior
Pycript should be able to determine installation path of python and node correctly

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS 14.1.2 (Macbook Air M1)
  • BurpSuite Version: v2024.3.1.4
  • PyCript Version: 0.3
@gchib297 gchib297 added the bug Something isn't working label May 6, 2024
@gchib297 gchib297 closed this as completed May 6, 2024
@impozzible
Copy link

Hi @gchib297 why did you close this? having the same issue

@Anof-cyber
Copy link
Owner

Anof-cyber commented Jun 8, 2024

@impozzible The issue is not related to PyCript. The documentation mentioned that binaries/language should be accessible from anywhere in the system. The system env should have the path of the langauge binaries to allow using from anywhere in the system terminal.

Make sure the Java/Python/node is in system environment variables and should be accessible from anywhere in terminal.

https://pycript.souravkalal.tech/latest/Prerequisites/

@YSaxon
Copy link

YSaxon commented Jun 28, 2024

I did a bit of debugging, and in macOS, the python and node commands running in execution.py end up for whatever reason being run with a barebones env in which PATH=/usr/bin:/bin:/usr/sbin:/sbin. All of those folders are covered by macOS's SIP which means they are not modifiable. So there is no easy way for an end user to remedy this, other than to either hardcode the paths to the binaries (which is obviously not a portable solution) or to find a way of inheriting a normal environment. I've just submitted a pull request to that effect, which calls env under a login shell once at init, and then passes that env to subsequent Popen calls.

@YSaxon
Copy link

YSaxon commented Jul 1, 2024

For anyone else who has this problem, you can try my patch here https://github.com/YSaxon/PyCript/tree/PATCH

@Anof-cyber Anof-cyber reopened this Jul 1, 2024
@Anof-cyber Anof-cyber added enhancement New feature or request and removed bug Something isn't working labels Jul 1, 2024
@Anof-cyber
Copy link
Owner

@YSaxon the issue has been fixed with different methods. The new commit 46b8b8c allows you to select the executable like python.exe node etc instead of taking langauge binary from system environment.

The additional features which allow you to remove the limit of using just 3 langauge like Python Java and NodeJS. You can keep empty langauge path and use to run encrpytion decryption script as executable, which allows you to write encrpytion decryption script in compiled language like C C++ Rust or Go etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment