Project Title: tecBOT Project


Project Author: Adam Schemanoff


Module Title and Course Code: PROJECT CITN257


Course: FdSc Computer Networking


Project Supervisor: Catharine Seidel


Submission Date: 16/05/2008









Content Page

Content Page 2

Abstract 3

Background history 4

The problem area 4

What is an IRC server? 4

What is an IRC bot? 4

What is an IRC bot net? 5

What does this have to do with cost? 5

What is an IRC Shell account and how much does it cost? 6

So what’s the problem? $2 to $4 USD is not a lot of money 6

Project Plan 7

Objectives 7

Scope 8

Evaluation criteria 9

Research on possible solutions 10

Programs 10

Eggdrop 10

mIRC 12

psyBNC 15

Analysis of the research 17

Which solution to use 17

How I came to this conclusion and how I analysis the data 17

Method of progression 19

Backend Design 19

What tasks it needs to be able to perform 19

Front End Design 20

What tasks it needs to be able to perform 20

GUI designs 21

Implementation 22

Setting up backend 22

Setting up the bot net 23

GUI setup 24

Maintaining 27

Testing 28

Stability 28

Swearing 29

Hacking protection 31

Evaluation 32

Conclusion 33

References 33

Bibliography 35

Appendix 37

Backend code 37

Frontend Code 38

Schedule 47

Activities: 47

Summary: 50

Manually tecBOT configuration 51

IRC Background History 54

Installed psyBNC 56

psyBNC Scripting Tutorial 59

Testing logs 73

Stability testing logs sample 73

Swear word testing log sample 78

*nix Shell accounts 78



Abstract


Currently IRC Eggdrop bot’s are used to monitor and maintain IRC channels on IRC servers. They can be used to automatically administrate chat rooms as well as perform other activities which have been coded for them in the TCL scripting language. Many Eggdrop users will run bot networks or Eggdrop bot’s, which will use a number of integrated Eggdrop bot, bots to increase efficiency. The current problem with this is that Eggdrop bot’s are expensive to run, requiring one background process per bot on a Unix based operating system. As most Eggdrop bot user’s use Unix based shell accounts to run there bot’s off, this means that they are forced to pay around $2.50 USD per background process, per month, they use which can prove to be expensive when running large bot networks.


The aim of this project is to create a stable IRC bot network that will nut off a single background process on a Unix based operating system. The bots must be able to work both independently and within there bot network to be able to be able to monitor and maintain an IRC channel. Ideally, each individual bot should also be able to handle separate scripts which will enable them to handle specific tasks.

Background history


The problem area


What is an IRC server?


IRC provides a way of communicating in real time with people from all over the world. It consists of various separate networks of IRC servers which are machines that host IRCd’s. IRCd’s are the IRC server code, run on a server machine which will allow users to connect to IRC via there IRC chat client.


What is an IRC bot?


The word “bot” stands for “Robot”. A bot is a piece of programming code which has been designed to perform a set task or tasks. There is currently a vast amount of different types of IRC bot’s, which all have there own functions and have all been coded in a number of different programming languages, to run on a number of different operating system’s, coded by a number of different people. The one thing that IRC bot’s all have in common which makes them an IRC bot is the fact that they are a piece of programming, set to perform a set task or tasks on an IRC server which they must connect to.


What is an IRC bot net?


An IRC bot net is a term commonly used to describe a collection of IRC bot’s which have been programmed with the task of interacting with each other; these bot’s work together to perform set tasks. The most common task that an IRC bot will be programmed to perform is to monitor and administrate an IRC chat room channel. They do this by scanning all text for key words which may contain banned content for that chat room or server (e.g. swearing). They will also protect the channel from malicious action such as multiple forms of “hacker” abuse or attack. The bot is programmed with the ability to kick users from a chat channel, ban users from a chat channel and set certain chat channel modes and restrictions. By using a bot net, then a server admin (or room admin) may protect a number of rooms at the same time from certain difficult users. E.g. If a user is banned in one chat channel, by one chat bot, they will then be banned in all other chat channels that other bot’s in the bot net have been set to moderate. This will stop malicious users simply going from one chat room to another; disrupting chat. This is just one of many uses for an IRC bot and IRC bot net.


What does this have to do with cost?


For an IRC bot to be effective you must have a 99.9% uptime which is hard to achieve on a home network. Also due to many IRC servers imposing connection limits per IP address, this means that to run a large amount of IRC bot’s you will need access to a large amount of IP addresses. With all this considered, it leaves few hosting options available when considering running an IRC bot net. The only option available is to rent an IRC shell account.


What is an IRC Shell account and how much does it cost?


An IRC Shell account allows you to access a certain amount of resources and space assigned to you on a UNIX based server. These servers most commonly run Linux operating systems, but they can also run BSD and UNIX operating systems. The server is hosted by a company, which tend to run these servers out of big server farms with large bandwidth connections and high uptimes. As a standard rule you will pay per background process for a shell account. The normal charges are around $2 to $4 USD, per month, per BG (background process). The main difference between a normal server hosting package and an IRC shell account is that an IRC shell account gives you access to a wide range of Vhosts. A Vhost is an IP address which has had a domain name assigned to it which can then be used by any user of the server to connect to the internet through, via a specified application.


So what’s the problem? $2 to $4 USD is not a lot of money


The problem is that although $2 to $4 USD per month sounds small; when it is considered that1 BG will only run 1 bot program it becomes evident that it will not be that inexpensive. The most commonly used IRC bot program is currently called Eggdrop, which is one of the few IRC bot programs which will support bot net’s and run on IRC Shell accounts easily. This is a problem however because Eggdrop will only run 1 IRC bot per 1 BG. This means that to run a bot net of 50 IRC bots you will need to pay for 50 BG’s each month. This is a rather expensive way of moderating chat room channels, which would I believe could be drastically cut down by being able to run large bot net’s on a single IRC Shell account background process.


Project Plan


Objectives


The objectives of this project is to create a stable IRC bot net which will run a large amount of IRC bots, in a stable bot net, on a single Unix based background process.


Each individual bot within the network must be able to moderate its specific IRC chat room from room violations. This will include monitoring the chat room for swear words within chat text and possible hacking attempts. When a chat violation is identified, the bot must be able to take appropriate action against the offending user.


Additionally each individual bot must be able to pass back information on chat offenders to the rest of the bot net so that all bots on the bot net are able to take actions against the same user in the chat room that they are monitoring. This is done in the case of channel bans, where a malicious user can be automatically banned from all channels monitored by the bot net.

Scope


Firstly I will need to be able to run multiple IRC bot’s off a single BG. This will involve researching current IRC related technology to ever find a current IRC application which does this, find a current IRC application which I can convert to do this or program a new IRC application to do this.


Next I will need to create a quick and easy to use way of setting up multiple IRC bots on a selected IRC network. My current plan to achieve this will be to program an add-on for the IRC chat client mIRC which will interact with the IRC bot technologies to create a number of IRC bots. I intend on programming this program using mIRC’s own internal scripting language. The program will include backend technology to run the bot creation operations and some front end technology to provide an easy to use GUI (Graphical User Interface).


Finally I will need to configure each bot to be able to operate in an IRC bot net. I will configure each bot to be able to perform simple chat room moderation tasks and interact with its fellow IRC bot’s within its bot network. When configuring each bot I will also need to take into account security issues relating to bot administration and the type of task demand that will be needed for each bot. I am unable to specify how I will configure these bots yet as there configuration will depend on the technology I run them on from the server back end.



Evaluation criteria


The success of the this project will be measured by its ability to run a stable IRC bot net on a single background process of a UNIX operating system based IRC shell account. The bot net must be fully functioning with the ability to help moderate and monitor live chat rooms on an IRC server. Each bot within the bot net must be able to interact with each other to form a stable network of moderation on a number of chat room channels at the same time, allowing them to perform set tasks simultaneously within each chat room they are monitoring. The bots must also be able to react and take action to set events within a chat room and to inform the other bots within their network of any action they have taken (if needed) so that they may perform the same action in their own chat rooms; e.g. banning a user for breaking terms and conditions of use of the chat room or server.


I will measure the effectiveness of each individual bot on the network and the bot net as a whole by running a number of tests on the active network. These tests will involve posing as a disruptive user within each chat room in which the bots are set up to monitor and log the reaction that the individual bot and bot net as a whole takes to me. I will also monitor the time it takes for the bot to perform such actions (if any) to test for stability and any lag issues that may have arisen with on the bot net itself.


Research on possible solutions


Programs


When looking for possible solutions to the problems raised by this project I looked at many different applications and current products on the market. The three I have listed below are the ones I find to have the most potential.


Eggdrop


