Encrypting and Decrypting with TCL eggdrops

Top  Previous  Next

All Eggdrops include a blowfish module which is fully compatible with mircryption(!).  This means you can make your eggdrop scripts easily speak and read mircyption.

 

However, to give an eggdrop script the ability to read and decrypt text, you will have to provide the blowfish(mircryption) key to your eggdrop script, which means that any admin with access to your shell could read your the key, and therefore be able to read all conversations in the channel using that key.  This is almost always an EXTREMELY BAD IDEA, and you should not give channel keys to bots run off of any shells but those you run on your own box.

 

One way around this is to use a key for the bot that is different from the main key for your channel.  In this case, the worst that a shell admin could do is read conversations to and from the bot, but not your normal channel.

 

More information on using built-in (mircryption-compatible) eggdrop blowfish functions: http://mars.age.psu.edu/eggdrop2/mod-blowfish.html

 

The following tcl commands are provided by this module (and should also be provided by any other encryption module):

encrypt <key> <string>

returns: encrypted string (using blowfish), encoded into ascii using base-64 so it can be sent over the botnet

decrypt <key> <encrypted-base64-string>

returns: decrypted string (using blowfish)

 

A very simple tcl script for handling encrypted conversation with a  bot is shown below.  A more involved example provided by someone on the mircryption forum can be found here.

 

#sample TCL script for encrypting and decrypting

bind pub - "mcps" mcpsdecrypt

bind pub - "!etest" mcpsencrypt

set key "replacethistextwithyourmircryptionkey"

#

proc mcpsdecrypt {nick uhost handle chan arg} {

 global key

 set msg [ decrypt $key $arg ]

 if {$msg=="!edtest"} {

         #######################################################

         #### start of encrypted trigger to encrypted reply ####

         #### using the trigger !edtest ####

         #######################################################

         set ende [ encrypt $key "Encrypted Trigger -> Encrypted" ]

         putserv "PRIVMSG $chan :mcps $ende"

         }

 if {$msg=="!dtest"} {

         ############################################

         #### start of encrypted trigger to plain text reply ####

         #### using the trigger !dtest ####

         ########################################################

         putserv "PRIVMSG $chan :Encrypted Trigger -> Plain"

         }

 }

#

proc mcpsencrypt {nick uhost hand chan arg} {

 ########################################################

 #### start of Plain text trigger to encrypted reply ####

 #### using the trigger !etest ####

 ########################################################

 global key

 set msg [ encrypt $key "Plain Trigger -> Encrypted" ]

 putserv "PRIVMSG $chan :mcps $msg"

 }

 

 

 


WARNING!!!

to give an eggdrop script the ability to read and decrypt text, you will have to provide the blowfish(mircryption) key to your eggdrop script, which means that any admin with access to your shell could read your the key, and therefore be able to read all conversations in the channel using that key.  This is almost always an EXTREMELY BAD IDEA, and you should not give channel keys to bots run off of any shells but those you run on your own box.