Table of Contents

~~TOC~~

The Lab46 Tutorials

Rene the Lady Bot

There's first love, and then there's Rene

Following the steps in this tutorial will lead you to the successful creation and customization of your very own IRC roBOT, complete with personality.

This is a time consuming process that is not for the faint of heart. Read carefully.

Requirements:

  • Some flavor of Linux/Unix or a shell account
  • Eggdrop v1.6.19 or later
  • The egg-fu .tcl script

Step 1: Get a bot

This tutorial specifically describes the process of getting and setting up eggdrop. Eggdrop is not the only bot available for free, however it seems to be the most documented. Here's how to do it:

From my Mac OS X shell, I used scp secure copy utility to copy it to the Lab46 server from my local computer. (not the only way to get it to the Lab46 shell, but effective)

:~$ scp -v /Users/$USER/downloads/eggdrop1.6.19+ctcpfix.tar.gz  $USER@lab46.corning-cc.edu:/home/$USER/

NOTE: Replace the '$USER' in the above lines with your user name on both systems, the one sending the files and the one using the files. This will likely be different for each computer.

NOTE: the -v technically represents debugging mode, however, when you're sending big files across the network, it's useful to get some extra information.

:~$ tar zxvf eggdrop1.6.19+ctcpfix.tar.gz 

Before extracting the files from the tarball, it is a good idea to create a new directory for your eggdrop. Otherwise, you'll have an awfully confusing home directory with lots of seemingly meaningless files that you may be tempted to delete. (Don't do it.)

:~$ cd eggdrop1.6.19
:~$ ./configure
:~$ make config

:~$ make
:~$ make install DEST=~/botdir

NOTE: The eggdrop tutorials suggest that the ~ in the above line might not work on some shells. This is correct, however a ~ will work fine on Lab46. In the case of systems where this does not work, use the fully qualified path /home/$USER/ where $USER is your username.

This step makes the entire directory an executable, which we're going to call at the end.

:~$ cd ..

:~$  chmod 700 botdir

Again, botdir is the directory where your bot is installed

Step 2: Configure It

This is a detailed run-down of all the lines in the .config file that can/should be changed. I've added line numbers to help reduce the time it takes to hunt and find each setting. However, please note, that if you used make iconfig instead of make config (in the above section), then your .conf file will look radically different from what is described here.

line 1: #! /home/$USER/botdir
line 26: set username "$USER"
line 30: set admin "My Name <email: $USER@your.domain.here"
line 34: set network "your.server.here" 
line 58: uncomment
line 58: set my-hostname "your.server.here"
line 130: Comment out
line 131: logfile mco * "logs/<botnick>.log
line 136: comment out
line 137:  set logfile jpk <#channel> "logs/<#channel>.log"
line 178: set userfile "<botnick>Bot.user"
line 182: set pidfile "pid.<botnick>Bot"
line 255: listen 59393 all

The default setting of 2 is a little too strict for some people's taste.

line 262: set remote-boots 1

Egghelp.org recommends setting this to 1 for greater security.

line 269: set protect-telnet 1
line 283: set require-p 1
line 292: set stealth-telnets 1 
line 305: set dcc-flood-thr 5

Now, a little net friendliness to put the network admins on our side.

00 represents the minutes (on the hour) when your bot will save its user file. Since there may be more than one bot on the network, resetting our hourly-updates to another number means that our bot will save its file at a different minute in the hour.

line 350: set hourly-updates 17 

Don't set this value to someone you don't know or trust.

line 354: Uncomment
line 354: set owner "$USER"

This is one of the gotchas that the authors of eggdrop put in there to make sure that a lazily configured bot doesn't take on a life of its own.

line 411: comment out

You can either do this here, or you can hard code the channels using the addchannel settings shown later. If you do decide to use a chanfile, set chanfile by replacing the double quotes below with “<channel>Bot.chan”. Note: The .chan file overrides channel settings in the config file.

line 453: set chanfile "botdir/<channel>.chan"
Lines 772 - 792: 