Features

Answers

Cost

Free

Background processes needed per bot

1

Currently supported project

Yes

Open Source

Yes

Works with Vhosts

Yes

Works with IPv6

Yes

Work with SSL

Yes

Multi language support

Yes

Language programmed in

C

Native to which operating systems

*nix

Stability rating out of 10

10

Script languages used

TCL

Bot net support

Yes

[Eggdrop 2]

It is not surprising that Eggdrop Bot is the market leader in IRC bots when you consider the many features it offers.


Eggdrop was created in “December of 1993 by Robey Pointer, for the EFnet channel #gayteen. Eggdrop started out as an efficient substitute for cEvin, Jamie's IRC bot which was reaching limitations due to its script based design.” [Wiki Eggdrop1]. Since 1993 when the first Eggdrop bot was created its success and popularity has continued to grow. Now both IRC Administrator’s (IRC Opers) and IRC users use this program on a day to day bases to help them administrate there IRC servers and channels. The success of this project has come from its constant support and development.


The Eggdrop bot has two main features that have lead to its prolonged success. Firstly, Eggdrop is able to be used in a bot net. This feature alone makes it a very powerful tool for all IRC administrators and power users who run multiple channels. Eggdrop bots will most commonly communicate with each other via a DCC party line, which is a DCC private chat set up between each bot on the network. This allows them to assess data between themselves in private and via this party line the owner of the bots is also able to control them. The main drawback to this feature is that unless port forwarded specifically most modern routers and firewalls will block DCC connections.


The second greatest feature in Eggdrop bots is its support of TCL scripts and models. The TCL language itself is used far beyond just Eggdrop bots, “TCL (Tool Command Language) is a very powerful but easy to learn dynamic programming language; suitable for a very wide range of uses, including web and desktop applications, networking, administration, testing and many more. Open source and business-friendly, TCL is a mature yet evolving language that is truly cross platform, easily deployed and highly extensible.” [TCL 1]. It is an object orientated language which will work on multiple operating systems. It is also interoperable with C, C++ and Java. The choice to use TCL as the scripting language for Eggdrop, means that it is easy to develop and that there are many programmers out there that can already help in developing new scripts for the program.


Eggdrop is not without its down sides however; it may be a great single bot program and very good in a bot net, but it has two big draw backs. Firstly Eggdrop requires a large amount of system resources in comparison with other IRC bot programs. Egghel.org, one of the main supporting websites for the Eggdrop project says that, “Eggdrop is not a simple bot, so don't expect it to run inside 100KB of memory. The bot is quite complex and packed with features, making it the Microsoft Office™ (a la resource hog) of IRC bots.” [Eggdrop 2]. This makes it hard to run a large bot net off a single *nix shell account, instead requiring many to spread the resource load over a number of different systems.


The second and most serious limitation to the Eggdrop bot is that it requires a single background process to run each bot. The aim of this project is to create a bot net that will run on a single background process. To be able to achieve this with Eggdrop bot, it would involve reprogramming the original code. As Eggdrop bot is already quite resource hungry, I believe to try and do this would take longer then coding an entirely new solution.


mIRC


Features

Answers

Cost

$20 USD

Background processes needed per bot

1 per mIRC, 8 connections per mIRC

Currently supported project

Yes

Open Source

No

Works with Vhosts

No

Works with IPv6

Yes

Work with SSL

Yes

Multi language support

Yes

Language programmed in

Unknown

Native to which operating systems

Windows

Stability rating out of 10

8

Script languages used

mIRC Scripting Language

Bot net support

No


mIRC is the worlds leading IRC chat client, having been downloaded over “eleven million times from CNET's download.com service as of January 2008” [CNET 1].


The mIRC chat client is developed by Khaled Mardam-Bey and was first created in 1995. It’s reported that he “decided to create mIRC because he found the first IRC client for Windows, WinIRC, lacked some basic IRC features. Then he continued developing it due to the challenge and the fact that people appreciated his work. The subsequent popularity allowed him to make a living out of mIRC.” [Wiki mIRC 1]. Due to Mardam-Bey making a living out of the mIRC project, he has decided to charge a one off subscription fee of $20 for the right to use the mIRC application. However, in my 10 years of personal experience in using this product I have encountered few other mIRC users who do register the product and pay the $20 fee. The program itself does not force you to register, but does give you a 30 day evaluation trail period before it starts opening up a nagging window to remind you to register the program, every time you start the program up.


It is fair to say that mIRC has become so popular because it provides both a simplistic fascia and it offers an extreme amount of customisable options for even the most hard core IRC user. The program itself allows you to change colour settings and layouts, as well as allowing you to set up how it will react to pretty much every action IRC can perform, however when compared with the flexibility of the mIRC Scripting Language, this is all fairly insignificant.


The mIRC Scripting Language is extremely powerful and with the aid of .DLL files will allow you to control many areas of your windows operating system, not just the mIRC program itself. Built in and easy to use socket support also allows for the creation of internet applications. Like the mIRC program itself, the mIRC Scripting Language is remarkable simple when compared with other programming language’s, but also offers too many functions within it, that it’s also extremely powerful. It’s this scripting language that has lead to many people using mIRC to run IRC bot’s for there respective IRC channel’s.


However, mIRC was not built for bot hosting. Where it does offer up to 8 connections to the same or different IRC servers per mIRC application open, this is not a great deal when compared with other IRC bot programs. mIRC, running on a Windows based operating system, becomes less stable then using it on *nix. You can run mIRC within WINE in Linux but this reduces its stability even more.


A bot net program could easily be scripted into mIRC but for the best results you would need to run multiple mIRC’s on a dedicated windows server. This would mean sparing a lot of resources for a bot net that would not be as stable as its competitive programs. In addition to this, mIRC does not offer direct vhost support itself, you would need to run a *nix shell account, running BNC or psyBNC to route the bots through, so that they would each be assigned their own IP address.



psyBNC


Features

Answers

Cost

Free

Background processes needed per bot

1 for up to 99 connections

Currently supported project

Yes

Open Source

Yes

Works with Vhosts

Yes

Works with IPv6

Yes

Work with SSL

Yes

Multi language support

Yes

Language programmed in

C

Native to which operating systems

*nix

Stability rating out of 10

10

Script languages used

psyBNC Scripting Language

Bot net support

No



psyBNC is one of the worlds reading IRC Bouncer programs. This effectively means its an IRC proxy server application which some additional features. The psyBNC website says that “psyBNC is an easy-to-use, multi-user, permanent IRC-Bouncer with many features. Some of its features include symmetric ciphering of talk and connections (Blowfish and IDEA), the possibility of linking multiple bouncers to an internal network including a shared partyline, vhost- and relay support to connected bouncers and an extensive online help system. Many other helpful functions are included. It compiles on Linux, FreeBSD, SunOS and Solaris.” [psyBNC 1].


Like Eggdrop bot, psyBNC is covered under the GNU General Public License (GPL) making it a member of the open source code family. The project itself is reportedly still supported and there are a number of people in the psyBNC IRC channel on IRCnet who are certainly willing to help you with basic support questions, however there has not been a new release of the program since 04/06/2005, which was version 2.3.2-7.


While psyBNC is not an IRC bot program itself, it is designed to support an IRC bouncer; it offers great possibilities to be used as an IRC bot program. One of the features that would allow this to happen is its in built psyBNC scripting language. Although this language has not been widely adopted and used like the mIRC Scripting language, it still offers enough functionality to run many standard IRC commands. Also psyBNC scripting offers the possibilities to call over programs and scripts from it, such as programs written in C.


The most interesting thing about this program is that it offers up to 99 stable IRC connections per single background process. Utilising all these connections at the same time, in conjunction with a good vhost list, supplied by a *nix shell account would allow the user to connect a large amount of connections to a single network or multiple networks at the same time.


psyBNC has many features, but I don’t believe it has ever been used to its full potential; it is not the easiest program in the world to use, it requires a good understanding of Unix bash commands to install and operate in its shell environment. It does offer a great deal of possibilities however and ingenious tweaking could be made to support IRC bots in the way I require them to be utilised.


Analysis of the research


Which solution to use


After a great deal of study into the above listed three programs and a good many other IRC programs I have come to the conclusion that this project needs splitting up into two parts. The first part will be a backend part which will host the bots on a *nix shell. For this backend I intend to use the current psyBNC application and adjust its features to my own needs.


For the second part of the solution to this project I intend on creating a front end mIRC add-on script, which can be easily installed into any mIRC client. This will enable the user to monitor and maintain the bot net, as well as being able to set it up from this easy to use frontend.


How I came to this conclusion and how I analysis the data


