How vxunderground/threatintelligencediscordbot works
Project type and purpose
• This is a backend “Threat Intelligence Bot” written in Python. It’s not a GUI or full-stack web app—it’s a CLI-driven monitoring service that:
• Polls RSS feeds on a schedule (every 1800s)
• Listens to Telegram channels in real time
• Formats and pushes updates into Discord via Webhooks
• Its primary use case is ingesting threat-intel data (ransomware feeds, clearnet sites, Telegram) and outputting alerts to one or more Discord channels.
File structure
• Top-level:
• config.ini – central configuration (webhook URLs, Telegram API credentials, image folder)
• requirements.txt – Python dependencies (discord.py, python-telegram-client, requests, etc.)
• TelegramImages/ – storage for downloaded channel images
• Source/ directory:
• __main__.py – CLI entrypoint; parses “rss” vs. “telegram” argument and dispatches
• Bots/RSS.py – scheduled RSS polling, de-duping, logging to RSSLog.txt
• Bots/Telegram.py – real-time Telegram client, image download logic
• Formatting.py – message‐templating helpers for Discord payloads
• Utils.py – shared utilities (e.g., load config, file I/O, webhook sender)
• RSSLog.txt – local state to avoid re-posting same items
README for additional insights
• Confirms Python 3.10, cross-platform (Windows/Linux)
• Requires 5 Discord webhooks by default (private sector, government, ransomware, log, etc.)
• On first Telegram run: handles 2FA, persists session file
• Users can add/remove RSS feeds by editing a list in RSS.py
a. Main components
• Input Sources:
– External RSS Feed Providers
– Telegram Channels
• Core Application:
– CLI Dispatcher (__main__.py)
– RSS Bot Module (RSS.py)
– Telegram Bot Module (Telegram.py)
– Shared Utilities (Utils.py)
– Formatting Layer (Formatting.py)
• Configuration Store: config.ini
• Persistence:
– RSSLog.txt (state tracking)
– TelegramImages/ (image store)
– Telegram session file (auto-created)
• Output Sink: Discord Webhooks
b. Relationships & interactions
1. At startup, __main__.py reads config.ini (→ Utils.load_config)
2. Based on argument “rss” or “telegram”, dispatcher invokes the corresponding bot
3. RSS Bot:
– Iterates through rss_feed_list → fetches feed URLs → parses new items
– Logs processed items to RSSLog.txt → formats message → posts to Discord via Webhook API
4. Telegram Bot:
– Connects to Telegram API → listens for new messages/images
– Downloads images to TelegramImages/ → formats text+media → posts via Webhook
– On 2FA prompt, reads user input → resumes session → persists session file
5. Formatting.py supplies consistent embed/message templates
6. Utils.py handles HTTP calls, file I/O, logging
c. Architectural patterns & design principles
• Modular separation by concern:
– Dispatcher vs. Bot logic vs. Formatting vs. Utils
• Single-responsibility principle: each file does one job
• Config-driven: behavior controlled via config.ini
• State persistence to avoid duplication
d. Key technologies/frameworks
– Python 3.10
– discord.py for Webhooks
– python-telegram-client (or Telethon)
– feedparser or requests+ElementTree in RSS.py
– configparser for config.ini
– Standard library modules (logging, os, time, argparse)
Essential elements
• Labels on every component (e.g., “RSS.py”)
• 1800s scheduler on the RSS flow and “real-time” on Telegram