772: channel add <channel> {
773:	chanmode "+nt-likm"
774:	idle-kick 0
775:	stopthehack-mode 0
776:	revenge-mode 0
777:	ban-time 120
778:	exempt-time 60
779:	invite-time 60
780:	aop-delay 5:30
781:	need-op { putserv "PRIVMSG <#channel> :op me cos I'm Lame!" }
782:	need-invite { putserv "PRIVMSG <#channel> :let me in!" }
783:	need-unban { putserv "PRIVMSG <#channel> :let me in!" }
784:	need-limit { putserv "PRIVMSG <#channel> :let me in!" }
785:	flood-chan 10:60
786:	flood-deop 3:10
787:	flood-kick 3:10
788:	flood-join 5:60
789:	flood-ctcp 3:60
790:	flood-nick 5:60
791:}

792: channel set #<channel> + bitch +enforcebans + dynamicbans +userbans + dynamicexempts

Remove line 781 if you plan on deploying your bot on a channel where it cannot get ops. Otherwise it will keep asking for ops again, and again and again.

From here on out, your line numbers will likely differ from this tutorial, due to different (more or less) channel settings.

line 814: set nick "<botnick>"

Say the bot gets to its channel, and there's already someone there wearing the same red dress. No problem, your bot changes in the coat room.

line 819: set altnick "<altbotnick>"

If you're looking to cloak your bot, make sure you change this to something that represents what a human would write.

line 823: comment out
line 824: set realname "Hi, I'm <botnick>"
line 848: set servers{
line 849:   your.server.here:6667
line 850:}

This is the setting that tells the bot how often to establish a connection with its server. If you're sharing a server with others, it's best to leave this setting at 60. However, in the realm of Lab46, it's OK to set this to a lower number.

line 890: set server-cycle-wait 20

Setting learn users to 1 means that you have to add users manually before they can access your party line chat. Setting this to zero allows people to invite themselves. This could provide a path for misuse.

line 1048: set learn-users 1

By default, anybody can issue a /msg your bot with the 'hello' or 'ident' commands. This will most definitely flag your bot as a bot, and will also provide a back door for crackers, specifically if you have learn-users set to 0. Uncommenting lines 1066 & 1067 unbinds these commands and lines 1067 & 1074 re-bind these commands to new words.

line 1066: uncomment
line 1067: uncomment
line 1067: bind msg - <message> *msg:hello
line 1074: bind msg - <othermessage> *msg:ident

You can retrieve these notes using DCC & /msg commands.

line 1266: set notefile "<botnick>Bot.notes"
line 1288: comment out

botchk and crontab

After the bot's .conf file is created and configured it's time to set up your botck and crontab files.

First, eggdrop comes with a handy little checker called autobotchk that will take care of some of the diagnostic overhead. Running this file as an executable will allow eggdrop to predict compilation problems before compilation.

:~$ chmod 700 autobotchk 
:~$ ./autobotchk <botnick>.conf -dir /home/botdir -noemail

At this point, you should have a very clear idea of any other issues that need to be taken care of prior to launching your bot.

Sarting eggdrop

Finally, it's time to start this damn thing.

:~$ ./eggdrop -m <botnick>.conf

The -m in the command above tells eggdrop to create a user file for your bot. Once you've launched your bot, you can omit the -m.

Make sure you're in the channel before you launch your eggdrop bot, otherwise the bot will be the channel op, and may not share the bounty. Incidentally, if you do find that you need to kill the bot, simply type pw x at the shell. This will give you a list of running processes, each with a unique number and description. Find the number described as 'eggdrop' and issue the following command:

##
## find the running process
##

:~$ ps x | grep eggdrop

##
## kill it!
##

:~$ kill <proc>

##
##  where '<proc>' is the process number assigned to eggdrop.
##

Set Up

Once eggdrop has joined the channel that was set in the <botnick>.conf file, issue the following command from the IRSSI prompt:

Where <botnick> is the name given to the bot and <myword> is the /msg command that is assigned in the <botnick>.conf file.

