# botnetstats.tcl

**Category:** Eggdrop_Bot
**Original Author:** Lucas <eggy@eggdrop-fr.org>

## Description
This script is designed to monitor a botnet by collecting statistics about the bots, generating reports via email and HTML web pages, and announcing these stats on the botnet. It runs as an unattended background process within an Eggdrop IRC bot.

## Key Features
- Collects data on connected bots including their version numbers.
- Sends daily summary emails with detailed bot information.
- Updates a web page every 10 minutes to display current botnet statistics.
- Announces the stats at a specified time each day.
- Manages linked and unlinked bots, tracking hubs and links.

## File Analysis
- **botnetstats.tcl** — Main script file containing configuration settings, functions for handling bot data, and event bindings. 
- **bst { index }** — Internal function to retrieve localized text strings.
- **bsgetversion { bot }** — Retrieves the version number of a given bot.
- **bsremovezero { number }** — Removes leading zeros from numbers.
- **bsgettextbranch { numbranch }** — Translates branch numbers into human-readable versions.
- **bsgettextversion { numversion }** — Formats version strings for display.
- **bssearchbot { bot }** — Searches for a specific bot in the seen bots list.
- **bsspaces { number }** — Generates spaces based on input length.
- **bsdispbotlist { sendmail liste }** — Displays a list of bots in an email message.
- **bsdispbotlisthtml { file liste }** — Formats and writes a list of bots to an HTML file.
- **bstime:botnetell { min hour day month year }** — Sends a botnet announcement at a specified time.
- **bstime:sendmail { min hour day month year }** — Sends the daily summary email.
- **bsdcc:sendreport { handle idx arguments }** — Handles sending of reports via dcc.
- **bsddcclisthtml { file liste }** — Formats and writes a list of dcc users to an HTML file.
- **bssendmail { }** — Main function for generating and sending the summary email.
- **bsmakehtml { min hour day month year }** — Updates the web page with current botnet statistics.