The Analyzer v1.0 — autonomous bug bounty engine with 20 attack vectors and Ollama brain

This commit is contained in:
drjones
2026-06-19 06:11:40 -07:00
commit eb1fad4ecc
28 changed files with 2501 additions and 0 deletions

123
lib/colors.sh Executable file
View File

@@ -0,0 +1,123 @@
#!/usr/bin/env bash
# The Analyzer - Terminal Colors & UI
# Reset
export NC='\033[0m'
# Foreground
export BLACK='\033[0;30m'
export RED='\033[0;31m'
export GREEN='\033[0;32m'
export YELLOW='\033[0;33m'
export BLUE='\033[0;34m'
export MAGENTA='\033[0;35m'
export CYAN='\033[0;36m'
export WHITE='\033[0;37m'
export BOLD='\033[1m'
export DIM='\033[2m'
# Bright
export BRIGHT_RED='\033[0;91m'
export BRIGHT_GREEN='\033[0;92m'
export BRIGHT_YELLOW='\033[0;93m'
export BRIGHT_BLUE='\033[0;94m'
export BRIGHT_MAGENTA='\033[0;95m'
export BRIGHT_CYAN='\033[0;96m'
# Icons
export ICON_TARGET="🎯"
export ICON_SCAN="🔍"
export ICON_FIRE="🔥"
export ICON_FOUND="💥"
export ICON_SAFE="✅"
export ICON_WARN="⚠️"
export ICON_SKIP="⏭️"
export ICON_DONE="✨"
export ICON_BRAIN="🧠"
export ICON_REPORT="📄"
export ICON_ERROR="❌"
export ICON_INFO=""
export ICON_ARROW="➜"
export ICON_SQL="🗄️"
export ICON_XSS="💉"
export ICON_API="🔌"
export ICON_GEAR="⚙️"
# Print helpers
print_banner() {
TERM="${TERM:-xterm}" clear 2>/dev/null; true
echo -e "${BRIGHT_RED}"
echo '┌──────────────────────────────────────────────┐'
echo '│ │'
echo '│ ████████╗██╗ ██╗███████╗ │'
echo '│ ╚══██╔══╝██║ ██║██╔════╝ │'
echo '│ ██║ ███████║█████╗ │'
echo '│ ██║ ██╔══██║██╔══╝ │'
echo '│ ██║ ██║ ██║███████╗ │'
echo '│ ╚═╝ ╚═╝ ╚═╝╚══════╝ │'
echo '│ │'
echo '│ ╔══════════════════════════════════════╗ │'
echo '│ ║ AUTONOMOUS ANALYZER v1.0 ║ │'
echo '│ ╚══════════════════════════════════════╝ │'
echo '│ │'
echo '│ Authorized Bug Bounty Use Only │'
echo '│ Drjonesxxx / Indianaholmes │'
echo '└──────────────────────────────────────────────┘'
echo -e "${NC}"
}
print_step() {
echo -e "\n${CYAN}${ICON_GEAR} [${1}/${2}] ${3}${NC}"
echo -e "${DIM}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
}
print_sub() {
echo -e " ${ICON_ARROW} ${DIM}${1}${NC}"
}
print_ok() {
echo -e " ${GREEN}${ICON_SAFE} ${1}${NC}"
}
print_find() {
echo -e " ${BRIGHT_RED}${ICON_FOUND} ${BOLD}${1}${NC}"
if [ -n "${2:-}" ]; then echo -e " ${YELLOW} Details: ${2}${NC}"; fi
}
print_warn() {
echo -e " ${YELLOW}${ICON_WARN} ${1}${NC}"
}
print_skip() {
echo -e " ${DIM}${ICON_SKIP} ${1}${NC}"
}
print_error() {
echo -e " ${BRIGHT_RED}${ICON_ERROR} ${1}${NC}"
if [ -n "${2:-}" ]; then echo -e " ${RED} ${2}${NC}"; fi
}
print_info() {
echo -e " ${BRIGHT_BLUE}${ICON_INFO} ${1}${NC}"
}
print_brain() {
echo -e " ${MAGENTA}${ICON_BRAIN} ${1}${NC}"
}
spinner() {
local pid=$1
local msg=$2
local spin='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
local i=0
while kill -0 $pid 2>/dev/null; do
i=$(( (i+1) % ${#spin} ))
printf "\r ${CYAN}${spin:$i:1}${NC} ${msg} "
sleep 0.1
done
printf "\r ${GREEN}${ICON_DONE}${NC} ${msg} \n"
}
separator() {
echo -e "${DIM}──────────────────────────────────────────────${NC}"
}

213
lib/utils.sh Executable file
View File

@@ -0,0 +1,213 @@
#!/usr/bin/env bash
# The Analyzer - Shared Utilities
# Load colors
__UTILS_SRC="${BASH_SOURCE[0]}"
if command -v readlink &>/dev/null; then
while [ -h "$__UTILS_SRC" ]; do
__UTILS_SRC="$(readlink "$__UTILS_SRC")"
[[ "$__UTILS_SRC" != /* ]] && __UTILS_SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$__UTILS_SRC"
done
fi
SCRIPT_DIR="$(cd "$(dirname "$__UTILS_SRC")" && pwd 2>/dev/null)" || SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
unset __UTILS_SRC
source "$SCRIPT_DIR/colors.sh"
# Config
export ANALYZER_DIR="$SCRIPT_DIR/.."
export VECTORS_DIR="$ANALYZER_DIR/vectors"
export REPORTS_DIR="$ANALYZER_DIR/reports"
export ENGINE_DIR="$ANALYZER_DIR/engine"
export TIMEOUT=30
export MAX_VECTORS=10
export OLLAMA_HOST="${OLLAMA_HOST:-http://10.30.20.110:11434}"
export OLLAMA_MODEL="${OLLAMA_MODEL:-granite4.1:8b}"
# Check dependencies
check_deps() {
local missing=()
for cmd in curl jq; do
if ! command -v $cmd &>/dev/null; then
missing+=("$cmd")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
print_error "Missing dependencies: ${missing[*]}"
print_info "Install: apt install ${missing[*]}"
exit 1
fi
}
# Check Ollama is running
check_ollama() {
if ! curl -s "$OLLAMA_HOST/api/tags" >/dev/null 2>&1; then
print_error "Ollama not running at $OLLAMA_HOST"
print_info "Start it: ollama serve"
return 1
fi
print_ok "Ollama connected ($OLLAMA_HOST)"
return 0
}
# Call Ollama with a prompt, return response
ollama_prompt() {
local prompt="$1"
local system="$2"
local model="${3:-$OLLAMA_MODEL}"
local payload=$(jq -n \
--arg model "$model" \
--arg prompt "$prompt" \
--arg system "$system" \
'{
model: $model,
prompt: $prompt,
system: $system,
stream: false,
options: {
temperature: 0.2,
num_predict: 2048
}
}')
local response=$(curl -s "$OLLAMA_HOST/api/generate" \
-H "Content-Type: application/json" \
-d "$payload" 2>/dev/null)
echo "$response" | jq -r '.response // "ERROR: No response"' 2>/dev/null
}
# Sanitize URL for filenames
sanitize() {
echo "$1" | sed 's|https\?://||' | sed 's|/|_|g' | sed 's|[^a-zA-Z0-9._-]|_|g'
}
# Extract domain from URL
get_domain() {
echo "$1" | sed 's|https\?://||' | cut -d/ -f1 | cut -d: -f1
}
# Extract base URL (protocol + domain)
get_base() {
echo "$1" | sed 's|\(https\?://[^/]*\).*|\1|'
}
# Quick HTTP check
http_check() {
local url="$1"
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "$url" 2>/dev/null
}
# Get response headers
get_headers() {
local url="$1"
curl -sI --connect-timeout 5 --max-time 10 "$url" 2>/dev/null
}
# Get page title
get_title() {
local url="$1"
curl -s --connect-timeout 5 --max-time 10 "$url" 2>/dev/null | sed -n 's/.*<title>\([^<]*\)<\/title>.*/\1/p' | sed 's/<[^>]*>//g' | head -1
}
# Check if target is alive
target_alive() {
local code=$(http_check "$1")
[[ "$code" =~ ^[23] ]] && return 0
return 1
}
# Run a command with timeout, return output
run_timeout() {
local cmd="$1"
local timeout="${2:-$TIMEOUT}"
timeout $timeout bash -c "$cmd" 2>/dev/null || echo "TIMEOUT_OR_ERROR"
}
# Colorize severity
severity_color() {
case "$1" in
critical|CRITICAL) echo -e "${BRIGHT_RED}${BOLD}CRITICAL${NC}" ;;
high|HIGH) echo -e "${RED}${BOLD}HIGH${NC}" ;;
medium|MEDIUM) echo -e "${YELLOW}${BOLD}MEDIUM${NC}" ;;
low|LOW) echo -e "${BLUE}${BOLD}LOW${NC}" ;;
info|INFO) echo -e "${DIM}INFO${NC}" ;;
*) echo -e "${DIM}$1${NC}" ;;
esac
}
# Create report header
init_report() {
local target="$1"
local domain=$(get_domain "$target")
local ts=$(date '+%Y-%m-%d_%H%M%S')
local report_file="$REPORTS_DIR/${domain}_${ts}.md"
cat > "$report_file" << EOF
# The Analyzer Report
**Target:** $target
**Domain:** $domain
**Date:** $(date '+%Y-%m-%d %H:%M:%S')
**Analyst:** The Analyzer v1.0
**Status:** In Progress
---
## Reconnaissance
EOF
echo "$report_file"
}
# Append to report
append_report() {
local report="$1"
local content="$2"
echo -e "$content" >> "$report"
}
# Finalize report
finalize_report() {
local report="$1"
local find_count="$2"
local vuln_count="$3"
local ts=$(date '+%Y-%m-%d %H:%M:%S')
cat >> "$report" << EOF
---
## Summary
- **Total Findings:** $find_count
- **Vulnerabilities:** $vuln_count
- **Completed:** $ts
- **Status:** Complete
---
*Generated by The Analyzer v1.0 — Authorized Bug Bounty Use Only*
EOF
echo "$report"
}
# List available vector modules
list_vectors() {
echo -e "${BOLD}Available Attack Vectors:${NC}"
echo ""
for f in "$VECTORS_DIR"/*.sh; do
local name=$(basename "$f" .sh)
local desc=$(head -5 "$f" | grep "^# Desc:" | sed 's/^# Desc: //')
local num=$(echo "$name" | cut -d- -f1)
printf " ${CYAN}[%02d]${NC} %-30s %s\n" "$num" "${name#?-}" "$desc"
done
}
# User prompt with default
prompt_default() {
local msg="$1"
local default="$2"
read -p " ${ICON_ARROW} $msg [$default]: " input
echo "${input:-$default}"
}