Skip to content

Details ‐ Analysis

Michael Haag edited this page Jul 23, 2024 · 1 revision

Analysis Page Documentation

The Analysis page is a crucial component of ShellSweepX, providing users with the ability to upload files for analysis, search through previously analyzed files, and view detailed results. This page combines file upload functionality with a comprehensive search and display system for analyzed files.

Page Structure

The analysis.html template is structured as follows:

  1. Header: Contains the ShellSweepX logo and navigation menu.
  2. Main Content:
    • File Upload Section
    • Upload Results Display
    • File Search Section
    • Search Results Display
    • Pagination Controls
  3. Footer: Displays copyright information and a link to Terms of Service.

Key Features

1. File Upload

  • Users can select multiple files for analysis.
  • The uploadFiles() function handles the file upload process:
    • Sends files to the server via a POST request to /upload.
    • Displays upload results in the upload-results div.

2. File Search

  • Users can search for analyzed files using a text input.
  • The searchFiles() function triggers the search:
    • Calls loadFiles() with the search query.
    • Results are fetched from the /search endpoint.

3. Results Display

  • The displayResults() function renders search results:
    • Each result shows file details including name, SHA256, analysis result, file size, entropy, etc.
    • Includes a link to VirusTotal for each file's SHA256.
    • Provides a button to trigger AI triage for each file.
    • Displays YARA matches if available.
    • Shows AI analysis in an expandable details section.
    • Includes an expandable section to view the file's content.

4. Pagination

  • The updatePagination() function handles pagination controls:
    • Displays current page and total pages.
    • Provides "Previous" and "Next" buttons when applicable.

5. AI Triage

  • The triageWithAI() function allows on-demand AI analysis of a file:
    • Sends a POST request to /triage_with_ai with the file's SHA256.
    • Updates the AI analysis section of the corresponding result item.

JavaScript Functions

  1. loadFiles(page, query): Fetches and displays search results.
  2. searchFiles(): Triggers a new search based on user input.
  3. displayResults(results): Renders search results in the UI.
  4. updatePagination(page, totalPages): Updates pagination controls.
  5. escapeHtml(unsafe): Sanitizes HTML content for safe display.
  6. uploadFiles(): Handles file upload process.
  7. displayUploadResults(result): Shows results of file uploads.
  8. triageWithAI(sha256): Requests and displays AI analysis for a specific file.

Styling

The page uses CSS styles defined in /static/css/styles.css for consistent styling across the application.

Security Considerations

  • File content is escaped using escapeHtml() to prevent XSS attacks.
  • File uploads are handled server-side, with results displayed after processing.

User Experience

  • The page loads all files on initial load, providing immediate access to recent analyses.
  • Search functionality allows quick filtering of results.
  • Pagination ensures manageable loading of large result sets.
  • Expandable sections (AI analysis and file content) keep the interface clean while allowing access to detailed information.

This Analysis page serves as a central hub for file analysis in ShellSweepX, combining upload capabilities with comprehensive result viewing and AI-powered triage.