Coming to this conclusion was easy for me. I went through the list of features which I wanted my tecBOT program to have and then compared them with the features that each of the three main options had.


The first and most important of my specifications for this project was for the bot net to be able to run on a single Unix based background process. psyBNC is the only one of the three choices which I had shortlisted which offered this ability to any great degree. mIRC offers too few bots per background process and would become unstable running on a Linux operating system also the amount of time it would take to reprogram Eggdrop bot would be longer then it would take to program a whole new application.


As I have just acknowledged, stability was also a deciding factor. psyBNC offers the best stability options for a program running multiple bots from a single background process. It is also able to run on all Unix style operating systems as specified by my specification.


psyBNC does not however provide any current support for IRC bots or a bot net, it does however have its own scripting language which should help me facilitate this. This application also has the benefit of being an open source code project, covered under the GNU General Public License (GPL) licensing agreement, which will allow me to make any alterations to the program code that I need to make it work. I will be able to do this due to the program being coded in the C programming language, a programming language that I have covered on my Foundation Degree in Computer Networking.


I also decided to split this program into two parts; I will use a mIRC front end due to the simple fact that more IRC users use the mIRC chat client and use a windows based operating system then any other chat client or operating system. Making a mIRC script add-on will allow my program to be more easily accessible to more people. I should also be able to do this easily as I have been programming in the mIRC scripting language for around 10 years.




Method of progression



From this point on I will start designing, programming and then implementing my project. I am aware of the features I wish to build into tecBOT and what programming languages I will need to build these features in.

To be able to effectively adapt the psyBNC program to perform IRC bot tasks, I will make sure that I consult heavily with the IRC protocols, making sure that I get all server side commands correct when constructing the command lines for each bot script within psyBNC. I will also be consulting heavily with the mIRC help files on scripting to make sure all my commands and dialogs are properly constructed.


Backend Design


What tasks it needs to be able to perform


The first thing that needs to be done for running tecBOT will be to find a suitable IRC shell account host and then install psyBNC within this shell account. Installation of a psyBNC may all be done from a windows operating system using a SSH remote client to log into your *nix shell account. I intend to use the SSH remote client PuTTY.


When psyBNC is installed, the next step is to create the necessary steps to allow psyBNC to act as tecBOT by running a IRC bot network. I have found that the answer to this lies within the psyBNC scripting language and the account setup for each psyBNC user account.


The scripting features in psyBNC are run from user profiles within the program. When a new user is added to psyBNC, they are assigned a user ID number, which will range from 01 to 99. These user IDs can be used to assigned individual scripts to each user on the psyBNC. You may also use a default user value of 00 to assign all users the same single script. I will use this feature to run and control my IRC bot net by scripting command and control scripts into this default user value. This command and control script will be in essence, the heart of the tecBOT project, turning a basic psyBNC into tecBOT.


Front End Design


What tasks it needs to be able to perform


To aid in the bot net creation process I intend on creating the front end in order to easily add whole bot networks onto an IRC network, after the backend has been installed on a server. By automating the system, I will save a dramatic amount of time and effort, as the front end will assign an ident, password, nick, away nick, vhost, IRC server and IRC chat room to each bot atomically.


The GUI on the front end program must be simplistic and easy to use as well as offering all the basic administration options that will be needed to run a successful bot net. This includes; instructing all bot’s to ban and kick a user, changing room modes, making bots message or notice other users and making bots move rooms.

GUI designs


Using the tab features in mIRC Scripting Language I believe it would be best to create my GUI, using two tab’s, in the same dialog. This should make it easier to follow and I can then split the features of the dialog into two distinct fields; one for the administration of the bots and one for the creation of the bots.


I will endeavour to create my GUI to look like the following sketched designs.


Admin Tab


Bot Configure Tab


Implementation


Before you can install the tecBOT backend scripts you need to install psyBNC on your Unix based shell account. This is covered in my appendix.

Setting up backend


In your shell go to the directory: /psybnc/scripts
Now type: pico -w
This will open pico, which a notepad style program in unix/linux/BSD.

Copy the backend command lines, found in the appendix into pico.

Now replace *!*testing@* with the host mask you wish to use to control the bots. The example host mask used would only let someone control their bots if their IRC IDENT was “testing”. If you wished anyone to be able to use them you can leave the host mask as *!*@*

You will also need to change “password” to the password you wish to use for all the bots on the bot net so that they are able to identify to nickserv.

Now save the file in pico by pressing Ctrl and O, save the file as DEAFULT.SCRIPT . It is very important that you use capital letters when writing the file name or it will not work.

Then exit pico by using Ctrl and X .

You may now disconnect from your shell by closing PuTYY.



Setting up the bot net


There are two ways of setting up the bot net from this point. You can do it manually, using mIRC to connect to your psyBNC to give it raw commands, or you can do it via the tecBOT GUI that I have created. The tecBOT GUI is based on a manual version, which can be found in the appendix.




GUI setup


Setting up a bot net using the automated GUI front end is very easy and when compared to the manual version, it incredibly time efficient.


First you call the GUI using the tecBOT button in nick, which will appear in your nick list menu when you right click in mIRC. Next you click on the Make Bots tab, to get to the make bots menu.


You are now able to set up between 1 to 99 bots. The default amount is 50, set by psyBNC when you set it up. You are able to change this by logging into your shell account and changing it in your psyBNC configuration’s. For this example however I will be using the default of 50.


You now need to enter a nickname list. You can do this by pressing the Nick Dir button. I advise you create you nick lists in notepad files and there should only be one nick per line. After you have set up a nick list you will need to set up an ident list, this will correspond with each nick in your nick list. e.g. you need the same amount of idents as you have nicks and in the same format as the nick list file is in, one ident per line. You can not duplicate nicks or idents, each one needs to be different.


You now need to set the line to start on from the ident list. The ident list and nick list will track each other, running on the same line when creating bots. If this is the first time you have run this list then you should leave the ident line number as 0.


Now enter the psyBNC server and port number. You should have saved these from earlier.


Now is the most complex part and will require a basic knowledge of computer networking. Each bot on the bot net must be assigned its own IP address in the form of a vhost. To do this we find the IP range of the IP address in the vhost, by looking at the vhost list you copied down earlier. For example, your vhost list may start at 86.34.5.0 and finish at 86.34.5.255. In this example I would enter 86.34.5 into vhost IP range and then enter 0 in vhost Range start. This will mean it will start assigning IP addresses to each bot on the bot net from the start of the IP range of the hosting company.


You now need to enter the bot channel that you wish these bots to join and the password you wish to implement for each bot. The password should be the same as there psyBNC password.


Finally add in the IRC server and port you wish them to connect too and then press start.


The program will keep running; creating bots in sequence, in a low speed creation run, so as not to lag out your shell account or trigger the IRC server you are connecting to security features. The front end will stop creating bots when it ever runs out of nicks in your nick list or you press the stop button. When stopped in this way the program will echo your mIRC client with the line number that it stopped on.


Maintaining


tecBOT requires very little maintaining once set up. However there are some raw commands which can be used with them to better customise the bots to you, without having to add in extra psyBNC scripts.


The commands that you may wish to use and what they do are as follows:


!command JOIN #channel

This will make the bots join the specified channel.


!command PART #channel

This will make the bots leave the specified channel.


!command SRELOAD

This will force the tecBOT to view and run any changes made to the DEFAULT.SCRIPT file.


!command AUTOREJOIN 0
This will turn off auto rejoin on the tecBOTs, stopping bots rejoining channels they have been in before.


!command AUTOREJOIN 1
This will turn on auto rejoin allowing bots join any channel they have been in before after they reconnect to a server, or after one minute of leaving a channel, including being kicked from a channel.


!command ADDSERVER irc.icq.com :6667
This would add the IRC server irc.icq.com to the tecBOT server list, to connect on port 6667.


!command JUMP
This command makes the tecBOT bots move to the next server in their server list. They will disconnect from there current server and then reconnect on the next server, rejoining all the rooms they where in on the precise server.


Testing


Stability


The testing for how stable the bots are has been rather easy. Since loading up three test bot nets of 50 tecBOTs each they have remains on a 100% up time. No bot has crashed or been pinged out the IRC network and they have even stayed connected during net splits on the IRC test server that I have been using on AOL’s irc.icq.com.


I have tested the bots ability to handle multiple commands in quick succession, giving them NOTICE commands to send to each other in quick succession. This was a test of their processing power in both handling and sending data. The results were continuous 100% up time even when command spacing was raised to 1 second between commands for one minute. That is to say the bots where able to effectively send the commands given to them and receive and process the incoming text with a limited lag time of no more than 1 second.


