How akhilsharma90/docbot works
Project Type and Purpose
• DOCBOT is a Rust-based, full-stack command‐line application for cracking PDF passwords using both dictionary and brute-force techniques.
• It is organized as a workspace of four crates:
• cli-interface – handles argument parsing, help/banner display, and user I/O
• producer – generates password candidates (date, range, default, custom queries)
• engine – orchestrates multithreading, schedules candidate batches, coordinates producers and crackers
• cracker – attempts to unlock PDF streams with given passwords
Main Components
• External Input: the encrypted PDF file provided by the user
• CLI Interface (crate cli-interface):
• Parses docbot arguments (file path, attack type, parameters)
• Displays banners/help text
• Dispatches to the appropriate producer submodule or dictionary attack
• Producer Layer (crate producer):
• default_query (alphanumeric brute force)
• dates (DDMMYYYY date generator)
• number_ranges (numeric ranges)
• custom_query (user-specified format with ranges and optional zero padding)
• dictionary (reads wordlists from disk)
• Engine Layer (crate engine):
• Implements a thread pool (using all CPU cores)
• Requests password batches from producer modules
• Enqueues tasks to the cracker module
• Monitors progress and halts on success
• Cracker Layer (crate cracker):
• Performs the low-level PDF opening/decryption attempts
• Returns success/failure for each password
• Test Harness (tests/): validates each attack mode and edge cases
Component Relationships and Data Flow
1. User invokes docbot binary → CLI Interface
2. CLI Interface parses params → selects Producer strategy or dictionary mode
3. Engine receives the selected Producer → requests the next batch of candidate passwords
4. Engine dispatches each candidate batch to the Cracker (in parallel threads)
5. Cracker attempts PDF unlock → returns result to Engine
6. Engine reports success or continues until exhaustion → CLI outputs result
Architectural Patterns and Principles
• Modular Crate Boundary: clear separation of concerns via Rust workspace crates
• Pipeline Pattern: Producer → Engine → Cracker
• Thread-Pool Worker Pattern in Engine for concurrency
• Builder/Strategy Pattern in Producer for flexible query generation
• Single-Responsibility: each crate has one focused domain
Technologies and Frameworks
• Rust/Cargo workspace and crates
• Threading primitives (std::thread, channels, or rayon) in engine
• PDF parsing/decryption library in cracker (e.g., lopdf or similar)
• CLI argument parser (e.g., clap or structopt) in cli-interface