# aryann019x/anonymity-tool architecture

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

- Interactive diagram: https://gitdiagram.com/aryann019x/anonymity-tool
- Repository: https://github.com/aryann019x/anonymity-tool

## Overview

##### Project Type and Purpose
- This is a command-line, single-script tool designed specifically for enhancing network anonymity on Kali Linux.
- Its primary function is to automatically configure Tor, ProxyChains, DNS, and UFW firewall rules while also providing status checks and backup/restore operations.
- Although it’s implemented as one script, its functionality is clearly modular and touches multiple system components (system configuration files, services, etc).

##### File Structure
- With only three top-level files, the tool is self-contained in a single script.

##### Main Components
- User Interface (CLI): The script takes command-line options (“Enable Anonymity”, “Disable Anonymity”, “Show Status”, and “Exit”).
- Core Controller Module: At the heart lies the main execution flow which directs the overall operation, parsing input and triggering the correct actions.
- Tor Configuration Module: Handles starting, stopping, and verifying the Tor service.
- ProxyChains Module: Adjusts /etc/proxychains.conf and sets up proxy configurations.
- DNS Settings Module: Updates /etc/resolv.conf (and uses the backup file), ensuring that DNS leak protection is attempted.
- Firewall (UFW) Management Module: Applies a default deny policy and configures only the necessary ports.
- Dependency and Environment Setup: Checks whether required packages (tor, proxychains, curl) are installed; installs them if missing.
- Logging Module: Records operations and error messages to a log file (anonymity_log.txt).
- Status and Recovery Module: Helps in monitoring the current state, verifying that settings are active, and restoring original settings when disabling anonymity.

##### Relationships and Interactions
- The CLI interface receives user commands and sends them to the Core Controller.
- The Core Controller then makes calls to each functional module as needed, which in turn interact with the underlying system (file system changes, system calls for service control).

##### Architectural Patterns
- Separation of concerns: each module should be clearly annotated with its responsibilities.
- Error handling and backup/restore pathways as part of the overall flow, showing fallback to the original system configuration upon “Disable Anonymity.”

##### Relevant Technologies and Environment Details
- Operating System: Kali Linux—ensure that is noted.
- Services/Tools: Tor, ProxyChains, UFW firewall.
- Dependencies: Packages such as curl, and the fact that root privileges are required.
- External Configurations: Files modified (/etc/proxychains.conf, /etc/resolv.conf, and its .bak file) should be included.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    U("User"):::external

    %% CLI and Core Controller
    CLI("User Interface (CLI)"):::cli
    CC("Core Controller Module"):::controller

    %% Functional Modules Subgraph
    subgraph "Functional Modules"
        TCM("Tor Configuration Module"):::module
        PCM("ProxyChains Module"):::module
        DSM("DNS Settings Module"):::module
        FWM("Firewall (UFW) Management Module"):::module
        DES("Dependency and Environment Setup"):::module
        LM("Logging Module"):::module
        SRM("Status and Recovery Module"):::module
    end

    %% External System Components Subgraph
    subgraph "External System Components"
        SPC("System Config: /etc/proxychains.conf"):::external
        SRC("System Config: /etc/resolv.conf"):::external
        SBC("Backup Config: /etc/resolv.conf.bak"):::external
        TS("Tor Service"):::external
        UFWS("UFW Firewall"):::external
        LF("Log File: anonymity_log.txt"):::external
    end

    %% Connections: Input flow
    U -->|"input"| CLI
    CLI -->|"commandProcessing"| CC

    %% Core Controller calls functional modules
    CC -->|"initTorConfig"| TCM
    CC -->|"initProxyChains"| PCM
    CC -->|"initDNSSettings"| DSM
    CC -->|"initFirewall"| FWM
    CC -->|"checkDependencies"| DES
    CC -->|"initLogging"| LM
    CC -->|"initStatusRecovery"| SRM

    %% Module interactions with external systems
    TCM -->|"start/stop/verify"| TS
    PCM -->|"updateConfig"| SPC
    DSM -->|"updateDNS"| SRC
    DSM -->|"backupRestore"| SBC
    FWM -->|"configureRules"| UFWS
    LM -->|"recordLogs"| LF
    SRM -->|"verifyRestore"| SRC
    SRM -->|"verifyRestore"| SPC

    %% Click Events for Components (using anonymity_tool.sh as the file path)
    click CLI "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click CC "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click TCM "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click PCM "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click DSM "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click FWM "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click DES "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click LM "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"
    click SRM "https://github.com/aryann019x/anonymity-tool/blob/main/anonymity_tool.sh"

    %% Styles
    classDef cli fill:#AED6F1,stroke:#154360,stroke-width:2px;
    classDef controller fill:#F9E79F,stroke:#7D6608,stroke-width:2px;
    classDef module fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef external fill:#A9DFBF,stroke:#117864,stroke-width:2px;
```
