https://github.com/saramazal/ghostshell
๐ GhostShell โ AI Pentesting Assistant GhostShell is a local AI-powered penetration testing assistant built with Node.js and Ollama. It analyzes scan results, suggests attack paths, and outputs real commands to accelerate your penetration testing workflow.
https://github.com/saramazal/ghostshell
ai-assistant ai-tools axios curl dig ethical-hacking ethical-hacking-tools ffuf javascript llama3 login mistral nmap nodejs ollama penetration-testing penetration-testing-framework penetration-testing-tools scanner whois
Last synced: 10 days ago
JSON representation
๐ GhostShell โ AI Pentesting Assistant GhostShell is a local AI-powered penetration testing assistant built with Node.js and Ollama. It analyzes scan results, suggests attack paths, and outputs real commands to accelerate your penetration testing workflow.
- Host: GitHub
- URL: https://github.com/saramazal/ghostshell
- Owner: saramazal
- Created: 2026-04-17T12:45:12.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-18T16:56:37.000Z (2 months ago)
- Last Synced: 2026-04-18T18:38:35.820Z (2 months ago)
- Topics: ai-assistant, ai-tools, axios, curl, dig, ethical-hacking, ethical-hacking-tools, ffuf, javascript, llama3, login, mistral, nmap, nodejs, ollama, penetration-testing, penetration-testing-framework, penetration-testing-tools, scanner, whois
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
* _project_in_progress_
# ๐ GhostShell โ AI Pentesting Assistant
GhostShell is a local AI-powered penetration testing assistant built with Node.js and Ollama.
It analyzes scan results, suggests attack paths, and outputs real commands to accelerate your penetration testing workflow.
---
## โ๏ธ Features
* ๐ง **AI-powered scan analysis** โ Uses Llama3 for deep analysis
* โ๏ธ **Attack path suggestions** โ Auto-detects exploit chains
* ๐ **Multi-model routing** โ Smart model selection (llama3 + mistral)
* ๐งพ **Persistent memory** โ RAG-based knowledge storage
* ๐ **Login detection** โ Identifies authentication endpoints
* ๐ป **Command generation** โ Outputs actionable exploitation commands
* ๐ง **Tool integration** โ nmap, ffuf, whois, dig, whatweb, curl
---
## ๐งฑ Tech Stack
* **Node.js** โ Runtime
* **Ollama** โ Local LLM inference engine
* **Llama3** โ Deep analysis model
* **Mistral** โ Fast task execution model
* **Axios** โ HTTP client for Ollama API
* **fs-extra** โ File utilities
---
## ๐ Quick Start
### 1. Install Ollama
Download from [ollama.ai](https://ollama.ai)
### 2. Pull models
```bash
ollama pull llama3
ollama pull mistral
```
### 3. Clone & setup
```bash
git clone https://github.com/saramazal/ghostshell
cd ghostshell
npm install
```
### 4. Start Ollama (in separate terminal)
```bash
ollama serve
```
### 5. Run GhostShell
```bash
node index.js 10.10.10.10 analysis
```
---
## ๐ Usage
### Option 1: Direct Node.js
**Analyze target directly:**
```bash
node index.js 10.10.10.10 analysis
```
**Analyze scan results file:**
```bash
node index.js scan.txt analysis
```
### Option 2: CLI (Global Install)
**Install as global command:**
```bash
npm install -g .
```
**Use anywhere:**
```bash
ghostshell scan 10.10.10.10
ghostshell recon 192.168.1.1
```
### Option 3: Direct Node CLI
**Without global install:**
```bash
node cli.js scan 10.10.10.10
node cli.js recon 192.168.1.1
```
---
## ๐ Project Structure
```
ghostshell/
โโโ index.js # Main entry point
โโโ cli.js # CLI interface (#!/usr/bin/env node)
โโโ agent.js # AI agent orchestration
โโโ package.json # Dependencies & bin config
โโโ scan.txt # Sample scan file
โโโ memory/
โ โโโ history.json # Execution history
โ โโโ ragStore.js # RAG memory persistence
โโโ tools/
โโโ runTool.js # Tool executor
โโโ analyzer.js # Generic analyzer
โโโ nmap.js # Port scanning
โโโ ffuf.js # Web fuzzing
โโโ whois.js # Domain WHOIS lookup
โโโ dig.js # DNS queries
โโโ whatweb.js # Web fingerprinting
โโโ curl_headers.js # HTTP header analysis
โโโ exploitPlanner.js # Exploit chain builder
โโโ parsers/
โโโ ffufParser.js # Parse ffuf output
โโโ loginDetector.js # Detect login forms
```
---
## ๐ฏ How It Works
1. **Input** โ Target IP or scan file
2. **Recon Planning** โ Mistral AI selects relevant tools
3. **Tool Execution** โ Runs whois, dig, nmap, ffuf, whatweb, etc.
4. **Intel Gathering** โ Detects logins, parses results
5. **Analysis** โ Llama3 deep analysis of findings
6. **Exploitation** โ Suggests attack chains and commands
7. **Memory** โ Saves results for future reference (RAG)
---
## โ๏ธ Configuration
### Choose LLM Models
Edit `agent.js` `chooseModel()` function:
```javascript
function chooseModel(taskType, inputLength) {
if (taskType === "analysis") return "llama3";
return inputLength > 1500 ? "llama3" : "mistral";
}
```
### Ollama API Endpoint
Edit `agent.js` `queryOllama()` function:
```javascript
async function queryOllama(model, prompt) {
const res = await axios.post("http://localhost:11434/api/generate", {
model,
prompt,
stream: false
});
return res.data.response;
}
```
---
## ๐ง Troubleshooting
### โ `Error: connect ECONNREFUSED localhost:11434`
**Problem:** Ollama is not running
**Solution:**
```bash
ollama serve
```
### โ `Model not found: llama3`
**Problem:** Model not downloaded
**Solution:**
```bash
ollama pull llama3
ollama pull mistral
```
### โ `JSON parse failed`
**Problem:** Corrupted memory file
**Solution:**
```bash
rm memory/rag.json
rm memory/history.json
```
---
## ๐ Memory System
GhostShell learns from past scans using RAG (Retrieval Augmented Generation):
- **rag.json** โ Stores all discovered intelligence
- **history.json** โ Logs all executions with timestamps
Query past knowledge:
```javascript
const { searchMemory } = require("./memory/ragStore");
const past = searchMemory("10.10.10.10");
```
---
## ๐ ๏ธ Development
### Run tests
```bash
npm test
```
### Debug mode
```bash
DEBUG=* node index.js 10.10.10.10 analysis
```
### Check history
```bash
cat memory/history.json | jq .
```
---
## โ ๏ธ Legal Notice
GhostShell is for **authorized security testing only**. Unauthorized access to computer systems is illegal. Always obtain written permission before running penetration tests.
---
## ๐ License
ISC
---
## ๐ค Contributing
Contributions welcome! Feel free to:
- Add new reconnaissance tools
- Improve AI prompts
- Enhance memory system
- Fix bugs
Open a PR! ๐