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.
- Line 1 is a shebang. This tells our computer where it can find the python executable.
- Lines 3-7 are our imported libraries.
- Line 9 is who is allowed to execute the !op command.
- 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.
- Line 20 creates a socket.
- Line 21 connects using the host and port variables to tell it where to connect to.
- Line 22 sends the IRC command NICK to set the bot's nickname.
- Line 23 identifies the bot to the server.
- Line 24 tells the bot to join the channel #nullbytez with the JOIN IRC command.
- Lines 25-26 send channel messages to everyone.
- 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.
- 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!
Want to start making money as a white hat hacker? Jump-start your white-hat hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from ethical hacking professionals.