Skip to content

Instantly share code, notes, and snippets.

@cwade12c
Created February 3, 2016 02:14
Show Gist options
  • Save cwade12c/daebca5906d63f19612e to your computer and use it in GitHub Desktop.
Save cwade12c/daebca5906d63f19612e to your computer and use it in GitHub Desktop.
A very basic irc bot coded in python.
import socket
import time
import hashlib
import base64
#import feedparser
#from pyDes import *
from random import *
network = 'irc.darchoods.org'
port = 6667
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
nick = 'WadeBot'
ident = 'HaxMe'
channel = '#haxme'
irc.connect ( ( network, port ) )
print irc.recv ( 4096 )
irc.send ( 'NICK ' + nick + '\r\n' )
irc.send ( 'USER ' + ident + ' ' + ident + ' ' + ident + ' :Got a gat\r\n' )
irc.send ( 'JOIN ' + channel + '\r\n' )
irc.send ( 'PRIVMSG ' + channel + ' :LAL\r\n' )
while True:
data = irc.recv ( 4096 )
if data.find ( 'PING' ) != -1:
irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
if data.find ( '!rollout333' ) != -1:
irc.send ( 'QUIT #haxme Peace out homiiiiez!!\r\n' )
if data.find ( '!rules' ) != -1:
irc.send ( 'PRIVMSG #haxme :No links to malware, adware, spam, direct downloads, violent/sexual content, or any sick crap. No HaxMe spoilers - talk via privmsg in relations to mission talk. No spamming, keep YOUR bots out of here. Have fun now.\r\n' )
if data.find ( 'KICK' ) != -1:
irc.send ( 'JOIN #haxme\r\n' )
if data.find ( '!latest' ):
irc.send ( "PRIVMSG #haxme https://haxme.org/announcements" )
if data.find ( '!md5' ) != -1:
stripit = data.split(':!md5')
value = stripit[1].strip()
md5 = hashlib.md5(value).hexdigest()
irc.send ( "PRIVMSG #haxme :md5(" + value + ") == " + md5 + '\r\n' )
if data.find ( '!sha1' ) != -1:
stripit = data.split(':!sha1')
value = stripit[1].strip()
sha1 = hashlib.sha1(value).hexdigest()
irc.send ( "PRIVMSG #haxme :sha1(" + value + ") == " + sha1 + '\r\n' )
if data.find ( '!sha256' ) != -1:
stripit = data.split(':!sha256')
value = stripit[1].strip()
sha256 = hashlib.sha256(value).hexdigest()
irc.send ( "PRIVMSG #haxme :sha256(" + value + ") == " + sha256 + '\r\n' )
if data.find ( '!sha512' ) != -1:
stripit = data.split(':!sha512')
value = stripit[1].strip()
sha512 = hashlib.sha512(value).hexdigest()
irc.send ( "PRIVMSG #haxme :sha512(" + value + ") == " + sha512 + '\r\n' )
if data.find ( '!base64' ) != -1:
stripit = data.split(':!base64')
value = stripit[1].strip()
base64 = base64.b64encode(value)
irc.send ( "PRIVMSG #haxme :base64(" + value + ") == " + base64 + '\r\n' )
print data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment