Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Showtek Version 1.5, 2nd Re-Write (Excision), for Xero's VPS
- #Supports mobile starting, with the mobile client
- #Uses Twisted's API
- #Advanced "Auto-Import", (__init__.py)
- #Access list features
- #Written By Ac3
- from twisted.words.protocols import irc
- from twisted.internet import reactor, protocol
- from twisted.python import rebuild
- from twisted.python.reflect import namedAny
- import sys
- import os
- import imp
- import subprocess
- import random
- import md5
- #kill previous bot
- x = subprocess.Popen("kill " + str(open("pid","r").read()), shell = True)
- #writes the PID to a file, so I can easily kill it later
- pid = open("pid", "w")
- pid.write(str(os.getpid()))
- pid.close()
- #figure out where the mods folder is at, append to sys.path, and import them
- def mod_():
- cwd = os.getcwd()
- mod_path = cwd+"/mods"
- mod_folder = os.listdir(mod_path)
- sys.path.append(mod_path)
- print "[IMPORT] Importing from " + str(mod_path)
- mod_()
- from mods import *
- import mods
- #this reads the config file
- x = open("config.txt", "r")
- line = str(x.read()).split("\r\n")
- x.close()
- print "[#] Reading Config file"
- for line in line:
- if line.startswith("channel"):
- chan = line.split("=")[1]
- if line.startswith("nick"):
- nickname = line.split("=")[1]
- if line.startswith("network"):
- network = line.split("=")[1]
- if line.startswith("vhost"):
- vhost = line.split("=")[1]
- if line.startswith("owner_ident"):
- owner_ident = line.split("=")[1]
- #check for the password file, if not found, create it
- try:
- x = open("pwd", "r")
- x.close()
- except:
- x = open("pwd", "w")
- x.write("d32231dba09179c868dd289874d18346")
- x.close()
- print "[!] Password file not found, created"
- #check for the kick-list file, if not found, create it
- try:
- x = open("klist", "r")
- x.close()
- except:
- x = open("klist", "w")
- x.close()
- print "[!] Kick list file not found, created"
- #the main bot class
- class Bot(irc.IRCClient):
- def _get_nickname(self):
- return self.factory.nickname
- nickname = property(_get_nickname)
- def signedOn(self):
- self.join(self.factory.channel)
- print "[!] Connected as %s." % (self.nickname,)
- self.setVar()
- self.joinDc()
- def joined(self, channel):
- print "[!] Joined %s." % (channel,)
- def setVar(self): #set variables, because you cant put them under Bot()
- self.auth = 0
- self.al = 0
- self.LOCK = 0
- self.cmdLOCK = 0
- self.owner = "~NoNE`"
- self.hostname = 0
- self.flood_stop = 0
- self.nick_check = 0
- self.access_nick = []
- mods = ["Main"]
- print "[#] Varibles set"
- def joinDc(self):
- x = open("channels", "r")
- c = x.read().split("\n")
- x.close()
- for f in c:
- self.join(f)
- def privmsg(self, user, channel, msg):
- nick = user.split("!")[0]
- hostname = user.split("@")[-1]
- #this should make him not check every fucking message
- try:
- if nick == self.owner and self.hostname == hostname or vhost == hostname and self.auth == 1:
- owner.check(self, user, hostname, msg, nick, channel)
- except:pass
- #I can check to see if its real or fake
- if msg == ".online":
- self.msg(nick, nick)
- #access list stuff
- if nick == "NickServ" and msg.startswith("STATUS"):
- if msg.split()[-1] == "3" and str(msg.split()[1] in self.access_nick) == "False":
- self.access_nick.append(msg.split()[1])
- self.msg(msg.split()[1], "You have been identified")
- print "[IDENTIFIED] " + msg.split()[1]
- if msg.split()[-1] != "3" and msg.split()[1] in self.access_nick:
- self.access_nick.remove(msg.split()[1])
- #access command check
- main.check(self, user, hostname, msg, nick, channel)
- #login stuff
- if msg.startswith("!login") == True and self.auth == 0 and self.al < 4:
- self.al = self.al + 1
- print "[Auth] " + str(int(self.al) - 4) + " More login attempts"
- if self.al > 3:
- print "[!] TOO MANY LOGIN ATTEMPTS, LOCKED"
- self.msg(nick, "TOO MANY LOGIN ATTEMPTS, LOCKED")
- return
- print "[!] Attempted login " + nick + " Pass: " + md5.md5(msg.replace("!login ","")).hexdigest()
- try:
- x = open("pwd", "r")
- p = repr(x.read().replace("\n",""))
- x.close()
- print "[!] Password is " + p
- pwd = repr(md5.md5(msg.replace("!login ","")).hexdigest())
- if pwd == p:
- q = user.split("!")[1]
- self.auth = 1
- self.username = user
- self.owner = nick
- self.hostname = hostname
- self.user_ident = q.split("@")[0]
- self.msg(self.owner, "Logged in")
- print "[!] Auth"
- except:pass
- #mods
- if msg == "!mods" and self.owner == nick:
- x = mods.__all__
- for fname in x:
- self.echo(channel, "7["+str(fname)+"]")
- if msg == "!import":
- mod_()
- if msg.startswith("!reload.") == True and self.owner == nick and self.auth == 1 and self.hostname == hostname:
- module = msg.replace("!reload.","")
- module = module.replace("__import__","")
- module = module.replace("__","")
- modlue = module.replace("\'","")
- module = module.replace("(","")
- module = module.replace(")","")
- try:
- fp, pathname, description = imp.find_module(module)
- imp.load_module(module, fp, pathname, description)
- if fp:
- fp.close()
- reload(eval(module))
- self.echo(channel, "9[Success!]14 I have reloaded " + "4["+str(module)+"]")
- except:
- self.echo(channel, "4[Error]14 reloading " + "4["+str(module)+"]")
- def userJoined(self, user, channel):
- x = open("klist", "r")
- tmp = x.read().split("\n")
- x.close()
- print "[Joined] " + user
- for fname in tmp:
- if fname == user:
- print "[Kick] " + user
- self.kick(channel, user, reason="AUTO-KICKED")
- return
- def echo(self, channel, msg):
- msg = "14,01" + msg
- self.say(channel, msg)
- def userRenamed(self, oldname, newname):
- if oldname == self.owner:
- self.owner = newname
- self.msg(newname, "You changed your nick")
- def userKicked(self, kickee, channel, kicker, message):
- if kickee == self.owner:
- print "[!] OWNER KICKED"
- self.setVar()
- if kicker != "Crash_Override":
- shitstorm.check(self, None, None, None, None, None, kicker)
- def userLeft(self, user, channel):
- if user == self.owner:
- self.setVar()
- print "[!] Logged Out [User Left]"
- def kickedFrom(self, channel, kicker, message):
- self.setVar()
- self.msg(self.owner, kicker)
- shitstorm.check(self, None, None, None, None, None, kicker)
- #hehehe
- def modeChanged(self, user, channel, set, modes, args):
- print "[MODE] " + modes + " " + str(set) + str(args) + " " + user
- if modes == "q" and set == False:
- self.mode(channel, True, "q", limit=None, user=self.owner, mask=None)
- if modes == "b" and set == True:
- for f in args:
- print "[] " +user.split("!")[0]
- if str(self.user_ident in f or self.owner in f or self.hostname in f) == "True":
- self.mode(channel, False, "b", limit=None, user=f, mask=None)
- shitstorm.check(self, None, None, None, None, None, user.split("!")[0])
- def userQuit(self, user, quitMessage):
- if user == self.owner:
- self.setVar()
- #some stuff to prevent crashes
- def ctcpExtract(message):
- pass
- def IRCBadMessage(self):
- pass
- def badMessage(self, line, excType, excValue, tb):
- self.msg(self.owner, "Got a bad message")
- def ctcpQuery(self, user, channel, messages):
- pass
- def getPerson(self, name):
- print name
- class BotFactory(protocol.ClientFactory):
- protocol = Bot
- def __init__(self, channel, nickname=nickname):
- self.channel = channel
- self.nickname = nickname
- def clientConnectionLost(self, connector, reason):
- print "Lost connection "
- pass
- x = open("stay","r")
- s = x.read()
- x.close()
- if s == "stay":
- connector.connect()
- def clientConnectionFailed(self, connector, reason):
- print "Could not connect: %s" % (reason,)
- if __name__ == "__main__":
- reactor.connectTCP(network, 6667, BotFactory(chan))
- reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement