Friday, July 6, 2007

How to setup Eggdrop?

Background Information :-

An eggdrop is basically a (Ro)bot, a standalone program that can sit in your channel and perform numerous tasks.

If configured correctly an eggdrop can protect your channel from floods, provide you with entertainment or even talk to you to some extent!

Eggdrop came to the forefront in 1996 when it was written by Robey Pointer to assist managing users in a channel. Since then it has grown exponentially and is one of the most widely used IRC bots today. The name Eggdrop apparently comes from a soup Robey's sister used to eat Eggdrop Soup. I havn't tasted it myself yet, but if you have let us know what it is like and if it tingles your taste buds in the right place.

Since its inception eggdrop has had many authors and is currently maintained and developed by the egghead team.

Getting an Eggdrop:-

You can get the source code for the current eggdrop release quickly and easily from
http://www.geteggdrop.com/

If you want an older release you can get the source at
ftp://ftp.eggheads.org/.

You can download both stable and CVS releases from this location.

If you want to run an eggdrop on windows you can download many versions from the windrop sourceforge project.

I believe the windrops are compiled in cygwin, and you could always download this and try to compile the source yourself.

Apart from this there are also some archives with pre-compiled eggdrops, for those of you who are unfortunate enough not to have a compiler installed on your shell. JoJohoho's Eggdrop archive - one of the best sources for precompiled binaries is located
http://johoho.eggheads.org/eggdrop/. It contains files for many flavours of unix and linux, windows and a few other operating systems.

Compiling your eggdrop :-

Linux installation: (
Jump to the Windows Instalation)

The example below will assume the file you have downloaded is called eggdrop1.6.17.tar.gz.

Upload the file to your shell using an ftp client such as ws_ftp.

Alternatively download the latest stable release directly to your shell by typing one of the following commands at your shell prompt*

wget http://www.geteggdrop.com
wget
ftp://ftp.eggheads.org/pub/eggdrop/source/1.6/eggdrop1.6.17.tar.gz

