Skip to content

ircbot.c by trojanman - runs an ircbot with secure msg commands. Written in C.

License

Notifications You must be signed in to change notification settings

robertclemens/ircbot

Repository files navigation

ircbot

ircbot.c by trojanman - runs an ircbot with secure msg commands

DISCLAIMER: I am not a coder by trade. I am using basic coding knowledge and the help of AI to generate this project. All code has been generated by myself or an AI agent to assist with function building.

I'm open to any suggestions if by chance someone stumbles upon this repository.

System Requirements

* Compiler: gcc (Tested with: GCC 13.3.0)
* Make: GNU Make (Tested with: GNU Make 4.3)
* OpenSSL Libs: libssl-dev (Tested with: libssl-dev 3.0.13)   (IE: apt install libssl-dev on Ubuntu)
* LibCURL Libs: libcurl-dev

How to use:

  1. Take a look at bot.h if you want to set any custom time intervals. Defaults should be good so I recommend leaving alone unless you run into something later.

  2. Run "make && make install"

    • "make" creates the binary
    • "make install" cleans the directory of all config and compiler objects.
  3. Run "./ircbot -c"

    • This loads the config wizard to create your initial config file.
  4. Start ircbot. Choose config password and use run_bot.sh in utils/ to start the bot. Config password must be set in run_bot.sh before running.

    • ./run_bot.sh
    • Example crontab line: */5 * * * * /home/user/ircbot/run_bot.sh 1>/dev/null 2>/dev/null
  5. To send commands to your bot, you will need to hash your DEFAULT_BOT_PASS that you defined in bot.h. The hash output is timebased and lasts for no more than 120 seconds. I have provided two methods for generating this hash:

  • Linux CLI: ./bot-auth.sh <DEFAULT_BOT_PASS> will output a hash you may send to your bot:
    • /msg botnick <hash_output> help
  • IRSSI Script: bot_auth.pl. You may "/script load bot_auth.pl" with bot_auth.pl in ~/.irssi/scripts/ or place in ~/.irssi/scripts/autorun/ for automatic loading upon starting irssi.
    • /set bot_auth_password <DEFAULT_BOT_PASS>
    • /botcmd botnick help

Changelog

  • v2.1.0 - 20260115

    • Enhancement: Flattened admin and op command functions to make it easier to determine communication type
    • Enchancement: Changed vhost processing to more reliable functions and allow for ipv6 usage
    • Fix: Refactored authentication to all use a nonce to increase replay protection further
    • Fix: Ensured proper salting in AES-256-GCM implementations as standard even when using a nonce
    • Fix: Refactored irc_parser.c for mode handling to catch some rare scenarios where the bot did not have op awareness
    • Fix: Added additional parsing and mode handlers for the update functions in utils including the potential for MITM attacks
  • v2.0.0 - 20251028

    • Enhancement: Add ops status symbol @ to status output command to show whether bot is ops
    • Enhancement: Add bot program name and version to status output
    • Enhancement: Add getlog command to see last x lines of log from each type submitted with the latest logs shown first
    • Enhancement: Add update command to update to a new version by downloading .tar.gz and compiling. Add libcurl-devel dependency. Dependency checks are run on update cmd before downloading. (still needs to be tested on multiple platforms)
    • Enhancement: Make sure help has all of the getlog help listings
    • Enhancement: Randomize which bot is selected from /who #channel for op request.
    • Enhancement: Bot now does an op check when deop'd to quickly ask for ops again
    • Enhancement: Added a CTCP Version response that is modifiable to send a reply
    • Enhancement: Most of the bot config is now done at first run with a -c parameter (more changes coming)
    • Fix: L_MSG wasn't actually being used. Added log_message for inbound msg logging
    • Fix: CTCPs were being logged in L_MSG and nothing in L_CTCP. Added basic CTCP processing
    • Fix: L_CMD logs were missing the entire CMD string for Admin and Op commands sent
    • Fix: add -D_XOPEN_SOURCE=700 to Makefile CFLAG for more platform support
    • Critical Fix: auth_check_hostname was mistakenly left in a default allow state (return true) and was not blocking unknown user masks.
    • Critical Fix: op command from opers (not admins) was not working. Refactored command logic
  • v1.1.2 - 20251019

    • Enhancement: Change AES-256-CBC implementation over to AES-256-GCM for config file read/write
    • Enhancement: Modified config line values to make more sense as config options have been added
    • Enhancement: Moved AES-256-CBC config tools to legacy utils in the utils/ folder (legacy)
    • Enhancement: Created new config tools (encrypt_config.c/decrypt_config.c) using AES-256-GCM
    • Enhancement: Bot now fully parses +o or -o mode lines when multiple nicks are included
    • Fix: utils/decrypt_config.c no longer outputs decrypted data with superfluous lines
    • Fix: utils/legacy_decrypt_config.c no longer outputs decrypted data with superfluous lines
    • Fix: Makefile now chmods 700 compiled binary
    • Fix: Added g_shutdown_flag to main bot loop to check for ctrl+c signal
    • Fix: Corrected utils/run_bot.sh to show ENV_VAR is customizable and must match bot.h value
    • Fix: Log level was being written to config even if default_log_level was not changed
    • Fix: Add validation to +adminmask, +oper, and +bot to prevent duplicate usermask additions
    • Fix: Modified utils/run_bot.sh for better environment var handling
    • Fix: irc_parser.c contained multiple iterations of am_i_opped checks; removed duplicate
  • v1.1.1 - 20250928

    • Enhancement: Change AES-256-CBC implementation over to AES-256-GCM for bot-to-bot communication
  • v1.1.0 - 20250927

    • Enhancement: Added secure bot communication for granting ops status in channels
    • Enhancement: Changed startup mechanism to use environment variable to store and load configuration password
    • Enhancement: Added syntax help to admin commands sent to bot. Also added help functionality
    • Enhancement: Added PID file logic to ircbot to keep multiple instances from running
    • Enhancement: Included run_bot.sh in utils/ to allow easy ircbot startup and crontab processing (edit config password in this file before running)
    • Enhancement: Added additional functionality for admin commands sent to ircbot
  • v1.0.0 - 20250906

    • Initial commit of ircbot

About

ircbot.c by trojanman - runs an ircbot with secure msg commands. Written in C.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages