Files
docker_file_analysis/test-streamlined-help.sh
Tobias Kessels b98aaee3e0 Major repository cleanup and enhancement
- Reorganize documentation: moved old docs to docs/ directory
- Add comprehensive README.md with build options and usage guide
- Add detailed CONTRIBUTING.md with help content management guide
- Create Makefile for automated building and testing
- Add Dockerfile.scratch for building from Ubuntu 20.04 base
- Enhance all Dockerfiles with PowerShell + PSScriptAnalyzer
- Add modern shells: zsh (with plugins) and fish (with config)
- Add modern CLI tools: fd-find, ripgrep, fzf
- Create comprehensive help system with cheat/TLDR/fish completions
- Add helper scripts for help content management and coverage checking
- Fix Dockerfile.remnux script references
- Support three build variants: upstream (REMnux), scratch (Ubuntu), kali

Build options:
  - make build-upstream: Fast, uses REMnux upstream (recommended)
  - make build-scratch: Full control, builds from Ubuntu 20.04
  - make build-kali: Legacy Kali Linux base

Features:
  - PowerShell with PSScriptAnalyzer module
  - Modern shells (zsh, fish) with custom configurations
  - Enhanced help system (cheat sheets, TLDR pages, fish completions)
  - Help coverage checking and bulk import tools
  - Comprehensive documentation for users and contributors
2025-10-01 11:45:56 +02:00

166 lines
5.0 KiB
Bash
Executable File

#!/bin/bash
# Test script for streamlined help system (tldr + cheat, no navi)
echo "🧪 Testing Streamlined Help System (TLDR + Cheat)"
echo "================================================="
echo ""
# Build the container
echo "🏗️ Building streamlined container..."
docker build -f Dockerfile.remnux -t tabledevil/file-analysis:streamlined . || {
echo "❌ Container build failed!"
exit 1
}
echo "✅ Container built successfully"
echo ""
# Test basic help functions
echo "📋 Testing basic help functions..."
# Test 1: Main help
echo " • Testing main help..."
docker run --rm tabledevil/file-analysis:streamlined fhelp | head -10 | grep -q "File Analysis Container Help System" && {
echo " ✅ Main help works"
} || {
echo " ❌ Main help failed"
}
# Test 2: PDF workflow
echo " • Testing PDF workflow..."
docker run --rm tabledevil/file-analysis:streamlined fhelp pdf | grep -q "pdfid.py" && {
echo " ✅ PDF workflow works"
} || {
echo " ❌ PDF workflow failed"
}
# Test 3: Malware workflow
echo " • Testing malware workflow..."
docker run --rm tabledevil/file-analysis:streamlined fhelp malware | grep -q "capa" && {
echo " ✅ Malware workflow works"
} || {
echo " ❌ Malware workflow failed"
}
# Test 4: Examples listing
echo " • Testing examples listing..."
docker run --rm tabledevil/file-analysis:streamlined fhelp examples | grep -q "pdfid" && {
echo " ✅ Examples listing works"
} || {
echo " ❌ Examples listing failed"
}
echo ""
# Test fhelp cheat functionality
echo "📋 Testing fhelp cheat sheets..."
CHEAT_TOOLS=("pdfid" "pdf-parser" "pdftk" "capa" "tar")
for tool in "${CHEAT_TOOLS[@]}"; do
echo " • Testing fhelp cheat $tool..."
docker run --rm tabledevil/file-analysis:streamlined fhelp cheat "$tool" 2>/dev/null | head -5 | grep -q "Cheat Sheet" && {
echo " ✅ fhelp cheat $tool works"
} || {
echo " ❌ fhelp cheat $tool failed"
}
done
echo ""
# Test TLDR functionality
echo "📖 Testing TLDR functionality..."
echo " • Testing standard tldr (tar)..."
docker run --rm tabledevil/file-analysis:streamlined bash -c "export HOME=/home/remnux && tldr tar" 2>/dev/null | head -5 | grep -q "tar" && {
echo " ✅ Standard tldr works"
} || {
echo " ❌ Standard tldr failed"
}
# Test custom analysis tools TLDR pages
TLDR_TOOLS=("pdfid.py" "capa" "peepdf")
for tool in "${TLDR_TOOLS[@]}"; do
echo " • Testing tldr $tool..."
docker run --rm tabledevil/file-analysis:streamlined bash -c "export HOME=/home/remnux && tldr '$tool'" 2>/dev/null | head -5 | grep -q "$tool" && {
echo " ✅ tldr $tool works"
} || {
echo " ❌ tldr $tool failed"
}
done
echo ""
# Test tool availability
echo "🛠️ Testing analysis tools availability..."
TOOLS=("pdfid.py" "pdf-parser.py" "peepdf" "pdftk" "capa" "strings" "exiftool" "file")
for tool in "${TOOLS[@]}"; do
echo " • Testing $tool availability..."
docker run --rm tabledevil/file-analysis:streamlined bash -c "command -v '$tool' >/dev/null 2>&1" && {
echo "$tool available"
} || {
echo "$tool not found"
}
done
echo ""
# Test file structure
echo "📁 Testing help system file structure..."
FILES=(
"/opt/remnux-docs/tools.db"
"/opt/cheatsheets/personal/pdfid"
"/opt/cheatsheets/personal/pdf-analysis"
"/home/remnux/.local/share/tldr/pages/common/pdfid.py.md"
"/usr/local/bin/fhelp"
"/usr/local/bin/find-tool"
)
for file in "${FILES[@]}"; do
echo " • Testing $file..."
docker run --rm tabledevil/file-analysis:streamlined test -f "$file" && {
echo "$file exists"
} || {
echo "$file missing"
}
done
echo ""
# Test offline capabilities
echo "🔌 Testing offline capabilities..."
echo " • Testing fhelp --offline..."
docker run --rm tabledevil/file-analysis:streamlined fhelp --offline | grep -q "Offline help system ready" && {
echo " ✅ Offline status check works"
} || {
echo " ❌ Offline status check failed"
}
echo ""
# Summary
echo "📊 Resource Summary:"
docker run --rm tabledevil/file-analysis:streamlined bash -c "
echo ' Cheat sheets:' \$(find /opt/cheatsheets/personal -type f 2>/dev/null | wc -l)
echo ' TLDR pages:' \$(find /home/remnux/.local/share/tldr/pages/common -name '*.md' 2>/dev/null | wc -l)
echo ' Analysis tools in PATH:' \$(echo 'pdfid.py pdf-parser.py peepdf pdftk capa' | tr ' ' '\n' | xargs -I {} sh -c 'command -v {} >/dev/null && echo found' | wc -l)
"
echo ""
echo "🎯 Interactive Test Available:"
echo " Run: docker run -it tabledevil/file-analysis:streamlined"
echo " Then try:"
echo " fhelp # Main help"
echo " fhelp cheat pdfid # pdfid.py cheat sheet"
echo " tldr capa # capa quick reference (if working)"
echo " fhelp examples # List all available help"
echo ""
echo "🏁 Streamlined help system testing complete!"
echo " Review results above - navi removed, focusing on tldr + cheat reliability"