Goodnight Byte: Hack Our IRC Bot to Issue Commands

Oct 30, 2011 05:10 AM

Welcome to the second Goonight Byte! Our second coding session was kindly hosted by th3m, so props to him for letting this happen.

Our task this time was to hack the bot that we made the week prior, which was only capable of connecting to the channel and then printing messages to the screen. The goal this time was to get the bot to utilize incoming signals and execute operator-related commands to privileged users. We accomplished just this, thanks to the help of Sol Gates. Not only does the bot give mode +o to other users, but the code has been cleaned and revised to be more modular and openly hackable.

Here's a link to the new source code, I encourage the hacking of it!

Now, I'm going to break it down line by line again.

How NullBot v2 Works

  1. Line 1 is a shebang. This tells our computer where it can find the python executable.
  2. Lines 3-7 are our imported libraries.
  3. Line 9 is who is allowed to execute the !op command.
  4. 11-18 are our variables. These hold values that the rest of the program uses. These values can also be changed to switch servers, nicknames, etc.
  5. Line 20 creates a socket.
  6. Line 21 connects using the host and port variables to tell it where to connect to.
  7. Line 22 sends the IRC command NICK to set the bot's nickname.
  8. Line 23 identifies the bot to the server.
  9. Line 24 tells the bot to join the channel #nullbytez with the JOIN IRC command.
  10. Lines 25-26 send channel messages to everyone.
  11. Lines 28-47 keep the bot connected to IRC and listening to the channel. It's also for storing things in its buffer. It stores it in a list and reads it line by line, while removing preceding text.
  12. Lines 45-47 take ping requests from the server and pings back to let it know we are alive, thus keeping us connected.

Any person on the allowed list sending PRIVMSG !op to the channel will result in mode +o. Here's a cool video of our creation.



For next week, instead of maybe coding, who would like to see some walkthroughs for HackThisSite? HackThisSite is a legal, safe practice ground for striving hackers to test their skills and knowledge. Bring your thoughts to the Forums or the IRC!

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Related Articles

637263493835297420.jpg

How to Use Zero-Width Characters to Hide Secret Messages in Text (& Even Reveal Leaks)

636455706472146367.jpg

How to Hide DDE-Based Attacks in MS Word

Comments

No Comments Exist

Be the first, drop a comment!