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)