The lag time and stability of tecBOTs seem to be unaffected by the software, but directly affected by the hardware and network infrastructure they operated on. By using Unix based shell accounts, from dedicated shell providing companies you ensure quality of service with high uptimes on the servers themselves and well resourced servers and internet connection speeds.

Swearing


Creating an interactive bot net with regards to swearing culminated in a lot more hard work. The channel owners did not wish to have a great deal of swear kicking happening within their channels, due to the relaxed attitude of the channels I had my bots moderating. Because of this I chose to create just one swear word kick to prove the concept and create the code, which can now easily be used to add additional banned words if needed.


I used the word “fuck” as my banned word, due to it being widely regarded as offensive. I targeted this offensive word with the code string:

server PRIVMSG *!*@* * *fuck* echo "kick $P3 $NICK :No swearing (tecBot v1.0)"; echo "PRIVMSG #tecbot1 !botnet kick #thinktank $NICK :No swearing in $P3 (tecBot v1.0)"


This code string worked perfectly; effectively kicking someone from any channel in which the bots where moderating, this would then culminate in them being kicked from the additional room of #thinktank as specified. This worked 100/100 times.


More bot channels and swear words can easily be added by adapting the channels and swear words in this code string.


The code itself works by scanning all text in chat and looking for the character string “fuck”, if found it will issue a kick mode to the server, kicking the offending user from the room they had said the offending swear word in. It will also then pass back a bot net message to a single bot stationed in #tecbot1 channel. The bots in this room are controller bots, used to govern rooms of 50 bots each. These will receive the message and pass on the kick command to their own bots in the channels they control.


This seems to be a very effective method of control over the entire bot net. Enabling me to use many different bot nets together, as a single bot net.



Hacking protection



The hacking protection of the tecBOTs is somewhat limited compared to some advanced scripts in Eggdrop bots, however it does offer some good current features and a massive scope for advancement.


The bots themselves are protected from unauthorised access by placing restrictions on the users’ nickname, ident and IP addresses. You can use none, or all, of these restrictions to lock down who can control the bots on the bot net. Within my testing I changed the protection settings on each set of bots to only respond to certain idents, nicknames or IP addresses and in each case, the bots would only respond to the correct mask.


To effectively make the bot net bigger, interacting with other bot nets, I chose to set the restrictions to ident only, using the restriction mask of *!*tecsatan@*. This allowed me to have full control of all bots on the bot net as well as allowing a control bot, out of every 50 (50 per BG), to control the other bots under themselves.


I also built in a number of admin tools into the mIRC front end to tecBOT which will enable a user to easily moderate an IRC channel. They are able to kick and ban users on a local channel and globally, by using bots instead of themselves to give these commands to the server, the bot admin is free of reprisals from the offending user, who is unable to see who issued the command.


Like Eggdrop Bots, tecBOT is entirely scriptable, by using psyBNC scripts. The security features could be dramatically increased by the owner of the bot net if they wished to do so, thus better protecting other bots, themselves and their channel.


Evaluation


I feel that overall the tecBOT project is a success. I have done what I set out to do, create a stable Eggdrop Bot style IRC bot net program that will run on a single Unix based operating system. However, saying that, I feel that I have only scratched the surface of the potential of this project. I feel that if I had not been so limited by the projected maximum word count, set out by the project guild lines, then I would have been able to expand ideas more and increase the size of the project and features I have built into tecBOT.


With all my disappointments aside, regarding how much more I would have liked to have been able to do with tecBOT, I still feel that the project went well as a whole and that I have learned a great deal from it. My understanding of BASH commands, C programming language, mIRC scripting language, psyBNC scripting language and IRC protocols have all dramatically increased.


I felt in the main that I managed this project well. I made a good start which helped, as I was ahead of schedule with most of the practical parts of the assignment. Unluckily for me, I seemed to tail off, with regards to my write up of the project and did not keep to my chosen timeframe, however, when I first wrote out my time schedules for this project, I planned for this in mind, knowing my write up would be the hardest part of this assignment for me. Due to this forward thinking, I managed to build in a lot of extra time at the end of my project to supplement the expected amount of time I allowed to write up this project.


Conclusion


By using the programs of mIRC and psyBNC I was able to effectively create tecBOT, a working bot net program, using scripting languages from mIRC and psyBNC, to create a working frame work allowing tecBOT to run successfully.


The project has met its specifications. tecBOT is able to run scripts, it is stable and will run on any Unix based operating system. The tecBOT project is also able to moderate a chat room; kicking users for swearing and operating as a full and functional bot net, able to pass back commands to other bot’s on the network.


Overall, this entire project was a definite success with a lot of room for future advancement.


References


Wiki Eggdrop 1

Eggdrop

http://en.wikipedia.org/wiki/Eggdrop

Accessed on 10/05/2008


TCL 1

Tcl Developer Xchange

http://www.tcl.tk/

Accessed on 10/05/2008


Eggdrop 2

What is an Eggdrop?

http://www.egghelp.org/whatis.htm

Accessed on 10/05/2008


CNET 1

mIRC 6.31

http://www.download.com/mIRC/3000-2150_4-10001733.html?cdlPid=10764664

Accessed on 10/05/2008


Wiki mIRC 1

http://en.wikipedia.org/wiki/MIRC#cite_note-0

Accessed on 10/05/208


psyBNC 1

http://www.psybnc.at/about.html

Accessed on 10/05/2008


psyBNC scripting 1

http://www.psybnc.at/scripting.html

Accessed on 09/05/2008


Bibliography


An IRC Tutorial

http://www.irchelp.org/irchelp/irctutorial.html#intro

By Joseph Lo

Accessed on 09/05/2008


History of IRC (Internet Replay Chat)

http://daniel.haxx.se/irchistory.html

By Daniel Sternberg

Created on 24/09/2002

Accessed on 08/05/2008


Internet Replay Chat

http://en.wikipedia.org/wiki/IRC_channels

Accessed on 07/05/2008


Internet Technologies/IRC

http://en.wikibooks.org/wiki/Internet_Technologies/IRC

Accessed on 07/05/2008


List of Internet Relay Chat commands

http://en.wikipedia.org/wiki/List_of_IRC_commands

Accessed on 07/05/2008


psyBNC

http://www.psybnc.at/

Accessed on 06/05/2008


Phoenix Shells

http://www.phoenix-shells.net

Accessed on 05/05/2008


Smart Shells

http://www.smartshells.net

Accessed on 05/05/2008


Ispeeds

http://www.ispeeds.net

Accessed on 05/05/2008


Outlandz

http://www.outlandz.net

Accessed on 05/05/2008


Grindstar

http://www.gridstar.net

Accessed on 05/05/2008


Silence is Defeat

http://www.silenceisdefeat.org

Accessed on 05/05/2008


Appendix


Backend code


change #channel to the name of the bot channel

change password to your bot password



server PRIVMSG *!*tecsatan@* * !botnet* echo "PRIVMSG #le $P5 $P6 $P7 $P8 $P9 $P10 $P11 $P12 $P13 $P14 $P15 $P16 $P17 $P18 $P19 $P20 $P21 $P22 $P23 $P24 $P25 $P26 $P27 $P28 $P29 $P30 $P31 $P32 $P33 $P34 $P35 $P36 $P37 $P38 $P39 $P40 $P41 $P42 $P43 $P44 $P45 $P46 $P47 $P48 $P49 $P50"


server PRIVMSG *!*tecsatan@* * !command* echo "$P5 $P6 $P7 $P8 $P9 $P10 $P11 $P12 $P13 $P14 $P15 $P16 $P17 $P18 $P19 $P20 $P21 $P22 $P23 $P24 $P25 $P26 $P27 $P28 $P29 $P30 $P31 $P32 $P33 $P34 $P35 $P36 $P37 $P38 $P39 $P40 $P41 $P42 $P43 $P44 $P45 $P46 $P47 $P48 $P49 $P50"


server PRIVMSG *!*tecsatan@* * !DELSERVER* echo "DELSERVER $P5"


server PRIVMSG *!*@* * *fuck* echo "kick $P3 $NICK :No swearing (tecBot v1.0)"; echo "PRIVMSG #le !botnet kick #thinktank $NICK :No swearing in $P3 (tecBot v1.0)"


server NOTICE *!*tecsatan@* * !command* echo "$P5 $P6 $P7 $P8 $P9 $P10 $P11 $P12 $P13 $P14 $P15 $P16 $P17 $P18 $P19 $P20 $P21 $P22 $P23 $P24 $P25 $P26 $P27 $P28 $P29 $P30 $P31 $P32 $P33 $P34 $P35 $P36 $P37 $P38 $P39 $P40 $P41 $P42 $P43 $P44 $P45 $P46 $P47 $P48 $P49 $P50"


