DEV Community

Cover image for 🚀ShellGPT on Kali Linux — Fully Automated Installer (No Headaches)
Mohammad Shahbaaz Ahmed
Mohammad Shahbaaz Ahmed

Posted on

🚀ShellGPT on Kali Linux — Fully Automated Installer (No Headaches)

Running ChatGPT directly in your terminal sounds amazing… until you try to set it up on Kali Linux.

I recently built a ShellGPT Kali Installer to solve exactly that problem — turning a messy setup process into a clean, reproducible workflow.


💡 The Problem

If you've tried installing ShellGPT (shell-gpt) on Kali Linux, you’ve probably hit issues like:

  • ❌ Broken APT repositories (<!doctype html> errors)
  • ❌ Python / pip / venv conflicts
  • sgpt: command not found
  • ❌ PATH misconfiguration
  • ❌ API key confusion (OpenAI vs OpenRouter)
  • ❌ Inconsistent environments across machines

Instead of fixing these one by one every time…

👉 I decided to automate everything.


⚙️ The Solution — ShellGPT Kali Installer

This project provides a fully automated installer that sets up ShellGPT correctly on Kali Linux.


🚀 What it does

The installer handles:

  • ✔ APT repository cleanup and repair
  • ✔ Dependency installation (Python, pip, venv, git, curl)
  • ✔ Virtual environment setup
  • ✔ ShellGPT installation
  • ✔ Global sgpt CLI command
  • ✔ PATH configuration (bash + zsh)
  • ✔ API configuration guidance
  • ✔ Clean and reproducible setup

⚡ One-Line Installation

curl -fsSL https://raw.githubusercontent.com/shahbaaz-devsec/shellgpt-kali-installer/main/scripts/shellgpt_kali_installer.sh | bash
Enter fullscreen mode Exit fullscreen mode


`


📦 Manual Installation

bash
git clone https://github.com/shahbaaz-devsec/shellgpt-kali-installer.git
cd shellgpt-kali-installer
chmod +x scripts/shellgpt_kali_installer.sh
./scripts/shellgpt_kali_installer.sh


▶️ After Installation

bash
export PATH="$HOME/.local/bin:$PATH"
sgpt --help

Test it:

bash
sgpt "what is privilege escalation"


🔑 API Setup (Important)

ShellGPT requires an API key.

OpenAI

bash
export OPENAI_API_KEY="your_openai_api_key"

OpenRouter (recommended alternative)

bash
export OPENAI_API_KEY="your_openrouter_api_key"
export OPENAI_API_BASE="https://openrouter.ai/api/v1"


🧠 Example Usage

`bash

General questions

sgpt "explain DNS"

Generate shell commands

sgpt --shell "list open ports"

Generate code

sgpt --code "python port scanner"

Explain commands

sgpt --describe-shell "nmap -sV 127.0.0.1"
`


🛠 Real Issues This Fixes

This project was built after encountering real-world problems:

  • Kali repo corruption
  • Broken Python environments
  • Missing PATH exports
  • API quota confusion
  • Installation inconsistencies

Instead of patching each issue manually, the installer solves them at the root level.


📁 Project Structure

`text
scripts/
└── shellgpt_kali_installer.sh

docs/
├── 01-installation.md
├── 02-usage.md
├── 03-openrouter-setup.md
├── 04-troubleshooting.md
└── 05-clean-reset.md
`


🎯 What I Learned

Building this wasn’t just about installing a tool.

It was about:

  • Designing reproducible environments
  • Handling real-world Linux edge cases
  • Improving developer experience (DX)
  • Writing documentation that actually helps
  • Thinking like a DevSecOps engineer

🔐 Disclaimer

ShellGPT can generate shell commands.

👉 Always review commands before running them.
👉 Use only in authorized environments.


📦 Repository

👉 https://github.com/shahbaaz-devsec/shellgpt-kali-installer


🚀 What’s Next

I’m currently building:

👉 PentestGPT Kali Installer (AI-powered pentesting automation)


🏷 Tags

kaliLinux #devsecops #cybersecurity #linux #ai #automation #python #cli #infosec

Top comments (0)