mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-12 10:04:14 -05:00
Run Shell/Bash in prompt #108
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DrM4CH1N3 on GitHub (Dec 19, 2023).
Hi !
Run sh/bash from Webui :
I'll try to explain ...
1- My prompt :
Give me the first 4 characters of this text: !bash curl ifconfig.io
2-The main.py python script recognizes the !bash command and executes it:
The result of the command stored in a variable
3-The python script returns the request + the variable:
Give me the first 4 characters of this text: 192.168.1.6
Here: 192.168.1.6 is the result of the "curl ifconfig.io" command
Docker container :
Need to install : curl or whatever you need to run in your prompt.
First try with modified ollama_chat.py from :
https://github.com/jmorganca/ollama/blob/main/examples/python-simplechat/client.py
Result :

Code :
Now i need to convert the main.py from /app/ollama/main.py to do the same.
... Need Help... Please.
@DrM4CH1N3 commented on GitHub (Dec 20, 2023):
I'm trying to modify the /app/ollama/main.py file to run shell/bash when !bash is detected:
... Need Help Please.
Code :
@justinh-rahb commented on GitHub (Dec 20, 2023):
Implementing the ability to execute arbitrary bash commands through the Ollama web UI raises extremely serious security concerns. Allowing such functionality could potentially open the door to severe vulnerabilities, including the execution of malicious scripts, data breaches, and system compromises. It's crucial to understand the far-reaching implications of such a feature. I strongly advise against proceeding with this proposal.
@DrM4CH1N3 commented on GitHub (Dec 21, 2023):
@justinh-rahb
I am well aware of the problems it could bring in certain cases. The danger isn't one if it's controlled.
But thank you for taking the time to warn.