server NOTICE NickServ!services@* * "*nickname is registered*" echo "PRIVMSG NickServ :IDENTIFY password"


ctcp VERSION *!*@* * * echo "NOTICE $USERNICK :tecBOT v1.0 by Adam Schemanoff"


Frontend Code


dialog test1 {

title "tecBOT"

size -1 -1 260 110

option dbu

tab "Admin Bots", 1, 5 1 250 105

tab "Make Bots", 2


text "Target Nick:", 14, 8 17 30 10, tab 1

text "Target Channel:", 16, 93 17 40 10, tab 1

text "Bot Channel:", 54, 8 71 35 10, tab 1

edit "Nickname", 15, 38 15 50 10, tab 1

edit "#channel", 17, 133 15 100 10, tab 1

edit "raw command", 29, 72 94 100 10, tab 1

edit "#channel", 55, 39 69 100 10, tab 1

button "OP" 18, 8 27 30 20, tab 1

button "Voice", 19, 39 27 30 20, tab 1

button "HalfOP", 20, 70 27 30 20, tab 1

button "Kick", 21, 101 27 30 20, tab 1

button "Ban", 22, 132 27 30 20, tab 1

button "OP on botnet", 23, 8 48 45 20, tab 1

button "Voice on botnet", 24, 54 48 45 20, tab 1

button "HaltOP on botnet", 25, 100 48 45 20, tab 1

button "Kick on botnet", 27, 146 48 45 20, tab 1

button "Ban on botnet", 28, 192 48 40 20, tab 1

button "Send raw command", 26, 8 84 60 20, tab 1


text "Nickname Dir:", 44, 8 17 40 10, tab 2

text "Ident Dir:", 46, 8 28 40 10, tab 2

text "Ident Start Line No.:", 30, 105 28 70 10, tab 2

text "psyBNC Server IP:", 32, 8 38 50 10, tab 2

text "psyBNC Port:", 34, 105 38 45 10, tab 2

text "Vhost IP range:", 36, 8 49 45 10, tab 2

text "Vhost range start:", 38, 105 49 50 10, tab 2

text "Bot Channel:", 40, 8 60 40 10, tab 2

text "Bot Password:", 42, 8 71 40 10, tab 2

text "IRC Server IP:", 49, 8 82 45 10, tab 2

text "IRC Server Port:", 51, 105 82 50 10, tab 2

edit "0", 31, 156 26 20 10, tab 2

edit "0.0.0.0", 33, 54 37 50 10, tab 2

edit "1337", 35, 156 37 20 10, tab 2

edit "0.0.0.", 37, 54 48 50 10, tab 2

edit "0", 39, 156 48 20 10, tab 2

edit "#channel", 41, 54 59 100 10, tab 2

edit "password", 43, 54 70 100 10, tab 2

edit "0.0.0.0", 50, 54 81 50 10, tab 2

edit "6667", 52, 156 81 20 10, tab 2

button "Nick Dir", 45, 41 16 30 10, tab 2

button "Ident Dir", 47, 41 26 30 10, tab 2

button "Start", 48, 6 91 50 10, tab 2

button "Stop", 53, 57 91 50 10, tab 2

}



on *:dialog:test1:sclick:18:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

set %bchannel $did(test1,55)

//msg %bchannel !command mode %dchannel +o %dnick

}


on *:dialog:test1:sclick:19:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

set %bchannel $did(test1,55)

//msg %bchannel !command mode %dchannel +v %dnick

}



on *:dialog:test1:sclick:20:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

set %bchannel $did(test1,55)

//msg %bchannel !command mode %dchannel +h %dnick

}


on *:dialog:test1:sclick:21:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

set %bchannel $did(test1,55)

//msg %bchannel !command kick %dchannel %dnick tecBOT v1.0

}


on *:dialog:test1:sclick:22:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

set %bchannel $did(test1,55)

//msg %bchannel !command mode %dchannel +b %dnick

}


on *:dialog:test1:sclick:23:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

//msg %botnet !botnet mode %dchannel +o %dnick

}



on *:dialog:test1:sclick:24:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

//msg %botnet !botnet mode %dchannel +v %dnick

}




on *:dialog:test1:sclick:25:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

//msg %botnet !botnet mode %dchannel +h %dnick

}


on *:dialog:test1:sclick:27:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

//msg %botnet !botnet kick %dchannel %dnick tecBOT v1.0

}


on *:dialog:test1:sclick:28:{

set %dnick $did(test1,15)

set %dchannel $did(test1,17)

//msg %botnet !botnet mode %dchannel +b %dnick

}


on *:dialog:test1:sclick:26:{

set %draw $did(test1,29)

//msg %botnet !command %draw

}


on *:dialog:test1:sclick:45:{

//set %nickdir $sfile(*)

}


on *:dialog:test1:sclick:47:{

//set %identdir $sfile(*)

}


on *:dialog:test1:sclick:48:{

//set %identno $did(test1,31)

//set %psybncserver $did(test1,33)

//set %psybncport $did(test1,35)

//set %vhostrange $did(test1,37)

//set %vhostrangestart $did(test1,39)

//set %botchan $did(test1,41)

//set %botpass $did(test1,43)

//set %ircserver $did(test1,50)

//set %ircserverport $did(test1,52)

//make

}


on *:dialog:test1:sclick:53:{

//timers off

//echo 4 tecBIT botnet has been halted on line %identno

}


on 1:load:{

//set %botnet $?"Botnet #channel"

}


alias make {

//set %checknum %identno

//set %vhostnum %vhostrangestart

//make1

}


alias make1 {

//set %checknum $calc(%checknum + 1)

//timer1 1 1 //identd on $read(%identdir, %checknum)

//timer2 1 3 //server %psybncserver $+ : $+ %psybncport

//timer4 1 10 //pass %botpass

//timer5 1 12 //sreload

//timer6 1 10 //bvhost %vhostrange $+ $calc(%vhostnum - 1)

//timer7 1 12 //nick $read(%nickdir, %checknum)

//timer8 1 14 //setawaynick $read(%nickdir, %checknum)

//timer9 1 16 //addserver %ircserver : $+ %ircserverport

//timer10 1 40 //join %botchan

//timer11 1 17 //quit gone

//timer12 1 19 //make2

}


alias make2 {

//set %vhostnum $calc(%vhostnum - 1)

//timer13 1 7 //make1

}


alias build {

//set %checknum 0

//build1

}


alias build1 {

//set %checknum $calc(%checknum + 1)

//adduser $read(%identdir, %checknum) : $+ $read(%identdir, %checknum)

//password $read(%identdir, %checknum) : $+ %botpass

//timer2 1 2 //build2

}



alias build2 {

//timer1 1 3 //build1

}

Menu channel,status,menubar,query {

tecBOT://tecbot

}



alias tecbot {

dialog -md test1 test1

}


Schedule

Activities:


Project activity: researching current IRC related technology

Activity priority: 1st

Estimated time scale of activity: 1 week (4 hours)

Estimated Start Date: Monday the 26th of November 2007

Resources needed for activity: Plymouth University portal, Saltash College library, Plymouth University library and internet access.

Details of activity: Researching current IRC related technology that will run multiple IRC connections off a single UNIX background process ever to find a current IRC application which does this, find a current IRC application which I can convert to do this or find the information needed to program a new IRC application to do this.


Project activity: Implement back end

Activity priority: 2nd

Estimated time scale of activity: 3 weeks (12 hours)

Estimated Start Date: Monday 3rd of December 2007

Resources needed for activity: PuTTY, 2 IRC shell accounts based on UNIX based operating systems.

Details of activity: Implement my findings from my research to create a stable backend for my botnet running on 1 background process of a UNIX based operating system. This may include installing an application, modifying and installing an application or programming an application.


Week off (4 hours accounted for in slack) for Christmas week.

Week starting Monday 24th of December 2007


Project activity: Program front end

Activity priority: 3rd

Estimated time scale of activity: 3 weeks (12 hours)

Estimated Start Date: Monday 31st of December 2007

Resources needed for activity: mIRC

Details of activity: Using mIRC scripting, design and implement a front end piece of software for the tecBOT project. This piece of software should govern all operations essential to the project, which must be carried out from the client side. The program should be simple to use with an easy to follow and use GUI.


Project activity: Botnet configuration

Activity priority: 4th

Estimated time scale of activity: 1 week (4 hours)

Estimated Start Date: Monday 21st of January 2008

Resources needed for activity: mIRC, programmed front end, access to the 2 IRC shell accounts, PuTTY.

Details of activity: Configure each bot on the network to interact with each other to help moderate and monitor selected chat rooms.


