16.10.2002


servctrl.tcl Component Documentation




# servctrl.tcl for netbots.tcl v3.30
# designed to work with eggdrop 1.3.28 or higher
# Johoho's Eggdrop Page - http://johoho.tuts.net/eggdrop/
# splitdetect.tcl copyright (c) 1999,2000 by Johoho <johoho@hojo-net.de>
# netbots.tcl copyright (c) 1998-2000 by slennox <slennox@egghelp.org>

## servctrl.tcl component script v2.50.2, 16.10.2002 ##

# History:
#
# v1.00.1, 22.04.2000 - initial release
# v2.00.0, 28.04.2000 - extended the script
# v2.10.0, 30.04.2000 - added an option to make not to crash on startup
# v2.20.0, 11.05.2000 - fixed a rmserv bug and added klined reason
# v2.21.0, 23.05.2000 - added two more command line options
# v2.22.0, 28.05.2000 - fixed a timer bug
# v2.23.0, 01.05.2001 - slighty(by approx. 10%) reduced amout of code (Abraham)
# v2.24.0, 05.05.2001 - added checks of NOTES MODULE presence (Abraham)
# v2.25.0, 18.05.2001 - added, fixed, optimized a lot of things (Abraham)
# v2.25.0, 18.05.2001 - added entries expiration and changed format of file wich holds servers data (Abraham)
# v2.26.0, 25.05.2001 - changed messages generated by script on entry removal (Abraham)
# v2.27.0, 13.06.2001 - fixed one minor bug and changed some cosmetic details (Abraham)
# v2.28.0, 17.06.2001 - changed flag req. for commands provided by that component (Abraham)
# v2.28.1, 28.06.2001 - added temporary! workaround for bug in eggdrop code (Abraham)
# v2.29.0, 13.07.2001 - added: rrmserv, fixed: non working in sometimes version reporting (Abraham)
# v2.30.0, 16.07.2001 - added: rservprob, fixed: some bugs in .rrmserv (Abraham)
# v2.30.1, 17.07.2001 - fixed: missing rservprob in netbots cmds index (Abraham)
# v2.30.2, 19.07.2001 - added: rklines, rrestriced, runauthorized cmds (Abraham)
# v2.30.3, 28.08.2001 - fixed: rmserv & runathorized cmds bugs, compacted s component code (Abraham)
# v2.30.4, 27.11.2001 - cleaned/optimised code, replaced some dirty hacks by more elegant code (Abraham)
# v2.40.0, 09.02.2002 - removed: notes support, optimised code, added: -all option to rmserv/rrmserv commands &
# v2.40.0, 09.02.2002 - replaced: -v option in various cmds by scver/rscver cmds (Abraham)
# v2.50.0, 09.10.2002 - fixed: last (I hope so) bug in servctrl, which could cause sometimes bot's "lockup" &
# very high CPU power consumption.
# v2.50.1, 14.10.2002 - two small typos.. still working on removal of 2-nd occurence of code which may cause problems.
# v2.50.2, 16.10.2002 - fixed: 2nd occurence of problematic code .. at least !!!
#

more detailed history is provided in script file.

# thanks slennox for netbots.tcl
# thanks to Abraham for ideas/bugreports/feeback [and coding :-)]

Please note that this component is fully compatible with netbots.tcl v3.15 - 3.30 by slennox
Please note that from version 2.25.0 servctrl uses new format of file wich holds servers data.
Please read FAQ for futher details.
Please note also that becouse of recent changes version 2.30.4 is SLIGHTY uncompatible with previous version on communication layer. To avoid potential problems update of that component should be performed on WHOLE botnet.

Index




Description

This script provides extended server control support to eggdrop. If notices when a connection to an irc server is restricted, unauthorized or denied (k-lined). It logs those servers in a file and removes those servers from the server cycling queue. Checks against k-lines, restricted or unauthorized connections can be turned on/off in netset.tcl file.
Servers which were registered to be not bot friendly can be removed later from the file by a dcc command.


Commands MSG/DCC

DCC Commands

.servprob (t|-) - list all servers which make trouble
.rmserv (t|-) - remove a server from bad servers list
.rrmserv (t|-) - remove a server from bad servers list on
.klined (t|-) - show all servers where the bot is k-lined
.rklined (t|-) - show all servers where the netbots are k-lined
.restricted (t|-) - show all servers where the bot is restricted
.rrestricted (t|-) - show all servers where the netbots are restricted
.unauthorized (t|-) - show all servers where the bot is unauthorized
.runauthorized (t|-) - show all servers where the netbots are unauthorized

Further help is available via the netbots help system. Use .nethelp


Installation

netset.tcl

To install this component properly you have to copy it to your netbots directory and add these lines to your netset.tcl conf:

