mirror of
https://github.com/GH05TCREW/pentestagent.git
synced 2026-03-07 14:23:20 +00:00
refactor: overhaul codebase for v0.2.0
This commit is contained in:
74
scripts/run.sh
Normal file
74
scripts/run.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# GhostCrew Run Script
|
||||
|
||||
set -e
|
||||
|
||||
# Activate virtual environment if exists
|
||||
if [ -d "venv" ]; then
|
||||
source venv/bin/activate
|
||||
fi
|
||||
|
||||
# Load environment variables
|
||||
if [ -f ".env" ]; then
|
||||
export $(grep -v '^#' .env | xargs)
|
||||
fi
|
||||
|
||||
# Parse arguments
|
||||
MODE="cli"
|
||||
TARGET=""
|
||||
VPN_CONFIG=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--tui)
|
||||
MODE="tui"
|
||||
shift
|
||||
;;
|
||||
--target)
|
||||
TARGET="$2"
|
||||
shift 2
|
||||
;;
|
||||
--vpn)
|
||||
VPN_CONFIG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--help)
|
||||
echo "GhostCrew - AI Penetration Testing"
|
||||
echo ""
|
||||
echo "Usage: run.sh [options]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --tui Run in TUI mode"
|
||||
echo " --target <url> Set initial target"
|
||||
echo " --vpn <config> Connect to VPN before starting"
|
||||
echo " --help Show this help message"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Connect to VPN if specified
|
||||
if [ -n "$VPN_CONFIG" ]; then
|
||||
echo "Connecting to VPN..."
|
||||
sudo openvpn --config "$VPN_CONFIG" --daemon
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
# Build command
|
||||
CMD="python -m ghostcrew"
|
||||
|
||||
if [ "$MODE" = "tui" ]; then
|
||||
CMD="$CMD --tui"
|
||||
fi
|
||||
|
||||
if [ -n "$TARGET" ]; then
|
||||
CMD="$CMD --target $TARGET"
|
||||
fi
|
||||
|
||||
# Run GhostCrew
|
||||
echo "Starting GhostCrew..."
|
||||
$CMD
|
||||
89
scripts/setup.ps1
Normal file
89
scripts/setup.ps1
Normal file
@@ -0,0 +1,89 @@
|
||||
# GhostCrew PowerShell Setup Script
|
||||
|
||||
Write-Host "GhostCrew Setup" -ForegroundColor Blue
|
||||
Write-Host "AI Penetration Testing" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# Check Python version
|
||||
Write-Host "Checking Python version..." -ForegroundColor Yellow
|
||||
try {
|
||||
$pythonVersion = python --version 2>&1
|
||||
if ($pythonVersion -match "Python (\d+)\.(\d+)") {
|
||||
$major = [int]$Matches[1]
|
||||
$minor = [int]$Matches[2]
|
||||
if ($major -lt 3 -or ($major -eq 3 -and $minor -lt 10)) {
|
||||
Write-Host "Error: Python 3.10 or higher is required" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "[OK] $pythonVersion" -ForegroundColor Green
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error: Python not found. Please install Python 3.10+" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Create virtual environment
|
||||
Write-Host "Creating virtual environment..." -ForegroundColor Yellow
|
||||
if (-not (Test-Path "venv")) {
|
||||
python -m venv venv
|
||||
Write-Host "[OK] Virtual environment created" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[OK] Virtual environment exists" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Activate virtual environment
|
||||
Write-Host "Activating virtual environment..." -ForegroundColor Yellow
|
||||
& .\venv\Scripts\Activate.ps1
|
||||
|
||||
# Upgrade pip
|
||||
Write-Host "Upgrading pip..." -ForegroundColor Yellow
|
||||
pip install --upgrade pip
|
||||
|
||||
# Install dependencies
|
||||
Write-Host "Installing dependencies..." -ForegroundColor Yellow
|
||||
pip install -e ".[all]"
|
||||
Write-Host "[OK] Dependencies installed" -ForegroundColor Green
|
||||
|
||||
# Install playwright browsers
|
||||
Write-Host "Installing Playwright browsers..." -ForegroundColor Yellow
|
||||
playwright install chromium
|
||||
Write-Host "[OK] Playwright browsers installed" -ForegroundColor Green
|
||||
|
||||
# Create .env file if not exists
|
||||
if (-not (Test-Path ".env")) {
|
||||
Write-Host "Creating .env file..." -ForegroundColor Yellow
|
||||
@"
|
||||
# GhostCrew Configuration
|
||||
# Add your API keys here
|
||||
|
||||
# OpenAI API Key (required for GPT models)
|
||||
OPENAI_API_KEY=
|
||||
|
||||
# Anthropic API Key (required for Claude models)
|
||||
ANTHROPIC_API_KEY=
|
||||
|
||||
# Model Configuration
|
||||
GHOSTCREW_MODEL=gpt-5
|
||||
|
||||
# Debug Mode
|
||||
GHOSTCREW_DEBUG=false
|
||||
|
||||
# Max Iterations
|
||||
GHOSTCREW_MAX_ITERATIONS=50
|
||||
"@ | Set-Content -Path ".env" -Encoding UTF8
|
||||
Write-Host "[OK] .env file created" -ForegroundColor Green
|
||||
Write-Host "[!] Please edit .env and add your API keys" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Create loot directory for reports
|
||||
New-Item -ItemType Directory -Force -Path "loot" | Out-Null
|
||||
Write-Host "[OK] Loot directory created" -ForegroundColor Green
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Setup complete!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "To get started:"
|
||||
Write-Host " 1. Edit .env and add your API keys"
|
||||
Write-Host " 2. Activate: .\venv\Scripts\Activate.ps1"
|
||||
Write-Host " 3. Run: ghostcrew or python -m ghostcrew"
|
||||
Write-Host ""
|
||||
97
scripts/setup.sh
Normal file
97
scripts/setup.sh
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
# GhostCrew Setup Script
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}GhostCrew${NC} - AI Penetration Testing"
|
||||
echo ""
|
||||
|
||||
# Check Python version
|
||||
echo -e "${YELLOW}Checking Python version...${NC}"
|
||||
python_version=$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||
required_version="3.10"
|
||||
|
||||
if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" != "$required_version" ]; then
|
||||
echo -e "${RED}Error: Python $required_version or higher is required (found $python_version)${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✓ Python $python_version${NC}"
|
||||
|
||||
# Create virtual environment
|
||||
echo -e "${YELLOW}Creating virtual environment...${NC}"
|
||||
if [ ! -d "venv" ]; then
|
||||
python3 -m venv venv
|
||||
echo -e "${GREEN}✓ Virtual environment created${NC}"
|
||||
else
|
||||
echo -e "${GREEN}✓ Virtual environment exists${NC}"
|
||||
fi
|
||||
|
||||
# Activate virtual environment
|
||||
echo -e "${YELLOW}Activating virtual environment...${NC}"
|
||||
source venv/bin/activate
|
||||
|
||||
# Upgrade pip
|
||||
echo -e "${YELLOW}Upgrading pip...${NC}"
|
||||
pip install --upgrade pip
|
||||
|
||||
# Install dependencies
|
||||
echo -e "${YELLOW}Installing dependencies...${NC}"
|
||||
pip install -e ".[all]"
|
||||
echo -e "${GREEN}✓ Dependencies installed${NC}"
|
||||
|
||||
# Install playwright browsers
|
||||
echo -e "${YELLOW}Installing Playwright browsers...${NC}"
|
||||
playwright install chromium
|
||||
echo -e "${GREEN}✓ Playwright browsers installed${NC}"
|
||||
|
||||
# Create .env file if not exists
|
||||
if [ ! -f ".env" ]; then
|
||||
echo -e "${YELLOW}Creating .env file...${NC}"
|
||||
cat > .env << EOF
|
||||
# GhostCrew Configuration
|
||||
# Add your API keys here
|
||||
|
||||
# OpenAI API Key (required for GPT models)
|
||||
OPENAI_API_KEY=
|
||||
|
||||
# Anthropic API Key (required for Claude models)
|
||||
ANTHROPIC_API_KEY=
|
||||
|
||||
# Model Configuration
|
||||
GHOSTCREW_MODEL=gpt-5
|
||||
|
||||
# Debug Mode
|
||||
GHOSTCREW_DEBUG=false
|
||||
|
||||
# Max Iterations
|
||||
GHOSTCREW_MAX_ITERATIONS=50
|
||||
EOF
|
||||
echo -e "${GREEN}✓ .env file created${NC}"
|
||||
echo -e "${YELLOW}⚠️ Please edit .env and add your API keys${NC}"
|
||||
fi
|
||||
|
||||
# Create loot directory for reports
|
||||
mkdir -p loot
|
||||
echo -e "${GREEN}✓ Loot directory created${NC}"
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${GREEN}Setup complete!${NC}"
|
||||
echo ""
|
||||
echo -e "To get started:"
|
||||
echo -e " 1. Edit ${YELLOW}.env${NC} and add your API keys"
|
||||
echo -e " 2. Activate the virtual environment: ${YELLOW}source venv/bin/activate${NC}"
|
||||
echo -e " 3. Run GhostCrew: ${YELLOW}ghostcrew${NC} or ${YELLOW}python -m ghostcrew${NC}"
|
||||
echo ""
|
||||
echo -e "For Docker usage:"
|
||||
echo -e " ${YELLOW}docker-compose up ghostcrew${NC}"
|
||||
echo -e " ${YELLOW}docker-compose --profile kali up ghostcrew-kali${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
Reference in New Issue
Block a user