Project activity: Botnet testing

Activity priority: 5th

Estimated time scale of activity: 2 weeks (8 hours)

Estimated Start Date: Monday 28th of January 2008

Resources needed for activity: mIRC, programmed front end, access to the 2 IRC shell accounts, PuTTY.

Details of activity: Test the tecBOT project running live. Tests will include looking at security issues, possible exploitation of the program and stability of the project and functionality of the project. Any bugs or flaws found should be well documented.


Project activity: Changes / Bug Fixes

Activity priority: 6th

Estimated time scale of activity: 2 weeks (8 hours)

Estimated Start Date: Monday 11th of February 2008

Resources needed for activity: mIRC, programmed front end, access to the two IRC shell accounts, PuTTY.

Details of activity: Using the testing documentation to fix any bugs that have been found or any flaws within the project which may need changing. If it has become clear that certain features are missing from the project and need to be added, then this is the time to do so.


Project activity: Documentation

Activity priority: Throughout

Estimated time scale of activity: 25 hours (approx additional 1 hour per week)

Estimated Start Date: Monday 26th of November 2007

Resources needed for activity: Microsoft Word, Dragon Natural Speak 9, log sheet.

Details of activity: Keep an accurate record on a weekly basis of everything I have done and achieved in that week. Try and keep notes as technically accurate as possible and give a good and realistic reflection of the work I have undertaken.


Project activity: Finished report

Activity priority: 7th

Estimated time scale of activity: 4 weeks (16 hours)

Estimated Start Date: Monday 25th of February 2008

Resources needed for activity: Microsoft Word, Dragon Natural Speak 9, proof readers.

Details of activity: Write up my project in full. This will include compiling all my documentation, research, source code and references to create a clear and easy to understand finished report on the tecBOT project.


Summary:


89 hours total accounted for

11 hours spare (approx 3 weeks)


Todays date: 26 November 2007

Due in date: 16th May 2008


25 Weeks left until project is due in (approx)

173 Days left till Project is due in (including today)

4152 Hours until project is due in (approx)


4 hours a week for 25 weeks = 100 hours (approx)


Manually tecBOT configuration


Open up mIRC. Do not connect with it yet. I will refer to this mIRC as mIRC1.

In mIRC1 put in the correct IDENT (tools > Options > Identd > User ID) for the psyBNC you have already set up.


Then connect to the psyBNC by using the IP address and port number that you set up to use when creating your psyBNC account (e.g. /server 120.0.0.0:1337).

When connected to your psyBNC, use /pass password (use your password) to connect to the psyBNC.


Type /sreload
This will load the command line script into your psyBNC account.


Adding a Bot
Every time you wish to add a new bot you follow this section. You can add up to 99 bots per background process, however you may be limited on how many will connect to a server, depending on the number of vhosts you have access to and the server limits per IP address that are set upon the IRC server you wish to connect too.


Open up a new mIRC, do not connect with this mIRC yet. I will refer to this mIRC as mIRC2.


This process of adding users can be done in 10 steps.


Step 1: Add a user
Open up mIRC1
Type /adduser name :name
Replace “name” with whatever name you want the bot to be called. Keep it simple and short, as you will also use it for the bots IDENT.


Step 2: Change the password
In mIRC1 type /password password :name
Replace “password” with the new password you want to use.
Replace “name” with the name you just called your bot.


Step 3: Changing IDENT
Open mIRC2
Change the IDENT (tools > Options > Identd > User ID) to the bots name.


Step 4: Connecting to tecBOT
In mIRC2 connect to your psyBNC ip and port (e.g. /server 120.0.0.0:1337)
When it asks you for your password type /pass password
Replace “password” with the password you set for your bot.


Step 5: Loading the script
In mIRC2 type /sreload
This will load the bot script


Step 6: Adding a vhost
Open the vhosts.txt file you made earlier and pick a vhost from it that you would like the bot to use to connect to the IRC server you will choose.
Then in mIRC2, type / bvhost ip
Replace ip address with the IP address of the vhost you wish to use (e.g. 120.0.0.0)


Step 7: Set the bots name
In mIRC2 type /nick name
Replace “name” with the name of the bot
Then type /setawaynick “name”
Replace name with the name of the bot
This will insure that the bot always keeps its name.


Step 8: Add a server
In mIRC2 type /addserver server :port
Replace “server” with the server name/ip you want to connect to.
Replace port with the port number you wish to connect on.
E.g irc.icq.com :6667
Your bot will then try and connect to that server. There may me up to 2 minutes delay when it first tries to connect.


Step 9: Joining a handling room
In mIRC2 type /join #room
Replace #room with the room name of the room you wish the bot to join. This room will be the room that tecBOT always returns to, and from there you can control the whole bot net.


Step 10: Finish off
This tecBOT should now be fully working. Simple disconnect mIRC2 and try and give the tecBOT commands from another mIRC/tecBNC that is on the same server and in the same channel. The bot will only take the commands from you, if your host mask matches the one you have already set for it.



IRC Background History


IRC stands for Internet Relay Chat. IRC was born in 1988 when a lecturer, working in the Department of Information Processing Science of University of Oulu, Finland, Jarkko Oikarinen (or "WiZ" as he is known online), created the first IRC client and server.


It was reported that Jarkko wished to create a real time chat system that would allow news to be discussed as an extension of the BBS software he administrated at tolsun.oulu.fi. It soon became clear however that many of the features in BBS would not fit into this IRC client and server model and work was shifted into making sure the system only targeted real time chat. e.g. Relay Chat.


With help from his friends Jyrki Kuoppala and Jukka Pihl was able to create the first IRC network in August 1988, on a server called named tolsun.oulu.fi. Jarkko went on to contact some friends at the Helsinki and Tampere Universities and convinced them to start running IRC servers as well, when the number of users using his own server increased.


Jarkko was then contacted by members of the University of Denver and Oregon State University who had managed to get a copy of his work, start their own IRC servers and now wished to connect to the Finnish network. From this point on IRC popularity snowballed. The entire Finnish national network - Funet – started using it and then IRC was connected to Nordunet, the Scandinavian branch of the Internet. This ultimately led to IRC spreading across the internet in November 1988.


IRC servers started to spring up all over the world and in 1990 a new version of the server IRCd (version 2.6) was in production by an independent group of hobby programmers. These programmers however had a disagreement over the project and instead of a single unified IRCd being created they broke off into separate projects.


From these separate projects came a new range of IRC IRCds , two of the main ones amalgamated to create the EFnet and Undernet IRC networks, which remain as two of the biggest IRC networks to date.



Installed psyBNC


To set up tecBOT you first need to install psyBNC onto your *nix shell account. To be able to do this you will need a Unix based shell account, so every Unix, Linux, BSD or MacOS, that has at least one spare background process. The shell account must also have a vhost range which you are allowed to use and must have no limited on the amount of connections you can make per background process.


It is always advisable to check the terms and conditions of a shell account to see if they set connection limits before you buy one. Connection limits will mean that you are unable to run tecBOT to its full advantage.


This section is written with the assumption of some Linux and Bash commands, background knowledge and experience.


Firstly you will need to SSH into your shell account; I would advise using PuTTY for a windows based machine. When you have made an SSH connection, enter your username and password to log into your shell account.


Before you start you will need to take down a copy of your vhost list from your shell provider. You should be able to do this in most shell accounts by typing:

vhosts


I strongly recomend you copy and paste these vhosts into a notead file and save on your windows desktop, as they will be required later.


You next stage is to download the psyBNC program; you can do this by typing:

wget http://bnc.acmeshells.com/psyBNC-2.3.2-7.tar.gz


Once download you need to unzip and then unpack the file. You need to use the following commands for this:

tar -zxf psyBNC-2.3.2-7.tar.gz


Once the file in unzipped with this command you need to go into it by typing:

cd psybnc


Now you can unpack the file by typing:

make


This will then install psyBNC for you. Once installed you will need to set up your psyBNC and get it running. Now use the command:

make menuconfig


At this point you will enter a simple GUI which you can control with your arrow and enter keys. You will need to go to:

Bouncer-Config


Now go down to:

Listening Ports


You will now need to enter a Vhost IP address fro your Vhost list and choose a random port for it to listen on. An example would be, 120.0.0.0 1337 . You will then need to press:

OK


Now you need to go back to the main menu, so press:

ESC


Now go down to Users and press:

Enter


Use the arrow keys to go to New and then press:

Enter


You are now able to enter a master user. First enter your user details using the arrow keys and your enter key.


For example, I will set up my master user under my chat handle of tecsatan, so I will enter the following things in the following fields:

Login: tecsatan

Nick: tecsatan

Username: tecsatan

Password: test

