Zero Security

Hacking and Penetration Testing Stuff

Hacking Write-ups Blog Posts View on GitHub
14 May 2025

Matrix Style Ai Powered Web Analysis Tool

by zero

In today’s digitally-driven world, the ability to quickly understand and analyze web content is invaluable. From security assessments to content summarization, the sheer volume of information on any given webpage can be overwhelming. That’s why I’m excited to introduce a project I’ve been passionately working on: the Web Screenshot Analysis Tool, an open-source application designed to dissect and interpret websites using a suite of cutting-edge AI technologies.

This tool isn’t just about taking a picture; it’s about extracting deep insights by combining web capture, Optical Character Recognition (OCR), advanced image captioning, and Large Language Model (LLM) powered security analysis.

Unveiling the Web Screenshot Analysis Tool: A Dive into AI-Powered Web Intelligence

What Can It Do? Core Features at a Glance

The Web Screenshot Analysis Tool offers a comprehensive pipeline for web content examination:

Peeking Under the Hood: Key Concepts and Technologies

This project stands on the shoulders of several fascinating AI and web technologies:

1. Playwright for Web Interaction

The first step is always capturing the webpage. Playwright is used for robust, headless browser automation. It navigates to the target URL, handles page loading intricacies, and captures a full-page screenshot. A key feature here is the attempt to identify and remove common ad selectors (like <iframe> tags or elements with classes like .ad, .adsbygoogle) before the screenshot is taken. This helps in focusing the subsequent analysis on the primary content of the page rather than peripheral advertisements.

2. Tesseract OCR for Text Recognition

Once an image is captured, Tesseract OCR comes into play. It processes the screenshot image and extracts any embedded text. This is crucial because much of the valuable information on a webpage is textual, even if presented within images or complex layouts.

3. BLIP Models for Image Understanding

Understanding the visual context of a webpage is as important as its text. For this, the tool integrates BLIP (Bootstrapping Language-Image Pre-training) models from Hugging Face Transformers. These models are capable of generating descriptive captions for images. For instance, given a screenshot, BLIP might generate a caption like “A news article page discussing cybersecurity vulnerabilities” or “A software repository page on GitHub.” This caption provides a high-level summary that complements the extracted OCR text. The tool supports various BLIP model sizes, allowing a trade-off between speed and caption detail.

4. LLMs and the MITRE ATT&CK Framework for Security Insights

The extracted OCR text and the BLIP-generated image caption are then combined to form a rich contextual input for a Large Language Model. The LLM is prompted with a specific system message, asking it to act as a cybersecurity analyst and to map any findings to the MITRE ATT&CK framework. This framework is a globally-accessible knowledge base of adversary tactics and techniques based on real-world observations. The LLM’s task is to identify: * Potential Tactics (the adversary’s technical goals, e.g., Initial Access, Execution). * Relevant Techniques (how those goals are achieved, e.g., Phishing, Command and Scripting Interpreter). * Mention of Tools or software that could be used in attacks.

The output is structured JSON, making it easy to parse and display, providing a preliminary security-oriented perspective on the webpage’s content.

5. FastAPI and WebSockets for a Reactive Experience

The backend is built with FastAPI, chosen for its high performance and ease of use in building APIs. For real-time progress updates during the multi-stage analysis pipeline (screenshotting, OCR, captioning, LLM analysis), WebSockets are used to communicate from the backend to the frontend, keeping the user informed.

Architecture Overview

The system is broadly divided into:

flowchart TD
    User[User via Web UI] -->|URL, Model Choices| API(FastAPI Backend)
    API -->|Initiate Analysis| PipelineManager(Pipeline Manager)
    
    subgraph AnalysisPipeline [Analysis Pipeline]
        direction LR
        PM_PS[1. Playwright Screenshot]
        PM_OCR[2. OCR Processing]
        PM_BLIP[3. BLIP Captioning]
        PM_MITRE[4. MITRE Prompt Gen]
        PM_LLM[5. LLM Analysis]
        
        PipelineManager --> PM_PS
        PM_PS --> PM_OCR
        PM_PS --> PM_BLIP
        PM_OCR --> PM_MITRE
        PM_BLIP --> PM_MITRE
        PM_MITRE --> PM_LLM
    end

    PipelineManager -->|Progress via WebSocket| User
    PM_LLM -->|Final Results| PipelineManager
    PipelineManager -->|Store Results| FileSystem[File System (JSON, images)]
    FileSystem -->|On Request /api/status/latest| API
    API -->|Display Results| User

Try It Out!

This project was a fantastic learning experience, blending web automation with various AI disciplines to create a tool that can offer quick, multi-faceted insights into web pages. It’s now open source, and I encourage you to explore the code, try it out, and perhaps even contribute!

You can find the project repository here: [Link to your Git Repository Here]

The README.md contains detailed setup and usage instructions. Whether you’re interested in web security, AI applications, or just curious about how these technologies can be combined, I hope you find this project as intriguing as I do.


([Optional: Add your matrix_web_analysis_1.png image here if desired for the blog post too] ![Project Screenshot](matrix_web_analysis_1.png))

tags: development - ai - llm - python