# servctrl.tcl
set nb_component(servctrl) 1
set sc_file "servers.txt"
set sc_klined 1
set sc_expire_klined 1
set sc_expire_klined_divider 4
set sc_restricted 1
set sc_unauthorized 0
set sc_expire_restriced 12
set sc_expire_restriced_divider 4
set sc_expire_unauthorized 0
set sc_expire_unauthorized_divider 4

Settings Documentation

sc_file (default: "servers.txt")
Set here the filename you want servctrl to log the servers it can't connect to
Valid settings: a string
 
sc_klined (default: 1)
Should the script care about server which have the bot's host k-lined?
Valid settings: 1 to enable, 0 to disable.
 
sc_expire_klined (default: 1)
Should the script expire k-lined entries after specified time?
Valid settings: Number of days, 0 to disable.
 
sc_expire_klined_divider (default: 4)
Defines how often should script check entries agains expiring, by specifing number which fraction of sc_expire_klined

Example: if sc_expire_klined is set to 1 day and sc_expire_klined_divider is set to 4, then bot will check entries against expiring every 1/4 of 1 day
Valid settings: 1 and above
 
sc_restricted (default: 1)
Should the script care about resticted connections?
Valid settings: 1 to enable, 0 to disable.
 
sc_expire_restriced (default: 12)
Should the script expire restricted entries after specified time?
Valid settings: Number of hours, 0 to disable.
 
sc_expire_restriced_divider (default: 4)
Defines how often should script check entries agains expiring, by specifing number which fraction of sc_expire_restriced

Example: if sc_expire_restriced is set to 12 hours and sc_expire_restriced_divider is set to 4, then bot will check entries agains expiring every 1/4 of 12 hours
Valid settings: 1 and above
 
sc_unauthorized (default: 0)
Should the script care about unauthorized connections?
Valid settings: 1 to enable, 0 to disable.
 
sc_expire_unauthorized (default: 0)
Should the script expire restricted entries after specified time?
Valid settings: Number of minutes, 0 to disable.
 
sc_expire_unauthorized_divider (default: 4)
Defines how often should script check entries agains expiring, by specifing number which fraction of sc_expire_unauthorized

Example: if sc_expire_unauthorized is set to 120 minutes and sc_expire_unauthorized_divider is set to 4, then bot will check entries agains expiring every 1/4 of 120 mins
Valid settings: 1 and above



FAQ

Q:  A server doesn't allow my bot to connect since it's k-lined, unauthorized or just allows a restricted connection, but the script doesn't notice!
A:  The raw settings used in this script are adapted for IrcNET. It seems that your network uses other raw codes.
Go to your bots partyline, enable console +r, and log the connect procedure on '.jump'. There's a three figure number, that's what you need. Open your netset.tcl and add those settings to the servctrl.tcl section:
  set sc_raw_klined code_for_klined_connections
  set sc_raw_restricted code_for_restricted_connections
  set sc_raw_unauthorized code_for_unauthorized_connections
An example would look loke:
  set sc_raw_klined 301
  set sc_raw_restricted 419
  set sc_raw_unauthorized 398
Of course you don't have to use all three settings. If you're fine with the pre-set settings, there's no need to change them.
 
Q:  My bot crashed incidentely and doesn't start anymore since servctrl removes all servers from the cycling list. The error message given by eggdrop is "NO SERVER"
A:  Servctrl waits three seconds before it removes all servers from cycling list. To increase this number, open your netset.tcl and add this setting to the servctrl.tcl section:
   set sc_starttimeout x
Where x is number of seconds. Set value higher than default (3 secs). Too low value will still give you bot crash, too high value will result in too late removal of servers and attempt(s) of connection to unavail. server(s). Try to find correct value for your bots by testing changes of this variable in one second increment. This should fix your problems.
 
Q:  There are entrys in file wich holds data about servers but bot dosen't see it
A:  Servctrl from version 2.25.0 uses new format of file in wich holds data about servers. Remove old file.
 
Q:  I have a question, but it's not listed here.
A:  Feel free to contact the author at johoho@hojo-net.de!



Contact

You can contact me via E-Mail at johoho@hojo-net.de, at ICQ 2499577 (tell me who you are and what you want or I'll ignore you) or catch me on irc usually around 18-24 UTC+1 in #eggdrop. (IrcNET)


DISCLAIMER

servctrl.tcl is provided 'as is' and without warranty of any kind. You may use it own will as long as the author is NOT held responsible for ANY damage caused by the usage of this script, neither direct or indirect.
You may modify the script and all belonging files as long as you keep this copyright-text, include a short description of all changes, and send a copy to the author (e-mail: johoho@hojo-net.de).



©2000 by Johoho@IrcNET, 16 September 2002. CONTACT