/msg <botnick> <myword>

Follow this with: where <pswd> is your chosen password.

/msg <botnick> pass <pswd>  

NOTE: don't set your password in the company of prying eyes, as your password is shown as plain text while typing, and is then spit back out to the screen. Further, messaging the bot via DCC requires your password as well, and again, it is shown on the screen while typing it.

If your password has been plastered all over your IRSSI screen session, simply issue the command /clear. This will clear your entire screen.

Set up AI

Now, if you're reading this section, chances are good that you have a working bot. (If not, review the previous steps.)

Now, we can give our bot a personality. One of the easier (and more controllable) ways to do this is using he egg-fu script available at egghelp.org

Just as above, the scp utility is a handy tool for sending .zip and .tar archives across a network.

Unpacking the archive will create a new directory (likely named egg-fu_2.0.2) within your scripts directory. Navigate into that directory and open the egg-fu .tcl file (likely named egg-fu_2.0.2.tcl).

Interestingly, adding channels in bot's the <botnick>.conf file will cause your bot (and egg-fu) to listen and learn on those channels, however the bot will only talk on channels set in the egg-fu tcl file

line 58: set working-chans "#channel1 #channel2 #channel3"

Use this setting to tell your bot who NOT to learn from. Set this to the nicks of other bots or even other annoying people whose influence you'd rather avoid.

line 61: set other-bots "bot1 bot2 annoying_usr"

This line tells eggdrop what scripts to use at startup.

line 1368: source scripts/egg-fu.2.0.1/egg-fu.2.0.1.tcl

Find the wordfile line and set it to the path where you'd like to keep the brain.

line 64: wordfile "botdir/brain.txt"

That's it! All the other default settings are good to go.

Now, there are a few ways to get your bot to recognize the new script. If you haven't yet started your bot, simply start it, and that's it's ready to go. However, if you've already started your bot, you can either find the process, kill it and restart it, or simply rehash it.

To rehash your bot, enter the following commands from irssi

/dcc chat <botnick>

This will open a new window within irssi. Change to the new window (alt + the window number) and enter your password. After that, you can type .help to get a list of commands available to your bot. The command you seek is .rehash. Type this at the irssi prompt and wait. A few minutes later, your bot will be back and talkative.

Useful Tips

Detaching from a screen when there are multiples, means that you have to know the number of your session. However, naming sessions makes it easier to find and reattach to a session. When creating your screen session, do this: screen -S <name> but replace <name> with the name you want to give your screen session. Now, when you want to reattach, simply use screen -ls to list all the sessions. You should see very clearly which session is which. Now, use screen -r <screen_id> to reattach to one.

Other Useful Settings

These are a few other optional lines that might be useful:

You can set the file system permissions with line 221

line 221: set userfile-perm 0600

When using your bot in a botnet, lines 246 and 247 allow you to set which ports should be listened in on.

 
line 246: listen 3333 bots
line 247: listen 4444 users

If you have learn-users set to 0, it's a good idea to make sure that line 357 is set to $owner (default). Don't set this to your acual nick because your bot will actually ID you by your hostmask, which is set using the 'owner' setting (see above).

line 357: set notify-newusers "$owner"

You can comment out lines 379 and 380 if you wish to allow .tcl and .set commands from the DCC chat interface. (NOTE: make sure you choose owners carefully if you bind these commands.)

line 379: unbind dcc n tcl *dcc:tcl 
line 380: unbind dcc n set *dcc:set:

Setting the strict-host setting causes eggdrop to ignore the tilde (~) in usernames. This can add a bit of extra security, however, as eggdrop recognizes users by their hostmask, this setting can cause problems.

line 858: set strict-host 0

Set dcc-block does what it says, it blocks DCC chat commands. DCC chat provides a malicious intruder with a path to begin the password guessing game.

line 1145: set dcc-block 0

If you plan on installing any type of file system, these are the lines you seek.

line 1230: set files-path "/home/mydir/filesys"
line 1235: set incoming-path "/home/mydir/filesys/incoming"

Conventions Used