DieAuth2.0.tcl0100700000076400007640000001777407447766540011504 0ustar wccwcc################################# ### DieAuth.tcl ### ### Version 2.0 ### ### By Wcc ### ### wcc@techmonkeys.org ### ### http://dawg.oc255.net:81/ ### ### EFnet #|DAWG|Tcl ### ################################# ############################################################################ ### Copyright © 2000 - 2002 |DAWG| Scripting Group. All rights reserved. ### ############################################################################ ############################################################################## ## This script makes owners (+n users) enter an authorization code to use ## ## ".die". You can also password protect the .die command. It also disables ## ## /msg die. ## ############################################################################## ############## ## COMMANDS ## ########################################## ## DCC ## .chanset +/-dieauth ## ######### Enables or disables dieauth ## ######### notification for a channel. ## ########################################## ########################################################### ## Just load the script, edit the settings, and restart. ## ########################################################### ##################################################### # Require a confirmation code to shut down the bot? # ##################################################### set dieauth_setting(useauth) 1 ########################################### # Require a password to shutdown the bot? # ########################################### set dieauth_setting(usepass) 0 #################################################### # Broadcast a notice when a shutdown starts/fails? # #################################################### set dieauth_setting(cast) 1 ################################## # Log when shutdowns start/fail? # ################################## set dieauth_setting(log) 1 ################################################## # Set the length of the authorization code here. # ################################################## set dieauth_setting(keylength) 8 ############################################################ # Set the 1st encryption string for the confirmation code. # # Do not use dictionary words. # ############################################################ set dieauth_setting(key1) "515hgd484R48gR54try000f7eD5G" ############################################################ # Set the 2nd encryption string for the confirmation code. # # Do not use dictionary words. # ############################################################ set dieauth_setting(key2) "828Ff856fh447rh74" ############################################## # Set the password for killing the bot here. # ############################################## set dieauth_setting(pass) "PASSWORD_HERE" ###################################################### # Append users handle to the end of the die message? # ###################################################### set dieauth_setting(append) 1 ################################### # Enable use of bold in DCC chat? # ################################### set dieauth_setting(bold) 1 ########################################### # Prefix "DIEAUTH:" in DCC chat messages? # ########################################### set dieauth_setting(DIEAUTH:) 1 #################### # Code begins here # #################### if {$numversion < 1060700} { putlog "\002DIEAUTH:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.7 or later." } if {[info tclversion] < 8.2} { putlog "\002DIEAUTH:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." } setudef flag dieauth unbind dcc n|- die *dcc:die unbind msg n|- die *msg:die bind dcc +n die dieauth_die bind dcc +n dieauth dieauth_dieauth proc dieauth_dopre {} { global dieauth_setting if {!$dieauth_setting(DIEAUTH:)} { return "" } if {!$dieauth_setting(bold)} { return "DIEAUTH: " } return "\002DIEAUTH:\002 " } proc dieauth_putdcc {idx text} { putdcc $idx "[dieauth_dopre]$text" } proc dieauth_chnotify {text} { foreach chan [channels] { if {[botonchan $chan] && [lsearch -exact [channel info $chan] +dieauth] != -1} { putserv "PRIVMSG $chan :$text" } } } proc dieauth_die {hand idx text} { global dieauth_setting dieauth_data if {!$dieauth_setting(usepass) && !$dieauth_setting(useauth)} { die $text[expr {($dieauth_setting(append))?" \($hand\)":""}] } set dieauth_data(valid) [expr ($dieauth_setting(usepass))?[dieauth_dopass $hand $idx $text]:1] if {!$dieauth_setting(useauth) || !$dieauth_data(valid)} { return } set rkey [rand 100] regsub -all -- {[a-z]|[A-Z]} $dieauth_setting(key2) $rkey dieauth_key3 set dieauth_data(diecode) [string range [md5 [encrypt [encrypt "[rand 5000]$hand$idx" $dieauth_setting(key1)] $dieauth_key3]] 0 [expr $dieauth_setting(keylength) - 1]] set dieauth_data(diehand) $hand if {!$dieauth_setting(usepass)} { set dieauth_data(reason) [expr {($text != "")?"$text[expr {($dieauth_setting(append))?" \($hand\)":""}]":"Authorized by $hand"}] } dieauth_chnotify "Shutdown initiated by $hand. A confirmation code has been sent." if {$dieauth_setting(cast)} { dccbroadcast "[dieauth_dopre]Shutdown initiated by $hand. A confirmation code has been sent." } if {$dieauth_setting(log)} { putlog "[dieauth_dopre]Shutdown initiated by $hand. A confirmation code has been sent." } putdcc $idx "[dieauth_dopre]Please type .dieauth $dieauth_data(diecode) now to confirm shutdown. All attempts are logged." } proc dieauth_dieauth {hand idx text} { global dieauth_data dieauth_setting if {!$dieauth_setting(useauth)} { dieauth_putdcc $idx "Die authorization is not enabled." ; return } if {$text == ""} { dieauth_putdcc $idx "Usage: .dieauth " ; return } if {![info exists dieauth_data(valid)] || ![info exists dieauth_data(diecode)] || ![info exists dieauth_data(diehand)] || ![info exists dieauth_data(reason)]} { dieauth_putdcc $idx "You must type .die before using .dieauth." ; return } if {[string compare $dieauth_data(diehand) $hand] != 0} { dieauth_putdcc $idx "Your hand did not initiate the die command. The die code has been reset, and the attempt logged." dieauth_chnotify "Invalid die attempt from $hand: Invalid hand." if {$dieauth_setting(cast)} { dccbroadcast "[dieauth_dopre]Invalid die attempt from $hand: Invalid hand." } if {$dieauth_setting(log)} { putlog "[dieauth_dopre]Invalid die attempt from $hand: Invalid hand." } return } if {[string compare [join [lindex [split $text] 0]] $dieauth_data(diecode)] != 0} { dieauth_putdcc $idx "Invalid die code. The die code has been reset, you must now re-initiate the shutdown processes." dieauth_chnotify "Invalid die attempt from $hand: Invalid die code." if {$dieauth_setting(cast)} { dccbroadcast "[dieauth_dopre]Invalid die attempt from $hand: Invalid die code." } if {$dieauth_setting(log)} { putlog "[dieauth_dopre]Invalid die attempt from $hand: Invalid die code." } unset dieauth_data(diecode) dieauth_data(diehand) return } die $dieauth_data(reason) } proc dieauth_dopass {hand idx text} { global dieauth_setting dieauth_data if {$text == ""} { dieauth_putdcc $idx "Usage: .die \[reason\]" set dieauth_data(valid) 0 return 0 } if {[string compare [join [lindex [split $text] 0]] $dieauth_setting(pass)] == 0} { set dieauth_data(reason) [expr {([lindex [split $text] 1] != "")?"[join [lrange [split $text] 1 end]][expr {($dieauth_setting(append))?" \($hand\)":""}]":"Authorized by $hand"}] if {!$dieauth_setting(useauth)} { die $dieauth_data(reason) } return 1 } dieauth_putdcc $idx "Invalid die password, attempt has been logged." dieauth_chnotify "Invalid die attempt from $hand: Invalid password." if {$dieauth_setting(log)} { putlog "[dieauth_dopre]Invalid die attempt from $hand: Invalid password." } if {$dieauth_setting(cast)} { dccbroadcast "[dieauth_dopre]Invalid die attempt from $hand: Invalid password." } return 0 } putlog "\002DIEAUTH:\002 DieAuth.tcl 2.0 by Wcc is loaded." DieAuth.info.dawg0100700000076400007640000000506607447772166012346 0ustar wccwccInformation: This script makes owners (+n users) enter an authorization code to use ".die" You can also password protect the .die command. Also disables /msg die. Changes log for DieAuth.tcl: Version 2.0 * Released to the public from the |DAWG| Tcl website. * Cleaned up code. * Removed die lines. * Added support for multiple info channels via the use of user- defined channel flags. * The script now works properly when die authorization and password protection are disabled. * Improved auth key generation. Version 1.9 * Released to the public from the |DAWG| Tcl website. * The bot will no longer try to message channels it isn't in. * Changed fast queue to putserv. Version 1.8 * Released to the public from the |DAWG| Tcl website. * Added the option to shorten the auth code. Version 1.7 * Released to the public from the |DAWG| Tcl website. * Completely removed bold and the DIEAUTH: prefix in all messages to channels. * Added the option to disable the DIEAUTH: and use of bold in DCC chat. Version 1.6 * Released to the public from the |DAWG| Tcl website. * If you are using eggdrop 1.6.7 and up, die will quit, than die on its own, and quitting before killing the bot isn't needed. Version 1.5 * Released to the public from the |DAWG| Tcl website. * Minor documentation updates. * Put all configuration settings into an array to save code. * Converted some 'if {string == "otherstring"} {' into 'if {[string match string otherstring]} {'. * Fixed a rand bug with uppercase characters. Version 1.4 * Released to the public from the |DAWG| Tcl website. * Renamed all putidx commands to putdcc for forward-compatibility reasons. Version 1.3 * Released to the public from the |DAWG| Tcl website. * Added password protection. * Added an option to broadcast a notice when a shutdown starts/fails. * Added an option to log when a shutdown starts/fails. * Added an option to msg a nick or channel when a shutdown starts/fails. * Added user-defined encryption keys for generating the authorization code. * The bot now quits irc with the die reason specified. If no reason is specified, the reason is 'Authorized by $hand'. * Added the option to append the user's hand to the die reason. * This script now replaces DiePass.tcl Version 1.2 * UnReleased. * Bug Fixes. * Added the option to log invalid die attempts to a channel. * Fixed a bug where dieauto_infodest should have been dieauth_infodest. Version 1.1 * Released to www.egghelp.org. * Fixed minor spelling/grammatical errors.