*Use telnet or ssh to log into your shell (using a program like putty (http://www.putty.nl/)

Once you have the file you can proceed to install it. The file, if downloaded from the above location will be in a tarball archive. To extract the files from the archive type:

tar -zxvf eggdrop1.6.17.tar.gz

This will extract all the files to a directory called "eggdrop1.6.17"

Next you need to enter the directory and compile your bot.

cd eggdrop1.6.17

./configure

Then type the following commands when prompted:

make config (you may need to use gmake config on some systems e.g. freebsd)

make (as above you may need to use gmake instead of make on some systems)

Some of these steps may take a few minutes, especially on older systems.

Next you can either type

make install

This will install the eggdrop to /home/user/eggdrop (assuming your account is located in /home/user). Typing "pwd" at any time will show you the full path to your current location i.e. /home/user/eggdrop1.6.17

or If you would like to specify what directory you install the eggdrop in you can type

make install DEST=

example

make install DEST=/home/user/bot1

make install DEST=~/bot1

The ~ represents your home directory, and you can often, if not always shortern the full path by prefixing it with this symbol.

Enter the directory you just made:

cd ~/bot1

If you called your directory bot1.

cd ~/eggdrop

If you didn't specify a directory.

This next step requires you to read COMPLETELY through and make a config file to determine what your eggdrops name will be and what server it will be on. You will have eggdrop.advanced.conf, eggdrop.complete.conf and eggdrop.simple.conf in your directory. Copies of these files are made available for you to download on this site. If your not sure just go for eggdrop.simple.conf it really isn't that hard to edit, just make sure you read it through completely :-).

We will go into more detail regarding editing your config file later on.

Well now you have edited the .conf file you are ready to start your bot.

./eggdrop -m myfile.conf

Compiling Errors :-

One of the errors you might run into when trying to compile your bot could be with regards to the version of Tcl libraries you have loaded or the lack of such libraries.

Your Tcl version is much too old for Eggdrop to use. You should download and compile a more recent version.

or

There is no Tcl installed.

If you are sure that your tcl version is new enough to run the eggdrop then try compiling with the options below specifying the location of the tcl files.

If you are unfortunate enough not to have any tcl installed you can always download the latest tcl (Tcl 8.4.9 at the time of writing) and install it to the /tmp directory for a short period to allow you to compile your eggdrop. The latest version of tcl can be gotten from this ftp://tcl.activestate.com/pub/tcl/ . Follow the steps in the README file to install the TCL.

Again with this method you will need to specify the paths to the relative files as below.

./configure --with-tclinc='' --with-tcllib=''

Example

./configure --with-tclinc=/usr/include/tcl.h --with-tcllib=/usr/lib/libtcl.so

Couldn't Grab Nearby Port:-

If you get the above error the first thing to try is to change the port the eggdrop is listening on.

listen 3333 all

Try to choose a port number between 1024 and 65535 that you think noone else might use. Any random number in this range will do really, although try not to use the default value of 3333.

If this does not fix the problem try filling in the vhost - set my-ip "" and set my-hostname "" section of the config file. If you have already done this and the problem persists then if you are sure the details are correct, check that the vhost is still available on the system.

If this still refuses to work you can comment out the listen line. Your bot should still run, but you will be unable to telnet to it.

Editing your configuration file :-

To edit them you can either download a copy to your computer and use wordpad (or another text editor like metapad) - I always prefer to edit my config file locally. To edit the config file from your shell type "pico eggdrop.simple.conf". Once edited you can save the file as any name you like (myfile.conf for example - usually best to call it after your bot botname.conf)

Which ever config file you choose to edit below are some of the more important elements that require your attention

This will set the ident of the eggdrop if you do not have a identd server installed on the system.

set username "eggie"

This line is for information purposes only.

set admin "You "

Important - Designates permanent owner in the bots userfile, set to the nick you will identify to the bot with.

set owner "YOU"

The IRC network the bot will be on. Again this is for information purposes only, this information will be displayed when queried on a botnet.

set network "Irc.EFnet.Net"

The following lines are used to designate what files you want the bot to store relavent information about users, channels it is on and notes. I would suggest naming them after your bot to keep things tidy.

set userfile "botname.user"

set chanfile "botname.chan"

set notefile "botname.notes"

This sets what port the bot will listen on when you telnet to it and/or want to connect other bots with. I would always suggest changing it from the default 3333 setting. The value for this can be anywhere in the range of 1024 to 65535. Note that if you leave it at default and that port is already in use the bot will simply choose the next available free port.

listen 8788 all

The lines below will set what nick the bot uses and the name displayed in whois.

set nick "Eggdropbot"

set altnick "Eggdropbot_"

set realname "who am i"

The next imortant section is to add a channel that the bot will always join. Before you do that though I would make sure all the following modules are loaded.

loadmodule dns

loadmodule channels

loadmodule server

loadmodule ctcp

loadmodule irc

loadmodule notes

loadmodule console

loadmodule uptime

loadmodule irc

All of the above modules should be loaded by default so nothing to change here. Although without server, irc, channels, the bot will not join an IRC server.

loadmodule blowfish

The blowfish module is the encryption system that the eggdrop will use to store passwords and such. You will need an encryption module to run with your eggdrop, without one your eggdrop will not start. This line will normally be commented out so you will only need to remove the hash #.

loadmodule seen

The seen module is also commented out as default. This module is very basic and will only identify users that match the bots userfile. A better option to use the Bseen module from http://nasadude.dnsalias.org/choice.shtml

Other modules that are available are the gseen module - an alternative to bseen and the stats module. Both of these are available from http://www.visions-of-fantasy.de/eggdrop.php

channel add #mainchan {
chanmode "+nt-likm"

- channel modes to enforce

idle-kick 0

- should it kick idle users, set to 1 to turn it on, 0 to disable.

stopnethack-mode 0

- stop the server from opping people when a netsplit rejoins, 0 off, 6 most stringent.

revenge-mode 1

- should it take revenge on people who kick the bot, options 0 to 3

aop-delay 5:30

- how long should the bot wait before opping a user in seconds - 0 is not wait, 5:30 is a random time between 5 and 30 seconds.

flood-chan 10:60

- what constitutes a flood (example shows 10 lines of text in 60 seconds constitutes a flood)

flood-deop 5:10

- deop flood setting

flood-kick 5:10

- how many kicks constitute a flood

flood-join 5:60

- number of joins from a single host.

flood-ctcp 5:60

- ctcp flooding.

flood-nick 5:60

- nick change flooding.

}

Additional options that can be set on a channel:

channel set #mainchan -bitch -enforcebans -greet -revenge -cycle -protectfriends +seen

The follwoing are server settings telling your bot what server to join and what ports to use

set default-port 6668
set servers {
irc.efnet.net:6667
irc.easynews.com:6668
}

Well if you have edited those few settings that have been described here you should be able to run the bot without any trouble. One final note though, remove any lines in the config you choose that begin with die. These lines are there to encourage you to read as much as the config file as possible and the bot will not start without these lines removed.

Running an eggdrop for the first time

Wait for your bot to come to IRC and type "/msg mybot hello" or

Using the ip specified in conf (set my-ip) or the box's ip - if you have not specified one to use in the config and the port specified in the config (listen 3333 all as default) and connect to the bot via a telnet session. When prompted for a nick type "NEW".

Of course if you are running the bot off your windows machine its ip will more then likely be the same as yours.

Either of these methods will set you as owner on the eggdrop and you will be able to establish a dcc session with the bot "/dcc chat botnick", or "/ctcp botnick chat". If it does not accept a DCC chat you can try identing to the bot "/msg botnick ident yourpass yournick" or connect to the bot via telnet and monitor why it is refusing a dcc session.

TCL Scripts :-

You can add numerous extra functionality to eggdrops by using tcl scripts. There are thousands of scripts lieing on the internet including a few main databases (some of these are listed in our links section).


Obviously ready made scripts aren't necessarily designed for your specific needs and we have a short TCL tutorial up, which will guide you through some of the basics of tcl scripting. The tutorial will show you some of the basics allowing you to modify a script or even make your own.

Of course once you have the tcl script that you are looking for, you will want to load it onto your eggdrop. Open it up in a text editor (notepad, pico etc...) to make sure there are no settings/varibles that you need to change. These will normally be towards the top of the file (with perhaps a description of the script) and clearlly indicated in any decent script. If there are any settings that need to be set, do this and place/upload the saved file to your scripts directory.

Once the script is there open your config file (eggdrop.conf) and go to the bottom of the file. Here you will find a few lines like "source scripts/alltools.tcl". Under these lines add another line but obviously this time change the name to the script you just uploaded:

source scripts/somescript.tcl

Most scripts that you download will either be zipped (.zip) or in a tarball archive (.tar.gz, .tgz, .gz). You can uncompress these on your shell, or use your regular uncompressing utility on windows (e.g. winzip, winrar) and upload the file once uncompressed.

You can uncompress files on your shell as below:

.zip files

unzip filename

.tar.gz & .tgz

tar -zxvf filename

.gz

gunzip filename

.tar

tar -xvf filename

Crontab :-

The crontab command, found in Unix and Unix-like operating systems, is used to schedule commands to be executed periodically. It will check if your bot is running at intervals and restarts it if it has gone down for some reason.

Before you start setting up an eggdrop make sure the first line of your config files reads:

#! /path/to/eggdrop

Setting up crontab using autobotchk

Go to your scripts directory and type ./autobotchk /path/to/yourbot.conf

./autobotchk /home/user/bot1/eggdrop.conf -noemail -10

This should set up a crontab to check every 5 minutes if your bot is running and will not send you an email every time it restarts your bot.

Setting up using botchk

Go to the scripts directory and use pico or vi to open the file called botchk

Example

pico botchk

Edit the 4 lines it tells you to.

Then open a new file and add a line like:

0,10,20,30,40,50 * * * * /home/mydir/botchk

or if you don't want to get emails.

0,10,20,30,40,50 * * * * /home/mydir/botchk >/dev/null 2>&1

Once you have saved one of the above lines in a file you need to type:

crontab New_Filename

To list existing crontabs type.

crontab -l

In the new file you created for the crontab you will need 1 line, as above for each bot you have running on tthat shell and want to be able to have the crontab checking.

Handlen :-

By handlen we mean the actual length of a nickname the bot will support in its userfiles and on its partyline. If you do require your eggdrop to be able to support longer nicknames you will have to edit a source file. The source file in question is "eggdrop.h" and can be found under the /src directory. For windrops this is a moot point as they come precompiled in both 9 handlen and 32 handlen versions.

Open the file eggdrop.h in a text editor and search for HANDLEN. You will come across a line like below:

#define HANDLEN 9 /* valid values 9->NICKMAX */

All you need to do here is change the 9 to a 32 (I think that 99% of networks won't go beyond this nick length) and save the file. example.

#define HANDLEN 32 /* valid values 9->NICKMAX */

Once the line has been changed as above you will need to ./configure (or reconfigure the bot if you have already done this) and follow through with the usual prompts make etc... (./configure, make config, make, make install). You may have to run a 'make clean' prior to the make if you have ran the make process previously.

Once your eggdrop is compiled and configured as normal it should support 32 charachter nick lengths in its userfile once up and running.

DCC & Telnet problems :-

DCC Problems - Well this is one of the most common queries we get = "I can't DCC my bot. what can I do?". Unfortunately there is no short answer to this predicament.

Before you start to do anything make sure you can DCC chat with your friends. If you can not DCC your friends then it is not a problem with your eggdrop, but rather a problem with your IRC client.

There are 3 ways you can generally dcc/telnet your bot and access the partyline

/ctcp botnick chat
/dcc chat botnick
telnet IP/Address port

If you are dcc chatting the bot for the first time make sure you have said hello to it and set a password. You can always tell if you have been added to the bots userlist by opening the user file in a text editor and checking to see if you exist. There will be a line similar to "--PASS xon71l7991f5" under your nick if you have set a password.

The first thing you should try to do if your bot is not responding is to try to ident to it - note the handle below is the nick your bot would recongnise you by on the partyline (this will be limited to the first 9 charachters of your nick if your eggdrop has not been compiled to support longer nicks).

/msg botname ident YourPassword Handle

If you do not get any responce doing this you will need to telnet the bot and see if that gives you an indication as to why you can't dcc it.

open a command prompt and type:

telnet host port

Example

telnet 192.168.1.5 2254

Make sure you have got the correct host/ip and port information (from your config).

Having a router running, or being on a lan can cause many problems with opening a dcc/telnet connection also. If your trying to telnet to your bot on a local machine behind a router, also try your lan ip 192.168.0.2 etc..

You may need to forward your ports in this case to enable a DCC connection. The best place you can go for information regarding port forwarding is http://www.portforward.com/.

The default port settings in mIRC are 1024-5000, these can be modified to a small range that you desire to use. In your eggdrop config you can also specify what ports to use.

set reserved-portrange 2010:2020

Once your ports are forwarded try the commands above again to try and access the bots partyline.

Another way you can try and get an indication as to why your bot will not accept a dcc and/or telnet connection is to keep it running in the foreground and using your console to keep tabs on the partyline.

./eggdrop -nt filename.conf

The nickname used for the partyline in this instance will be HQ. From this point of view you can monitor the bots responces to your attempts to dcc and/or telnet to it

Timer Drift :-

When this happens you will see a message while you are on dcc chat like the folowing:

(!) timer drift -- spun N minutes

(!) timer drift -- spun 5 minutes

This means that your bot was unable to do anything for the last x minutes for some reason. This could be a result of a tcl script you have loaded that is running commands that the bot is waiting on a responce before continuing. Other causes can include a server with a high load and is extremely busy, thus not allowing the eggdrop to do its usual maintenance checks every few minutes.

On some systems (at least Linux), if the DNS your bot is using to lookup hostnames is broken and *very* slow in responding (this can occur if the DNS server's uplink doesn't exist), then you will get 4-5 minute timer drifts continuously. This can be fixed by loading the dns module.

Another cause would be that your shell changed it clock and the bot got confused that time had passed without it knowing, thus causing it to report the message above.

Generally a timer drift is considered a bad thing as the bot has been unable to do anything for the past x minutes, e.g. control a channel etc.. and it can cause the bot to "Ping Timeout" a lot, as it gets swapped out of memory for long periods.

The first thing you should consider doing is unloading any dubious script that you have loaded and see if that resolves the problem, beyond that it is a problem with the server that you are currently utilising.

Lost and Forgotton Passwords :-

Make sure you are typing the password correctly and using the correct handle... most eggdrops as default will only recognise the 1st 9 letters of your nickname. Also note the password is case sensitive so Password is different to PASSWORD, which is different to password.

If your bot no longer recognises your password, you can either remove the .user file from your shell and restart the bot in user creation mode (./eggdrop -m eggdrop.conf)

The second option available to you is to open up the userfile (somefile.user) and look for a line with your nickname in it. underneath your nickname you will see a line that will be similar to the following:


--PASS +2/SSy/rTPfU/

Note:Before proceeding note that your eggdrop must not be running when you modify the .user file or your changes are likely to get over written.

This is your password in its encrypted form. You need to remove this line and save the file. This will allow you to message your bot with a new password once it is restarted and reconnects to an IRC server.

/msg BotNick pass

Creating a Limbo eggdrop :-

Just comment out the following modules and your bot will not join irc, effectively making your eggdrop a limbo bot.

loadmodule irc

loadmodule server

loadmodule ctcp

loadmodule channels

You will only be able to access the bot by using its open telnet port, so make a note of the vhost and port number it is using before hand.


Hosting :-

Many people want their bots to stay online 24/7 to help keep an eye on their IRC channel. For this you need a reliable, bonified provider who has a constant connection to the internet. Some ISP's provide shells with their accounts, but the vast majority of these do not provide telnet/ssh access or do not have the relavent resources loaded on their shell to compile and/or run an Eggdrop.

There are many people who offer shells on the internet, but alas there are many scrupulous providers out there. As with anything you purchase on the internet make sure you leave yourself open to the least possible chance of being defrauded. Before purchasing anything check that the provider has contact details (address & phone numbers), so that you can easily get hold of them if anything goes wrong. Also check reviews from the providers other customers and shell review sites like shellreview.com. Finally make sure that the provider has been around for a while... theres nothing worse then someone who has just started up and disappeared a month down the line (i've seen it happen!). One final note, i have noticed some shell providers have untowards terms and conditions... always worth having a breeze through that before you part with your money.




2 comments:

vadim s. sabinich said...

http://faceless.tsua.net/mef/eggdrop/html/ Russian Eggdrop documentation

chaircovers said...

I found here some good stuff about How To Install EggDrop and some TCL`s