# hyldem0er/skirnir architecture

> Architecture diagram of the GitHub repository hyldem0er/skirnir, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hyldem0er/skirnir
- Repository: https://github.com/hyldem0er/skirnir

## Overview

##### Project Type & Purpose
- Skirnir is an OSINT tool designed to perform both “surface crawl” (broad Google queries with various combinations of names and nicknames) and “deepcrawl” (more exhaustive searches using hundreds/thousands of generated nicknames).
- It supports scraping popular social networks (Instagram, Twitter, TikTok, etc.) and has both a graphical user interface (GUI) and a CLI for advanced users.
- Additional functionalities include proxy management, query generation, relevance sorting, and a comprehensive scraping framework.

##### Analyzing the File Structure
- Top-Level Files/Folders:
– Files like main.py and requirements.txt indicate Python-based execution.
– The data folder contains mapping files (CSV and XLSX) and probably images (for the UI logo) used across the tool.
– The launcher scripts for Linux and Windows simplify starting the application.
- Key Directories & Their Roles:
a. src/generator:
– Contains scripts generating various names, dates, and pseudonyms to support the “deepcrawl” functionality.
b. src/relevance:
– Holds logic for sorting results by relevance, an essential part of ranking the search outcomes.
c. src/request_helper:
– Manages proxies, user agents, and request handling which are core to web scraping. Contains configuration files (list of proxies) required for proxy rotation.
d. src/scrapers:
– Implements specific scraping functionality for different platforms (Instagram, TikTok, Twitter), each encapsulated in its own file.
e. src/surface_crawl:
– Deals with browsing simulation and URL/query creation to crawl search engines.
f. src/ui:
– Contains the interface components (windows, workers/threads, dialogs) for the Graphical User Interface.
g. src/utils:
– Offers helper utilities (formatting, export functions, login, similarity scoring, etc.) used across multiple modules.
- Other Elements:
– The .github folder shows CI/CD configuration for building and deployment (like building a Skirnir image on push).
– The LICENSE and README indicate this is an open-source project with community-focused development.

##### Elements
a. Main Components:
- User Interface (UI):
– Represented by the src/ui modules (MainWindow, WorkerThread, etc.)
- Scraping Engines:
– The src/scrapers directory for platform-specific scrapers.
- Surface Crawl Module:
– Encapsulated in src/surface_crawl (crawling browser emulation, URL creation).
- Data Generation:
– Managed by src/generator (name, date, nickname generators for deepcrawl).
- Request Handling:
– Offered by src/request_helper for managing requests, proxy support, and user agent rotation.
- Relevance Sorting:
– Implemented within src/relevance to rank and filter results.
- Utilities:
– Helper functions in src/utils that provide support across all components.
- Data Storage/Data Input:
– The data folder for storing mappings, logos, and potentially other configuration information.
b. Component Relationships & Interactions:
- The UI interacts with the underlying scraping engine.
- User requests (from the UI or CLI trigger) are passed to the Request Handling module (using proxies).
- Depending on the user settings, the application dispatches tasks either to surface crawl (search engine queries) or deepcrawl (using generators for varied nicknames).
- Results from scrapers are processed (possibly sorted in src/relevance) and then passed back to the UI for display.
c. Architectural Patterns & Design Principles:
- The project employs a modular design with separation of concerns (e.g., scraping, UI, request handling are in different modules).
- The use of threading in src/ui/WorkerThread suggests an asynchronous or multithreading pattern for non-blocking UI operations.
- The code reflects a clear division into layers such as presentation (UI), business logic (scraping, name generation, relevance sorting), and network connectivity (request handling, proxies).
d. Technologies & Frameworks:
- Python is the language, with third-party libraries likely listed in requirements.txt.
- OSINT-specific scraping logic (custom implementations rather than standard frameworks) is developed as part of the project.
- Integration with external search engines and social networks is abstracted in the scrapers.

## Diagram (Mermaid)

```mermaid
graph TD
    A["User (CLI/GUI)"]:::ui -->|"initiates"| B["User Interface (src/ui)"]:::ui

    B -->|"sends command"| C["Request Handling/Proxy (src/request_helper)"]:::request

    subgraph "Surface Crawling Flow"
        C -->|"executes"| D["Surface Crawl Module (src/surface_crawl)"]:::surface_cr
        D -->|"calls"| E["Scraping Engines (src/scrapers)"]:::scraping
    end

    subgraph "Deep Crawling Flow"
        B -->|"activates"| F["Data Generation (src/generator)"]:::generator
        F -->|"supplies data to"| C
    end

    E -->|"returns results"| G["Relevance Sorting (src/relevance)"]:::relevance
    G -->|"delivers output"| B

    %% Supporting utilities and data storage
    B --- H["Utilities (src/utils)"]:::utils
    F --- H
    D --- H
    C --- H

    B --- I["Data Storage (data)"]:::data
    F --- I

    %% Click Events
    click B "https://github.com/hyldem0er/skirnir/tree/master/src/ui"
    click C "https://github.com/hyldem0er/skirnir/tree/master/src/request_helper"
    click D "https://github.com/hyldem0er/skirnir/tree/master/src/surface_crawl"
    click E "https://github.com/hyldem0er/skirnir/tree/master/src/scrapers"
    click F "https://github.com/hyldem0er/skirnir/tree/master/src/generator"
    click G "https://github.com/hyldem0er/skirnir/tree/master/src/relevance"
    click H "https://github.com/hyldem0er/skirnir/tree/master/src/utils"
    click I "https://github.com/hyldem0er/skirnir/tree/master/data"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef scraping fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef surface_cr fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef generator fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef request fill:#D8BFD8,stroke:#000,stroke-width:2px;
    classDef relevance fill:#87CEFA,stroke:#000,stroke-width:2px;
    classDef utils fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef data fill:#FFDEAD,stroke:#000,stroke-width:2px;
```
