How ethical-buddy/torons works
Project Type & Core Purpose
• This is a specialized web crawler designed for “dark web” environments (Tor and I2P) that also performs NLP-based hate speech classification.
• The system supports multiple modes of operation (e.g., via CLI or web interface) and incorporates asynchronous processing, randomization techniques for anonymity, and continuous background file processing.
Primary Components to Capture
a. Web Crawling Engines:
• Tor Crawler: Represent scripts such as async_crawl4.py and tor.py that handle the asynchronous crawling of Tor websites.
• I2P Crawler: Represent scripts like async_crawl_i2p.py and i2p.py that directly target I2P network resources.
• Shared or common crawling utilities: Include components from the Research and Scraper directories (e.g., basic_crawler.py, basic_scraper.py) which indicate experimental or core scraping logic.
b. NLP Analysis Component:
• Clearly denote the NLP module (nlp.py and nlp/main.py) responsible for hate speech classification. Emphasize that this module utilizes a pre-trained transformer model (Hugging Face’s Hate-speech-CNERG/dehatebert-mono-english).
c. Data Storage & Processing:
• Data Persistence: Include the “data” folder and note that temporary files (like those mentioned in the README, such as temp/scraped.txt) and archived HTML/CSV files are used for tracking crawl results.
• Continuous Processing: Highlight the role of background threads that monitor and process files continuously (as mentioned in the README).
d. User Interfaces:
• CLI: Represented primarily by main.py which provides the menu-based control to launch crawlers and other utilities.
• Web Application: Represent the webapp directory containing app.py and its templates. This shows that there is also a web UI component for user interaction.
e. Utility & Configuration Components:
• Tor IP Utility: Scripts such as tor_ip_utility.py and related utilities for checking and maintaining network anonymity.
• Configuration File: config.py serves as the central configuration reference for managing environment variables or settings.
• Dockerfile: Indicates that containerization is used for deployment, which is an important part of the system’s runtime infrastructure.
Relationships and Data Flow
• That the Tor IP Utility is invoked as needed by the crawling modules to verify or rotate the current IP address.
• The continuous processing background thread should be illustrated as having a feedback loop with the Data Storage, ensuring that files are processed as they are saved.
Highlighted Architectural Patterns & Design Principles
• Asynchronous Processing: Use notation (e.g., a “async” label or “non-blocking” symbol) on the crawler components to denote concurrent operations.
• Modularity: Separate each major function (crawling, NLP analysis, UI, and utilities) into distinct components that interact through defined interfaces.
• Security & Randomization: Annotate that the user agent randomization and secure random string generation are embedded within the crawling components.
• Extensibility: Given the multiple directories (Research, Scraper) and experimentations, note that the system is designed to incorporate alternative scraping strategies and modules.
5. That security, randomization, and continuous background processing are noted as special features within the architecture.