|
|

The Undernet Botdocs: An Introduction to IRC Bots
originally by Super, last revised by loki
mIRC section by Suzy-Q
What should I know before reading this?
The most important thing is to know what IRC is. If you are not sure, check
out the Usenet group alt.irc, or pick up your favorite guide to the
Internet. The second step is to read an IRC primer of some sort. Check out
the Documents Project website for more info on all of this, or on IRC, check out some of the help services on #help.
What the heck is a bot?
This is one of the most common questions that appears on channels or
newsgroups dealing with IRC. Bots are clients that have automated responses
to certain commands (they are just a bunch of scripts). Confused? You
should be. Hopefully this will be clear as we continue.
How does a bot work?
Normally a bot contains scripts of "on" commands that react to particular
events on IRC. A simple one that people might use in an ircII client
is:
on join * /whois $0
What this does is tell you who the person is when they join a channel. That
is how a bot works: you tell it to do particular things on the occurrence of
particular events.
How is a bot run?
Bots are normally separate processes from your normal client. However, you
can be the bot if you wish by simply loading the bot script into your
chatting client rather than another copy of it.
What good is a bot?
There are various opinions on what bots are good for. Most people use bots
to aid in controlling a channel by managing the distribution of ops through
an oplist. Bots can also be great information tools such as Helpbot (which
sends out help documents like this).
Does this mean bots can do more than I can?
No, bots are just users; they can only do what you have access to. So
running a bot does not mean you can get ops on a channel that you don't
presently have ops on.
What about these "Warbots"?
There are a lot of malicious people out there that have created bots that
"take over" channels. What these bots are designed to do is join a channel
and try and force a netsplit to get ops or flood out all of the users on the
channel. Fortunately on the Undernet, timestamping prevents this from
happening (see the Undernet FAQ 2 for more
info). Running bots that are malicious will get your site K-lined pretty
fast, which means you (and everyone else from your site) will not be allowed
to connect to Undernet servers. Good rule of thumb: Don't run
warlike/malicious bots.
Where can I get a bot?
There are a lot of different bots out there. These bots were all written by
other people. As described above, there are malicious people out there:
some of them must have written bots that aren't warlike, but do have
backdoors. What this means is that they (or someone else) has programmed in
a loophole in the bot to let them can take over your bot, and most likely be
able get access to your computer or account from this.
How can they do this?
Simple. Remember, bots are just like you. They have access to the same
stuff you do, so they can do the same things as you. When you are on IRC,
you can do everything and anything to your computer (or for Unix users, your
account). Well, so can your bot. If you run a bot that someone else wrote,
it is possible that you are allowing them (or someone else) access to your
account through the bot.
What are you trying to say?
If you are going to run someone else's bot, read through the script. Find
out what it is doing. Better yet, run your own bot. Write it yourself to
do the things you want it to do. One day someone might want to run the bot
you write, and if you write it yourself you can be sure that there are no
malicious backdoors in it to allow other people to grab control of your bot
and possibly access and damage your private files.
Ok, so how do I write this thing?
There are many different ways to write it. Bots can be written in many
different languages, such as Perl, C, or TCL. If you are just starting
out, it's best to use the scripting language of your particular IRC client
(ircII, mIRC, Pirch, ircle, etc.) since they are usually easier to use and
debug.
I am still unsure of how to write a bot. Give me another hint.
Sure. Before you write a bot, you should be thoroughly familiar with IRC
and the commands available. The best way to start is to read the help manual
for your IRC client and understand how its scripting works. From there you
can learn what scripting facilities are available and how to put a script
together. The next step is to write a script to test what you've learned.
Don't try to do too much at once. If it works correctly, slowly add new
features to the bot, testing them as you add them to make sure they work
properly.
Do I want a bot?
This is not really a frequently asked question, but it should be. It seems
that a lot of people want bots but have no clue what to do with them. Ask
yourself what would you use a bot for. Most people use them to hold their
channels open and for better stability and control of their channels. Do you
have a channel that *needs* a bot? Don't forget that the Undernet provides
a channel registration and
service bots (X and W) to help users keep channels open and stable. This is
better because someone else does the hard work of running the bot 24 hours a
day and and leaves you free to chat! Keep in mind the dark side of bots. By
running a bot, you are slowing down everyone, especially yourself.
How is this possible?
When you run a bot, it is just a user. The more users that are connected to
IRC servers, the slower things get because more information has to be
transferred. On your end, you now have two processes running on your
machine. The more processes you have running, the slower things will be --
not only for you but everyone else.
So what are you trying to say?
Think about whether you need to run a bot or not. Will it be useful to you
and everyone else? Clean up failed attempts at running bots. The best way
to do this is include a die command in your bot. A simple example for a die
command on a bot named Diebot:
on msg "Diebot die" /quit Dead!
So all you have to do is /msg Diebot die, and the bot will sign off
so you won't have to kill the process.
How do I clean up my old bots?
For Unix users, find the process id (PID) of the bot. Try typing ps
-x or ps -af | grep irc. Once you find the PID, do a kill
-9 pid. For example, if the process ID was 1234, you'd type kill
-9 1234. For Windows users, you should be able to shut the bot down by
selecting Quit from the File menu. Or you can press Ctrl+Alt+Del, select
your bot from the list of currently running programs and click "End Task."
Is that it?
Yes. Hopefully by now you understand what a bot is and how it works.
Remember, this is just an introduction to bots.
Where can I get more info?
Reading the newsgroup alt.irc.bots is a good
place to find information. Reading through other people's bots' code and
scripts is a good way to learn. There are also various IRC channels on the
Undernet devoted to scripting, and you can also try asking in help channels
devoted to your client (#mirc, #ircle, #ircII, etc).
What about mIRC bots?
There are bots available for the popular chat client mIRC. You can find
these types of bots by doing a web search on the WWW or asking in #mIRC on
IRC. You can also try BotSpot for
many useful tips and lots of information on bots in general.
There are MANY types of mIRC bots out there. I suggest that you do
some research before downloading and using any type of bot. A lot of
bots can cause you trouble on IRC, so you want to make sure that this
bot is not one of them.
Another type of mIRC bots are the F-Serve bots. These are bots that
take advantage of mIRC's DCC capability. They act like servers, which
allow other users to download files from you. This can be dangerous,
though, because people may get into your private files, something you
obviously do not want to happen. Also people might upload bad files
to you, causing something to happen to your computer.
When you get an F-Serve Bot, make sure it has good protection. The
most popular nowadays is the Hawkee F-Serve Bot. The next bots are
the types of bots that keep the bots alive; they are the entertainment
bots. These can range from Bar Bots to Game Bots -- even Casino Bots.
These bots are used for the chatters' entertainment. But be warned:
they can get annoying, because some people don't find it nice when
they enter the channel and get a /notice message from the bot. Bots
were intended to help the user, not to become the user.
To use a bot, first you must have mIRC, then create a directory for
the bot you are going to use. Next, copy your mIRC16.exe or the
mIRC32.exe (depending on which you have) into the new directory you
made. Then copy the bot files into that directory. There should now
be your bot files and the mIRC executable file in the new directory
that you created.
After that, start mIRC by running the mIRC executable that you copied
to the new directory. mIRC will start as normal, but now more
options will be available, and your new bot is ready to go.
"Undernet Botdocs" © David Low
Last revised with permission by loki
No revisions permitted without express permission from the author.
"What about mIRC Bots?" section
© 1997
Undernet User Committee.
Return to main Documents Project page
|