Vhost: example.vhost.com

Rights: Admin


Now use your arrow key to go down to Servers. In here you will want to add the IRC server you wish to connect to. So you press Enter and then type your server address and port E.g:

irc.icq.com 6667

Now press Enter and then ESC to return to the user menu.


You have now done setting up your user so select Exit and press Enter.


Now to get out of your menu hit ESC, then right arrow and select EXIT, then right arrow Enter and select EXIT again then Enter.


You psyBNC should now be configured, but to solve some error issues with the program itself its best to move the salt file. You can do this by typing:

mv salt.h ../.


You are now read to start your psyBNC, so simple type:

./psybnc


Remember to take a copy of your server IP and port that your psyBNC it listening on.


psyBNC Scripting Tutorial


While building the backend for tecBOT I had to heavy refer to the tutorial file on psyBNC Scripting, written by the creators of psyBNC. This tutorial is found below:-

[psyBNC scripting 1]


The psyBNC Scripting Engine
---------------------------
Due to the fact, noone really seems to understand the way psyBNC offers
Scripting to users, It should be defined a little bit more detailed in
this file.
CONTENTS
I. General
I.1. The general Idea
I.2. Event-handled Scripting
I.3. The DEFAULT Script
I.4. Special User Scripts
II. Variables
II.1 Global Variables for all events
II.2 Event-specific Variable
III. Events
III.1 The server-Event
III.2 The dialogue-Event
III.3 The dccchat-Event
III.4 The dccsend-Event
III.5 The alias-Event
III.6 The ctcp-Event
IV. Last words
I. General
psyBNC offers a different way of scripting. While e.g. eggdrop offers tcl as
scripting-language, psyBNC offers its own mechanism of creating user-defined
scripts.
I.1 The General Idea
IRC sends Messages to the user, and the User sends Messages to IRC. If no
data is received from the server, and no data is received from the User,
no Action has to be taken normally.
The scripting in psyBNC is based on events, which happen only, if data
is being received from the user or from the server.
If an event matches to the syntax of the script, then the action being given
in the script is taken.
A script can only be injected to psybnc by accessing the shell, and by putting
the scripts into the scripts/-Directory.
If a script was injected, while the bouncer was already running, it wont auto-
matically reload the script. You would have to trigger the psyBNC-Command
/SRELOAD to load changes on your script.
I.2 Event-handled Scripting
The syntax of every Line of a psyBNC-Script is as following:
event function fromuserhost/name to content script
The event describes 6 possible event-types of the scripting Engine.
Those are:
- dccchat (If the user receives a dcc chat offer from an irc user)
- dccsend (If the user receives a dcc file offfer from an irc user)
- server (Any event from the server)
- dialogue (A permanent open dialogue which is handled by the script)
- ctcp (if a CTCP-request is received from an irc user)
- alias (a user defined Command for psyBNC)
All other fields depend in its functionality on the event:
The function-field:
- In dccchat, dccsend and dialogue it has no meaning at all
- in server, it is the name or Number of the message coming from the server
- in ctcp, it is the name of the CTCP command (on CTCP PING it would be PING)
- in aliases, its the name of the command, which should be user defined
The fromuserhost/name-Field:
- In dialogues it has no meaning at all
- In server, ctcp, dccchat and dccsend its a wildcard-hostmask (*!*a@*.b.com)
If the Hostmask matches, then the script is called. On server events also
content has to fit.
- In aliases, its used as description of the Command.
The to-Field:
- In alias, dccsend and dccfile it has no meaning at all
- in server and ctcp, it can be a channel (as like #sausage), or the * wildcard.
- In dialogues, it is the "nick" of the dialogue, which talks to the
bouncer user in a query (in brackets).
The content-Field:
- In alias, dialogues, dccsend, dccfile and ctcp it has no meaning at all
- In the server event, it is a wildcarded "content" of a message,
for example, if this field contains "*Hello*", the servermessage which
calls the Script has to contain "Hello" in the IRC-Content as well.
The script-Field:
- On ctcp, dccfile and server it can be any shellscript or shell-
based command(s), which will be called once and have to terminate right
after execution.
- On dialogue, dccchat and alias, the called script can stay backgrounded, and
do its work as long its needed.
A script can be anything, which can be handled by the shell. You also can
call PHP/Perl/tcl-Scripts from the script-Entry.

I.3 The DEFAULT-Script
If a script with the filename "DEFAULT.SCRIPT" is placed into the
directory scripts/, all Users will run this script, until no special
user script is defined. This global script will also be run for all
new added users.
I.4 Special User-Scripts
If a special User script has to be created, its Filename must be
USERnn.SCRIPT, where nn is the Number of the user, corresponding to
the Number in the psybnc.conf, with no leading zeros (e. g. User1 has to use
USER1.SCRIPT). The file has to be put into scripts/.
II. Variables
If a script is called, psyBNC sets special Environment-Variables
to support data to the script.
Global Variables are always set, no matter, which event is called.
Some events got special variables, which will be described in the
subsections of this part.
A variable can be adressed by a shellscript as a normal Environment-
Variable is being adressed:
echo "$USER did start a script"
would echo the User-Variable from psyBNC to the current standard-output,
which would be handled by psyBNC (see III. Events).
II.1 Global Variables for all events
This will show a list of all variables, which are set on every
Script-Call.
USERNUMBER - The number of the psyBNC-User
USERLOGIN - The ident/login of the psyBNC-User
USERNICK - The current nick of the psyBNC-User
USERHOST - The connected client Host of the psyBNC-User
USERON - If set to 1, the User is connected currently
If the event is a server-Event, a dccsend-Event, a dccfile-Event or
a ctcp-Event, the following variables are used. They are filtered from
the incoming IRC-Message.
If the message would be a User-Message or a Channel-Message, it would
look like as following:
Variable
--------
:joe!joe@host.com PRIVMSG #hello :hello
| | | | | |
| | | | | |____ CONTENT
| | | | |
| | | | |___________ TO
| | | |
| | | |___________________ CMD
| | |
| | |____________________________ HOST \
| | \
| |__________________________________ IDENT \ USER
| /
|______________________________________ NICK /

If you would request the Variable CONTENT, you would get "hello".
CONTENT saves the whole text from the Channel- or Usermessage.
The Variable CMD would be PRIVMSG. Remember, IRC does not really
know commands as like "QUERY" or "MSG", all User- and Channel-
messages are handled using PRIVMSG.
The NICK field would be joe, the ident field in this case as well.
the HOST field would be host.com.
The USER field would be the irc-hostmask, in this case joe!joe@host.com.If the message would be a server-message, if would look as like the
following:
Variable
--------
:irc.somenet.org 001 ircgeek :Welcome to irc.somenet.org, ircgeek.
| | | |
| | | |____ CONTENT
| | |
| | |___________ TO
| |
| |___________________ CMD
|
|____________________________ HOST / USER
In this case HOST and USER carry the same value.
Some servermessages support more than one parameters in TO.
For that sake, its also possible to read another List of Variables:
:joe!joe@host.com PRIVMSG #hello :hello people, how are you ?
| | | | | | | | |
| | | | | | | | |
P1 P2 P3 P4 P5 P6 P7 P8 P9
The Pnn-Variables contain an array of each element of the IRC-Line.
If you would do:
echo $P3
you would get
#hello
On Aliases the Input is sent in Command-Format. This Command-Format
would also be stored in the Variables:
MYPART #something :Byebye
| | |
| | |____ CONTENT
| |
| |______________ TO
|
|______________________ CMD
The Pnn-Variables are also available in Aliases.
II.2 Event-specific Variables
The dialogue Event offers a variable named MYNICK. It stores the nick of
the dialogue-query, which appears to the user.
The Serverevent sets channel-Variables, if the TO-Field is a channel.
Those Variables are:
CHANNEL - Name of the Channel
If the psyBNC-User is on the Channel, he will be also supplied with the
following Variables:
CHANTOPIC - Topic of the Channel
CHANMODE - Modes of the channel (e.g. +tn)
CHANKEY - Key of the channel, if a key is set. Otherwise not used.
CHANLIMIT - The limit (+l Mode), if the mode is set.
CHANUSERnn - A User of the Channel, numbered by NN
e.g. CHANUSER1. The Syntax of a chanuser-Field is
as follows:
nick!ident@host|mode
The User-Hostmask is seperated from the Channels Usermode
by a Pipe-character (|).
The Usermode is set to the modes the user has on the
Channel.
Example:
joe!joe@host.com|o
would show, that User joe got op on the channel.
The dccchat-Event supplies a Variable named IP, it keeps the Host
of the dccchat-offering User.
The dccsend-Event supplies, as like dcchat, the IP-Variable, and another
Variable named FILE. It keeps the Name of the File, which the DCC-Send-
offering User wants to transfer to you.
The ctcp-Event supplies a Variable named X01. This variable ist used
to easily create an answer on a simple shellscript-Echo-Line without
having the need to call an external Program to create the control-
character \x01.
III. Events
This section tries to describe the Events itself, how they are used and
how to parameterize them.
The output and input on every called script is defined by the Event itself.
psyBNC switches the standard-input, -output and Error-Output for the script
to its own internal structures.
If a task, which is called as a script from psyBNC, writes to STDOUT
(Standard-Output), it is directly injected into psyBNC. The way
psyBNC handles that Output is dependant on the event.
The following words will be used in the Event-Context:
STDIN - Standard Input to a called task (Socket 0)
STDOUT - Standard output from a called task (Socket 1)
STDERR - Standard Error-Output from a called task (Socket 2)
The events also sometimes use STDIN for receiving Output from the task.
A normal shellscript would handle output to STDERR or STDIN as follows:
echo "Hello" >&0
Would send Hello to STDIN
echo "Error !" >&2
Would send Error ! to STDERR.
In all events STDERR gets to the psyBNC-Main-Log.
III.1 The server-Event
The server-Event reacts on messages from the Server. That can be any
special server-message (numeric), or channel- and User-Messages (as
like PRIVMSG, JOIN, PART).
A script, which was called on a server-Event, would not stay in background,
but send a reply to the given event possibly.
The server-Event has the following settings for Standard In- and Outputs:
STDOUT goes to the server, via the psyBNC command Interpreter.
You also can trigger psyBNC commands from the given script while
creating output to STDOUT.
Example:
server JOIN *!*@* #mychannel * echo "PRIVMSG $NICK :Welcome to #mychannel"
Anyone, who would join to the Channel #mychannel would receive a Message
"Welcome to #mychannel" from your Client.
If the Script sends an Output to STDIN, the output will be sent to
the connected client of psyBNC.
Example:
server PRIVMSG *!*@* #mychannel *damned* echo ":irc.server.net NOTICE $USERNICK :someone said damned" >&0
If someone in the Channel would post a sentence including "damned", your Client
would get a notice from the Server irc.server.net, that someone on the Channel
said "damned".
If the Script sends an Output to STDERR, psyBNC will put that into the Main-Log
of psyBNC.
Example:
server PART *!*@* #mychannel * echo "User $NICK left the channel !" >&2
If someone parts the channel, your would get a logged Message, that this
User left the channel.
III.2 The dialogue-Event
The dialogue Event starts a backgrounded application, which interacts with
the User on psyBNC using an emulated query.
You can use dialogues to run applications, which need interaction, but are
useful in the psyBNC Context. Possibly you want to write a Newsticker,
which actually displays the news to the query. Or you want to interact
with a line driven mail-software via a query in psyBNC.
Example:
dialogue * * mail * mail
Would call the unix-mailreader, and if mail was available, would stay in the
background, until the user would stop the application.
STDIN and STDOUT are redirected to the emulated Query, STDERR is the Main-Log
of psyBNC.
III.3 The dccchat-Event
The dccchat Event may also start a background-Application, which would
replace a possible User-Interaction on a dccchat.
For example:
dccchat * *!*joe@bla.com * * echo "DCCANSWER $NICK"; /home/me/eliza
This line would automatically accept any DCC Chat from any User which
matches the Hostmask *!*joe@bla.com. After it acknowledged the Chat, the
Program /home/me/eliza would be startet, and could possibly react
directly on the User-Input.
The Bouncer-User would monitor the in- and outputs, which would be send
to and from the DCC-Query of psyBNC. Be sure, you have DCC enabled on
psyBNC compiling time.
An Output to STDIN would be sent to the Server.
Any Output given to STDOUT would be sent to the DCC-Chat.
Any Output given on STDERR would be put into the psyBNC-Main-Log.
III.4 The dccfile-Event
A dccfile Event could be used to possibly create a fileserver, which
would possibly deny the receipt of already existent files, and answer
automatically on a DCC File-Send Request.
Example:
dccfile * *!*@* * * /home/me/filecheck
Would call an own application named /home/me/filecheck, which possibly
could handle the for sending requested file, and which could possibly
answer a the DCCGET automatically.
STDIN output would be directed to the Server. Using STDIN, you could
send commands to the bouncer, to let it accept the file for example.
STDOUT would be directed to the Clients Input. You could send a notice
to the User, that the file had been autoaccepted for example.
STDERR is directed to the psyBNC-Main-Log.
III.5 The alias-Event
Aliases can be used to add own Commands to the psyBNC-Command-List.
The User would be able to use the alias as like he would use an IRC-
or psyBNC command. If an alias is existent, which got the same
name of a psyBNC-Command, the Alias would be used instead of the
psyBNC-Command.
Example:
alias HELLO "Say Hello" * * echo "PRIVMSG $TO :Hello"
would send a Hello to the given "TO" argument.
Usage of that Alias would be:
/HELLO #bla
The text would be posted to #bla then.
You also could do /BHELP HELLO then, but if you want to support a help
for the added alias, you would have to put a HELLO.TXT into help/.
If you would trigger /BHELP without a parameter, the Text "Say Hello"
would be displayed as quick Command Help.
STDIN Outputs from the script would be sent to the Clients Input.
STDOUT Outputs would be sent to the Server.
STDERR is written into the psyBNC Main-Log.
III.6 The ctcp-Event
A ctcp-Event is triggered, when the User receives a CTCP-Message from
an IRC-User.
Example:
ctcp FINGER *!*@* * * echo "NOTICE $NICK :Dont finger me"
If anyone would send a CTCP FINGER to your bouncer, he would get a Notice
back saying "Dont finger me".
STDIN Output would be sent to the Client.
STDOUT Output would be sent to the Server.
STDERR is put into the psyBNC-Main-Log.
IV. Last words
I hope this Documentation is a little bit more usefull than the Text
i put into the README up to Version 2.2.2.
If you got questions about the scripting-engine itself, please contact
me on IRCNet.
Please dont ask me for working scripts, i just offer the Scripting-Engine
of psyBNC to be used for scripting.


Testing logs


Stability testing logs sample


While testing tecBOT’s stability, I performed this messaging command, to test the bot’s data handling and stability abilities, over 100 times. Each time the bot’s generated the following data.


<[--TEC_SATAN--]> !command PRIVMSG #LE-OOC TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port8080> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port3128> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port21> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<netbios> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Cable> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Plug> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<WindowsME> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Desk> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Outlook> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Wire> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Sub7> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Windows95> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<desktop> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<joined> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<netstat> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<^Yoda^1> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<ICP> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Mrbean> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Windows2K> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<@Tec-Gone> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Socket> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<XDCC> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<WindowsNT> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port80> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<shut_up> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<programs> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<documents> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<netbus> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<^0Day^> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<EFnet> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port23> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<winblows> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port22> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<netbus2k> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<WinNT> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port1080> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<P4> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<^C3P0^> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<USB_1> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Vuln> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<USB2> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<BO2k> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<settings> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<^R2D2^> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Printer> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<WindowsXP> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Port25> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Windows98> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<Spliff> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |

<L4m3r> TEST DATA | test data | TEST DATA | TEST DATA | test data | TEST DATA |


Swear word testing log sample


When testing the swear kick option, hard coded into the back end of tecBOT, I tested it 100 times. In all 100 tests I received the same results, as displayed below in my sample of my test results.


<[--TEC_SATAN--]> fuck

* You were kicked from #le by [--TEC_SATAN--] (No swearing (tecBot v1.0))

* You were kicked from #le-ooc by [--TEC_SATAN--] (No swearing (tecBot v1.0))

* You were kicked from #thinktank by [--TEC_SATAN--] (No swearing (tecBot v1.0))


<TEC-Gone> !botnet kick #thinktank $NICK :No swearing in $P3 (tecBot v1.0)


*nix Shell accounts


In trailing tecBOT is have used the following *unix based shell accounts.


Shell Provider

Supports psyBNC/tecBOT

Allow tecBOT’s

Connection limit

Big vhost list (over 50+)

Monthly Cost (per 1 BG)

phoenix-shells.net

Yes

No

50 per psyBNC

Yes

$3.50 USD

smartshells.net

Yes

Yes

None

No

£1 GBP

ispeeds.net

Yes

No

bg No. +1

Yes

$2.50 USD

outlandz.net

Yes

Yes

None

Yes

$3 USD

gridstar.net

Yes

Yes

None

Yes

£1.50 GBP

silenceisdefeat.org

Yes

Yes

None

No

Free



79