#!/bin/bash # Test script to verify all required analysis tools are present # This tests the tools we specifically added to our original container echo "=== File Analysis Container Tool Test ===" echo "Testing for required tools..." echo FAILED_TOOLS=() PASSED_TOOLS=() # Function to test if a command exists and works test_tool() { local tool_name="$1" local test_command="$2" local expected_pattern="$3" echo -n "Testing $tool_name... " if command -v "${tool_name}" >/dev/null 2>&1; then if [ -n "$test_command" ]; then # Run the test command and check output if output=$(eval "$test_command" 2>&1) && [[ "$output" =~ $expected_pattern ]]; then echo "✓ PASS" PASSED_TOOLS+=("$tool_name") else echo "✗ FAIL (exists but test failed)" FAILED_TOOLS+=("$tool_name") fi else echo "✓ PASS" PASSED_TOOLS+=("$tool_name") fi else echo "✗ FAIL (not found)" FAILED_TOOLS+=("$tool_name") fi } # Test PDF Analysis Tools (our core tools) echo "--- PDF Analysis Tools ---" test_tool "pdfid.py" "pdfid.py 2>&1 | head -1" "PDFiD" test_tool "pdf-parser.py" "pdf-parser.py 2>&1 | head -1" "Usage" test_tool "peepdf" "peepdf --help 2>&1 | head -1" "" test_tool "pdftk" "pdftk --version 2>&1" "pdftk" # Test Ruby Origami suite echo "--- Ruby Origami Suite ---" test_tool "pdfcop" "pdfcop --version 2>/dev/null || pdfcop --help 2>&1 | head -1" "" test_tool "pdfextract" "pdfextract --version 2>/dev/null || pdfextract --help 2>&1 | head -1" "" test_tool "pdfmetadata" "pdfmetadata --version 2>/dev/null || pdfmetadata --help 2>&1 | head -1" "" # Test Malware Analysis Tools (our additions) echo "--- Malware Analysis Tools ---" test_tool "capa" "capa --version 2>&1" "capa" test_tool "box-js" "box-js --version 2>&1" "[0-9]" # Test Data Analysis Tools (our additions) echo "--- Data Analysis Tools ---" test_tool "vd" "visidata --version 2>&1" "" test_tool "unfurl_cli.py" "unfurl_cli.py --help 2>&1 | head -1" "usage" # Test File Format Tools echo "--- File Format Tools ---" test_tool "exiftool" "exiftool -ver 2>&1" "[0-9]" test_tool "catdoc" "catdoc -V 2>&1" "" test_tool "docx2txt" "docx2txt --version 2>/dev/null || echo 'docx2txt exists'" "" test_tool "unrtf" "unrtf --version 2>&1" "" # Test System Tools echo "--- System Tools ---" test_tool "mc" "mc --version 2>&1" "GNU Midnight Commander" test_tool "busybox" "busybox --help 2>&1 | head -1" "BusyBox" test_tool "7z" "7z 2>&1 | head -2 | tail -1" "7-Zip" # Test Python packages (oletools) - REMnux has these differently echo "--- Python Packages ---" test_tool "oledump.py" "oledump.py --help 2>&1 | head -1" "" test_tool "rtfdump.py" "rtfdump.py --help 2>&1 | head -1" "" test_tool "emldump.py" "emldump.py --help 2>&1 | head -1" "" # Summary echo echo "=== TEST SUMMARY ===" echo "Passed tools: ${#PASSED_TOOLS[@]}" echo "Failed tools: ${#FAILED_TOOLS[@]}" if [ ${#FAILED_TOOLS[@]} -gt 0 ]; then echo echo "FAILED TOOLS:" printf '%s\n' "${FAILED_TOOLS[@]}" echo echo "❌ Some tools are missing or not working properly" exit 1 else echo echo "✅ All tools are present and working!" exit 0 fi