Closed devcoinfet closed 2 years ago
PermissionError: [Errno 13] Permission denied: './private.py' that's as far as i'm gonna go error wise as there is no context other than tht does not work with your example on kali or ubuntu
ok so a self solve
# web imports
from flask import Flask
from flask_executor import Executor
from flask_shell2http import Shell2HTTP
# Flask application instance
app = Flask(__name__)
# application factory
executor = Executor(app)
shell2http = Shell2HTTP(app, executor, base_url_prefix="/scripts/")
shell2http.register_command(endpoint="hacktheplanet", command_name="python3 ./fuxsocy.py")
# Application Runner
if __name__ == "__main__":
app.testing = True
c = app.test_client()
"""
The final executed command becomes:
```bash
$ ./fuxsocy.py
"""
uri = "/scripts/hacktheplanet"
resp1 = c.post(uri, json={"args": []}).get_json()
print(resp1)
# fetch result
result_url = resp1["result_url"]
resp2 = c.get(result_url).get_json()
print(resp2)
this is how your script should be
than the contents of the py like so
```python3
import os
import sys
print(2*2)
and return code proving the example is flat out not working
{"end_time":1635766722.6711774,"error":"","key":"5bb35ab3","process_time":0.012186288833618164,"report":"4\n","returncode":0,"start_time":1635766722.658991}
so the problem is you were passing a python script to bash with no Interpreter
Hey!
PermissionError: [Errno 13] Permission denied: './private.py'
The reason you are getting PermissionError
is because your user does not have the executable permission on the private.py
file. Assuming you are on a unix based system, you can simply run the command chmod u+x private.py
to solve this.
so the problem is you were passing a python script to bash with no Interpreter
If a python file includes the shebang statement (#!/usr/bin/env python3
) on the first line and has the executable flag (x
) set, then it's possible to run it by just invoking it with ./
instead of python3
.
Of course your solution is fine too and maybe even better for the sake of simplicity.
nope tht was not it i have no permission errors simply like i showed you above when calling python via bash it needs to be prefixed with python3 the permission error was due to not using python3 before the fuxsocy.py file go figure it works though
but u make a good point shhh dont tell anyone i forgot my shebangs plz
Question why am i getting a permission denied error on one of your example scripts for running a post to a python file no need to give any example other than it dont work lol