#!/bin/bash # Test script for enhanced help system # This validates that all help components work correctly echo "๐Ÿงช Testing Enhanced Help System" echo "===============================" echo "" # Build the container first echo "๐Ÿ—๏ธ Building container with enhanced help system..." docker build -f Dockerfile.remnux -t tabledevil/file-analysis:enhanced . || { 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:enhanced fhelp | head -10 | grep -q "File Analysis Container Help System" && { echo " โœ… Main help works" } || { echo " โŒ Main help failed" } # Test 2: Tools search echo " โ€ข Testing tools search..." docker run --rm tabledevil/file-analysis:enhanced fhelp tools pdf 2>/dev/null | head -20 | grep -q "PDF" && { echo " โœ… Tools search works" } || { echo " โŒ Tools search failed" } # Test 3: PDF workflow echo " โ€ข Testing PDF workflow..." docker run --rm tabledevil/file-analysis:enhanced fhelp pdf | grep -q "pdfid.py" && { echo " โœ… PDF workflow works" } || { echo " โŒ PDF workflow failed" } # Test 4: Malware workflow echo " โ€ข Testing malware workflow..." docker run --rm tabledevil/file-analysis:enhanced fhelp malware | grep -q "capa" && { echo " โœ… Malware workflow works" } || { echo " โŒ Malware workflow failed" } # Test 5: Cheat sheets echo " โ€ข Testing cheat sheets..." docker run --rm tabledevil/file-analysis:enhanced fhelp cheat pdf | grep -q "pdfid.py" && { echo " โœ… Cheat sheets work" } || { echo " โŒ Cheat sheets failed" } # Test 6: Quick examples (tldr) echo " โ€ข Testing tldr integration..." docker run --rm tabledevil/file-analysis:enhanced fhelp quick tar 2>/dev/null | head -20 | grep -q "tar" && { echo " โœ… TLDR integration works" } || { echo " โŒ TLDR integration failed" } # Test 7: Offline status echo " โ€ข Testing offline status check..." docker run --rm tabledevil/file-analysis:enhanced fhelp --offline | grep -q "Offline help system ready" && { echo " โœ… Offline status works" } || { echo " โŒ Offline status failed" } echo "" # Test individual help tools echo "๐Ÿ”ง Testing individual help tools..." # Test find-tool echo " โ€ข Testing find-tool..." docker run --rm tabledevil/file-analysis:enhanced find-tool pdf 2>/dev/null | head -20 | grep -q "PDF" && { echo " โœ… find-tool works" } || { echo " โŒ find-tool failed" } # Test fhelp cheat command (internal implementation) echo " โ€ข Testing fhelp cheat command..." docker run --rm tabledevil/file-analysis:enhanced fhelp cheat tar 2>/dev/null | head -20 | grep -q "tar" && { echo " โœ… fhelp cheat command works" } || { echo " โŒ fhelp cheat command failed" } # Test tldr command echo " โ€ข Testing tldr command..." docker run --rm tabledevil/file-analysis:enhanced tldr tar 2>/dev/null | head -20 | grep -q "tar" && { echo " โœ… tldr command works" } || { echo " โŒ tldr command failed" } # Test navi (just check if it exists and doesn't crash immediately) echo " โ€ข Testing navi availability..." docker run --rm tabledevil/file-analysis:enhanced bash -c "command -v navi && echo 'navi available'" | grep -q "navi available" && { echo " โœ… navi is available" } || { echo " โŒ navi not available" } echo "" # Test actual analysis tools mentioned in help 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..." docker run --rm tabledevil/file-analysis:enhanced 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/pdf-analysis.cheat" "/opt/cheatsheets/malware-analysis.cheat" "/opt/navi-cheats/pdf-analysis.cheat" "/usr/local/bin/fhelp" "/usr/local/bin/find-tool" ) for file in "${FILES[@]}"; do echo " โ€ข Testing $file..." docker run --rm tabledevil/file-analysis:enhanced test -f "$file" && { echo " โœ… $file exists" } || { echo " โŒ $file missing" } done echo "" # Interactive test (requires manual validation) echo "๐ŸŽฏ Manual Test Available:" echo " Run: docker run -it tabledevil/file-analysis:enhanced" echo " Then try: fhelp, fhelp tools pdf, fhelp examples, etc." echo "" echo "๐Ÿ Help system testing complete!" echo " Review the results above to ensure all components work correctly."