# bitwise-01/instagram- architecture

> Architecture diagram of the GitHub repository bitwise-01/instagram-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bitwise-01/instagram-
- Repository: https://github.com/bitwise-01/instagram-

## Overview

##### Project type and purpose
- This is a Python-based CLI tool (“Instagram Bruter”) that orchestrates multiple worker “bots” (browser sessions) to brute-force Instagram logins using a rotating pool of HTTP proxies.
- Key use cases: importing a proxy list into a local database, gathering proxy health stats, pruning poor proxies, and running a multi-threaded brute-force attack against a target account with a given password list.

##### File structure
- Top-level files:
- instagram.py – the CLI entry point and argument parser
- Pipfile/Pipfile.lock – environment and dependency management
- `lib/` package (core modules):
- browser.py         – browser/session abstraction for HTTP requests
- bruter.py          – orchestrates threads, manages attack lifecycle
- database.py        – interacts with local database to store proxies and scores
- proxy.py           – proxy representation and health metrics
- proxy_manager.py   – pool maintenance, rotation logic, pruning
- password_manager.py– iterates and feeds passwords to workers
- .py         – real-time console output, progress bars
- const.py           – configuration constants (e.g., DB path, thresholds)

##### README for additional insights
- Describes commands (`--stats`, `--prune`, `-u`, `-p`, `-px`, `-m`) and workflow steps:
- Upload proxies → saved in DB
- Inspect proxy health → stats
- Prune by score threshold → DB update
- Launch brute-force → multi-bot attack

a. Main components:
- CLI Layer (instagram.py)
- File Loader (reads proxy list, password list)
- Database Layer (SQLite or similar)
- Proxy Manager
- Password Manager
- Bruter (Thread Pool / Worker Manager)
- Browser Workers (HTTP clients)
- / Logger
- External Service (Instagram Web API)
b. Relationships & interactions:
1. CLI → File Loader: ingest `--proxylist` & `--passlist` files
2. File Loader → Database Layer: bulk insert proxies
3. CLI `--stats`/`--prune` → Proxy Manager ↔ Database Layer → updates scores
4. CLI `-u`/`-p`/`-m` → Bruter & Password Manager & Proxy Manager
5. Bruter → spawns Browser Workers; each Worker pulls next proxy from Proxy Manager and next password from Password Manager
6. Browser Worker → makes HTTP request → Instagram → returns success/fail
7. Browser Worker → reports result to Proxy Manager (to update score) and to Display
c. Architectural patterns & principles:
- Layered architecture: CLI → Core services → Data store → External system
- Producer-consumer for password and proxy feeding
- Thread-pool concurrency in Bruter module
- Single Responsibility: each lib module has a distinct function
d. Key technologies:
- Python 3.9, Pipenv
- SQLite (or file-based DB) via `lib/database.py`
- HTTP automation (requests or Selenium abstraction in `browser.py`)
- Multi-threading or async concurrency in `bruter.py`

##### Elements
- File → Database
- Proxy Manager ↔ Database
- Bruter → Workers
- Workers → Instagram → Workers
- Workers → Proxy Manager
- Workers → Display
- Blue for data stores (Database)
- Green for processing modules (Bruter, Managers)
- Orange for I/O (CLI, File Loader, Display)
- Grey cloud for external service (Instagram)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers and Components
    CLI["CLI Layer<br/>(instagram.py)"]:::io
    FileLoader["File Loader"]:::io
    Pipfiles["Pipfile / Pipfile.lock"]:::io
    README["Project README<br/>(README.md)"]:::io
    Const["Config Constants<br/>(lib/const.py)"]:::process
    DB["Database<br/>(SQLite)<br/>(lib/database.py)"]:::db
    ProxyManager["Proxy Manager<br/>(lib/proxy_manager.py)"]:::process
    PasswordManager["Password Manager<br/>(lib/password_manager.py)"]:::process
    Bruter["Bruter (Thread Pool)<br/>(lib/bruter.py)"]:::process
    Worker["Browser Worker<br/>(lib/browser.py)"]:::process
    Instagram["Instagram Web API"]:::external
    Display["Display / Logger<br/>(lib/display.py)"]:::io

    %% Top-level flow
    CLI -->|“import proxy/password files”| FileLoader
    FileLoader -->|“bulk insert proxies”| DB
    CLI -->|“view stats / prune”| ProxyManager
    CLI -->|“launch attack”| Bruter

    %% Setup flow
    ProxyManager -->|“read/write proxy scores”| DB
    ProxyManager -->|“display stats”| Display

    %% Attack flow
    Bruter -->|“get next password”| PasswordManager
    Bruter -->|“get next proxy”| ProxyManager
    Bruter -->|“spawn worker”| Worker
    Worker -->|“HTTP request/response”| Instagram
    Worker -->|“score feedback”| ProxyManager
    Worker -->|“progress & results”| Display

    %% Constants and README
    CLI -->|“config & thresholds”| Const
    CLI -->|“documentation”| README
    CLI -->|“env & deps”| Pipfiles

    %% Click Events
    click CLI "https://github.com/bitwise-01/instagram-/blob/master/instagram.py"
    click Worker "https://github.com/bitwise-01/instagram-/blob/master/lib/browser.py"
    click Bruter "https://github.com/bitwise-01/instagram-/blob/master/lib/bruter.py"
    click DB "https://github.com/bitwise-01/instagram-/blob/master/lib/database.py"
    click ProxyManager "https://github.com/bitwise-01/instagram-/blob/master/lib/proxy_manager.py"
    click PasswordManager "https://github.com/bitwise-01/instagram-/blob/master/lib/password_manager.py"
    click Display "https://github.com/bitwise-01/instagram-/blob/master/lib/display.py"
    click Const "https://github.com/bitwise-01/instagram-/blob/master/lib/const.py"
    click Pipfiles "https://github.com/bitwise-01/instagram-/tree/master/Pipfile"
    click Pipfiles "https://github.com/bitwise-01/instagram-/blob/master/Pipfile.lock"
    click README "https://github.com/bitwise-01/instagram-/blob/master/README.md"

    %% Styling
    classDef db fill:#a0c4ff,stroke:#333,stroke-width:1px;
    classDef process fill:#caffbf,stroke:#333,stroke-width:1px;
    classDef io fill:#ffd6a5,stroke:#333,stroke-width:1px;
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px;
```
