Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vonglasow/shellai
shell for AI inspired by shell_GPT with ollama
https://github.com/vonglasow/shellai
Last synced: 16 days ago
JSON representation
shell for AI inspired by shell_GPT with ollama
- Host: GitHub
- URL: https://github.com/vonglasow/shellai
- Owner: vonglasow
- Created: 2024-02-18T21:07:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-11T22:09:13.000Z (10 months ago)
- Last Synced: 2024-11-06T22:45:10.260Z (2 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ShellAI
## Requirements
- https://ollama.com
- httpx==0.26.0
- pydantic==2.5.3## Installation
### MacOS
```sh
brew install ollama
ollama serve
ollama pull openhermes2.5-mistralgit clone [email protected]:vonglasow/shellai.git
```You must have a `ollama serve` running somewhere
Add the path of shellai into your $PATH## Usage
```sh
$ shellai -h
usage: shellai [-h] [-s] [-c] [-d] [--display-config] [--generate-config] [strings ...]Process user input and command-line arguments.
positional arguments:
strings Additional strings to process (default: None)options:
-h, --help show this help message and exit
-s, --shell Generate shell commands (default: False)
-c, --code Generate code from message (default: False)
-d, --describe Describe inputs (default: False)
--display-config Display current config (default: False)
--generate-config Generate a default config file (default: False)Example usage:
Generate a shell command
$ shellai --shell "Generate a command to find all yaml file and delete it"
Generate code
$ shellai --code "Generate a function to return fibonnacci"
Describe informations
$ git diff | shellai --describe "Generate a git commit message"
``````sh
$ cat CVE-2021-4034.py | shellai -d "Analyze and explain this code"
This code is a Python script that exploits the CVE-2021-4034 vulnerability in Python. It was originally written by Joe Ammond, who used it as an experiment to see if he could get it to work in Python while also playing around with ctypes.The code starts by importing necessary libraries and defining variables. The `base64` library is imported to decode the payload, while the `os` library is needed for certain file operations. The `sys` library is used to handle system-level interactions, and the `ctypes` library is used to call the `execve()` function directly.
The code then decodes a base64 encoded ELF shared object payload from a previous command (in this case, using msfvenom). This payload is created with the PrependSetuid=true flag so that it can run as root instead of just the user.
An environment list is set to configure the call to `execve()`. The code also finds the C library, loads the shared library from the payload, creates a temporary file for exploitation, and makes necessary directories.
The code ends with calling the `execve()` function using the C library found earlier, passing in NULL arguments as required by `execve()`.
```## Thanks
Heavily inspired by [shell_gpt](https://github.com/TheR1D/shell_gpt)