def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber): if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: self.schid = schid QTimer.singleShot(10000, self.checkServer) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab(self.name+"> Checking for channel in 10 seconds") elif newStatus == ts3defines.ConnectStatus.STATUS_DISCONNECTED: if schid in self.schids: self.schids.remove(schid) if len(self.schids) < 1 and self.supchan: self.deleteChan()
def errorOverride(sParser, message=None): if message is None: message = "Invalid Arguments..." else: ts3lib.printMessageToCurrentTab("CmdOnError: %s" % message) self._errMsg = message ts3lib.printMessageToCurrentTab("CmdOnError: %s" % traceback.format_exc()) raise Exception("Parser Error!")
def onServerPermissionErrorEvent(self, schid, errorMessage, error, returnCode, failedPermissionID): # (err, permid) = ts3lib.getPermissionIDByName(schid, "") for msg in self.messages: if returnCode == msg["returnCode"]: if error == ts3defines.ERROR_permissions_client_insufficient: if msg["response"]: ts3lib.printMessageToCurrentTab(msg["response"]) del msg return True return False
def toggleChannel(self, schid): supchan = self.getChannel(schid) if supchan: if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("Channel #%s does exist"%supchan) self.supchan = supchan self.getChannel(schid) else: if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("Channel does not exist, creating...") self.createChannel(schid)
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: if menuItemID == 0: if not self.dlg: self.dlg = StatusDialog(self) self.dlg.show(); self.dlg.raise_(); self.dlg.activateWindow() elif menuItemID == 1: (err, haspw) = ts3lib.getChannelVariable(schid, selectedItemID, ChannelProperties.CHANNEL_FLAG_PASSWORD) if not haspw: (err, name) = ts3lib.getChannelVariable(schid, selectedItemID, ChannelProperties.CHANNEL_NAME) msgBox("Channel \"{0}\" has no password to crack!".format(name), QMessageBox.Warning);return self.mode = 0 self.step = 1 self.pwc = 0 self.startTimer(schid, selectedItemID) elif menuItemID == 2: (err, haspw) = ts3lib.getChannelVariable(schid, selectedItemID, ChannelProperties.CHANNEL_FLAG_PASSWORD) if not haspw: (err, name) = ts3lib.getChannelVariable(schid, selectedItemID, ChannelProperties.CHANNEL_NAME) msgBox("Channel \"{0}\" has no password to crack!".format(name), QMessageBox.Warning);return self.mode = 1 step = inputBox(self.name, 'How much to increase per try?') if step: self.step = int(step) start = inputBox(self.name, 'Where to start?') if start: self.pwc = int(start) self.startTimer(schid, selectedItemID) elif menuItemID == 3: (err, path, pw) = ts3lib.getChannelConnectInfo(schid, selectedItemID) if pw == None or pw == False or pw == "": (err, name) = ts3lib.getChannelVariable(schid, selectedItemID, ChannelProperties.CHANNEL_NAME) msgBox('No password saved for channel {0}'.format(name));return elif pw in self.pws: msgBox("Not adding \"{0}\" to password db\n\nIt already exists!".format(pw), QMessageBox.Warning);return self.pws.append(pw) with open(self.pwpath, "a") as myfile: myfile.write('\n{0}'.format(pw)) msgBox("Added \"{0}\" to password db".format(pw)) elif menuItemID == 4: (err, name) = ts3lib.getChannelVariable(schid, selectedItemID, ChannelProperties.CHANNEL_NAME) pw = inputBox("{0} - {1}".format(self.name,name), "Password:"******"passwordCracker:manual") elif atype == PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if menuItemID == 1: self.timer.stop() ts3lib.printMessageToCurrentTab('Timer stopped!') elif menuItemID == 2: pw = inputBox("Enter Channel Password to add", "Password:"******"": msgBox("Not adding \"{0}\" to password db".format(pw), QMessageBox.Warning);return elif pw in self.pws: msgBox("Not adding \"{0}\" to password db\n\nIt already exists!".format(pw), QMessageBox.Warning);return self.pws.append(pw) with open(self.pwpath, "a") as myfile: myfile.write('\n{0}'.format(pw)) msgBox("Added \"{0}\" to password db".format(pw))
def __init__(self): content = [] with open(self.pwpath, encoding="utf8") as f: content = f.readlines() self.pws = [x.strip() for x in content] self.timer.timeout.connect(self.tick) # self.getInterval(ts3lib.getCurrentServerConnectionHandlerID()) ts3lib.requestServerVariables(ts3lib.getCurrentServerConnectionHandlerID()) if self.debug: ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(self.timestamp(),self.name,self.author))
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if not schid in self.targets: return (err, ownID) = ts3lib.getClientID(schid) if clientID != ownID: return (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) # if newChannelID == ownCID: return delay = randint(self.delay[0], self.delay[1]) ts3lib.printMessageToCurrentTab("{} {}: Auto-dragging {} in channel {} in {}ms".format(timestamp(),self.name,clientURL(schid, self.targets[schid]), channelURL(schid, newChannelID), delay)) QTimer.singleShot(delay, self.dragTarget)
def subscribeOpenPW(self, schid=0): if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("==== subscribeOpenPW START ====") if not schid: schid = self.schid (error, clist) = ts3lib.getChannelList(schid) for c in clist: if not isSubscribed(schid, c) and not isPermanent(schid, c) and not isSemiPermanent(schid, c) and not isMusicChannel(schid, c) and not isBlacklisted(schid, c) and isPWInName(schid, c): self.toSub.append(c) self.subChannels(schid) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("==== subscribeOpenPW END ====")
def addTimer(self, schid): err, clid = ts3lib.getClientID(schid) self.servers[schid] = {"clid": clid} interval = self.getInterval(schid) if len(self.servers) == 1: self.timer.start(interval["interval"]) ts3lib.printMessageToCurrentTab( "{}> Enabled for tab #{} with interval {} (server uid: {})".format( self.name, schid, interval["interval"], interval["suid"]))
def onServerErrorEvent(self, schid, errorMessage, error, returnCode, extraMessage): if returnCode != self.retcode: return if error == ts3defines.ERROR_client_is_flooding: ts3lib.printMessageToCurrentTab( "{}: [color=red][b]Client is flooding, stopping!".format( self.name)) self.timer.stop() return True
def isSubscribed(schid, cid): (error, subscribed) = ts3lib.getChannelVariableAsInt( schid, cid, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_ARE_SUBSCRIBED) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("Channel #{} is {}".format( cid, "[color=red]subscribed" if subscribed else "[color=green]not subscribed")) return bool(subscribed)
def join(self, schid, clid, cid): (err, ownID) = ts3lib.getClientID(schid) (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) if not cid: (err, cid) = ts3lib.getChannelOfClient(schid, self.targets[schid]) if ownCID == cid: return delay = randint(self.delay[0], self.delay[1]) ts3lib.printMessageToCurrentTab("{} {}: Auto-following {} in channel {} in {}ms".format(timestamp(), self.name, clientURL(schid, clid), channelURL(schid, cid), delay)) self.cid = cid QTimer.singleShot(delay, self.joinTarget)
def onBanListEvent(self, schid, banid, ip, name, uid, creationTime, durationTime, invokerName, invokercldbid, invokeruid, reason, numberOfEnforcements, lastNickName): if self.requested != schid: return if not ip in self.whitelist: return ts3lib.printMessageToCurrentTab( "{}: [color=red]Unbanning whitelisted IP [b]{}".format( self.name, ip)) ts3lib.bandel(schid, banid)
def whoisReply(self, reply): try: import json;from PythonQt.QtNetwork import QNetworkRequest, QNetworkReply result = json.loads(reply.readAll().data().decode('utf-8')) if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("Result: {0}".format(result)) try: self.answerMessage(self.cmdevent["schid"], self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], "Registrant: {0} | Admin: {1} | Tech: {2}".format(result["registrant_contacts"][0]["name"],result["admin_contacts"][0]["name"],result["technical_contacts"][0]["name"]), True) except: self.answerMessage(self.cmdevent["schid"], self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], "{0}{1}{2}".format(color.ERROR, result["status"], color.ENDMARKER)) self.cmdevent = {"event": "", "returnCode": "", "schid": 0, "targetMode": 4, "toID": 0, "fromID": 0, "params": ""} except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def tick(self): if self.schid == 0: return _newnick = self.fillnick() if _newnick is None: return ts3lib.printMessageToCurrentTab("length: {} | newnick: \"{}\"".format( len(_newnick), _newnick)) ts3lib.setClientSelfVariableAsString( self.schid, ts3defines.ClientProperties.CLIENT_NICKNAME, _newnick) ts3lib.flushClientSelfUpdates(self.schid)
def lookupReply(self, reply): try: import json;from PythonQt.QtNetwork import QNetworkRequest, QNetworkReply result = json.loads(reply.readAll().data().decode('utf-8')) if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("Result: {0}".format(result)) try: self.answerMessage(self.cmdevent["schid"], self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], "{0}: {1} ({2}$/min)".format(result["number"],result["name"],result["price"]), True) except: self.answerMessage(self.cmdevent["schid"], self.cmdevent["targetMode"], self.cmdevent["toID"], self.cmdevent["fromID"], "{0}{1}{2} ({3})".format(color.ERROR, result["err"], color.ENDMARKER,self.cmdevent["params"])) self.cmdevent = {"event": "", "returnCode": "", "schid": 0, "targetMode": 4, "toID": 0, "fromID": 0, "params": ""} except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def __init__(self): if "aaa_ts3Ext" in PluginHost.active: self.ts3host = PluginHost.active["aaa_ts3Ext"].ts3host else: self.ts3host = ts3SessionHost(self) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(timestamp(), self.name, self.author))
def __init__(self): try: loadCfg(self.ini, self.cfg) (tstamp, self.badges, array) = loadBadges() self.requestBadgesExt() self.notice.timeout.connect(self.checkNotice) self.notice.start(30*1000) # 180 if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author)) except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def __init__(self): ts3lib.logMessage( "{0} script for pyTSon by {1} loaded from \"{2}\".".format( self.name, self.author, __file__), ts3defines.LogLevel.LogLevel_INFO, "Python Script", 0) if self.debug: ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(self.timestamp(), self.name, self.author))
def stopTimer(self): if hasattr(self.timer, "isActive") and self.timer.isActive(): self.timer.stop() # self.timer = None ts3lib.setClientSelfVariableAsString( self.schid, ts3defines.ClientProperties.CLIENT_NICKNAME, self._nick) ts3lib.flushClientSelfUpdates(self.schid) ts3lib.printMessageToCurrentTab('Timer stopped!')
def stop(self, reason=" because plugin was stopped", schid=0, target=0): ts3lib.printMessageToCurrentTab( "{} {}: [color=orange]No longer auto-following[/color] {}{}!". format(timestamp(), self.name, clientURL(schid, target) if target else "anyone", reason)) if schid and target != "anyone": del self.targets[schid] else: self.targets = {}
def commandDoxx(self, schid, targetMode, toID, fromID, params=""): try: from PythonQt.QtNetwork import QNetworkAccessManager, QNetworkRequest url = "https://randomuser.me/api/?gender={0}&nat=de&noinfo".format(params.split(" ")[1]) if self.cfg.getboolean("general", "debug"): ts3lib.printMessageToCurrentTab("Requesting: {0}".format(url)) self.nwmc = QNetworkAccessManager() self.nwmc.connect("finished(QNetworkReply*)", self.doxxReply) self.cmdevent = {"event": "", "returnCode": "", "schid": schid, "targetMode": targetMode, "toID": toID, "fromID": fromID, "params": params} self.nwmc.get(QNetworkRequest(QUrl(url))) except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def answerMessage(self, schid, targetMode, toID, fromID, message, hideprefix=False): if schid in self.noperms: ts3lib.printMessageToCurrentTab("Insufficient permissions to answer message from {0}".format(fromID)); return message = [message[i:i + 1024] for i in range(0, len(message), 1024)] if targetMode == ts3defines.TextMessageTargetMode.TextMessageTarget_CLIENT: for msg in message: self.returnCode = ts3lib.createReturnCode(); ts3lib.requestSendPrivateTextMsg(schid, msg, fromID, self.returnCode) elif targetMode == ts3defines.TextMessageTargetMode.TextMessageTarget_CHANNEL: if hideprefix: for msg in message: self.returnCode = ts3lib.createReturnCode(); ts3lib.requestSendChannelTextMsg(schid, "{0}".format(msg), toID, self.returnCode) else: for msg in message: self.returnCode = ts3lib.createReturnCode(); ts3lib.requestSendChannelTextMsg(schid, "[url=client://]@[/url]%s: %s" % ( self.clientURL(schid, fromID), msg), toID, self.returnCode)
def onHotkeyEvent(self, keyword): if keyword == "toggleMove": self.antiMoveStatus = not self.antiMoveStatus schid = ts3lib.getCurrentServerConnectionHandlerID() if self.antiMoveStatus: ts3lib.playWaveFile(schid, path.join(self.soundPath, "on.wav")) else: ts3lib.playWaveFile(schid, path.join(self.soundPath, "off.wav")) ts3lib.printMessageToCurrentTab("{0}{1}: Set Anti-Move to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiMoveStatus)) return
def onConnectStatusChangeEvent(self, serverConnectionHandlerID, newStatus, errorNumber): if not newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: return if not self.enabled: self.InfoFrame = self.getWidgetByObjectName("InfoFrame").findChild( QTextDocument) ts3.printMessageToCurrentTab("[u]" + str(self.InfoFrame) + "[/u]") self.InfoFrame.connect("contentsChanged()", self.onInfoUpdated) self.enabled = True
def __init__(self): content = [] if not path.exists(self.whitelist_ini): with open(self.whitelist_ini, 'w'): pass with open(self.whitelist_ini, encoding="utf-8") as f: content = f.readlines() self.whitelist = [x.strip() for x in content] self.nwmc.connect("finished(QNetworkReply*)", self.reply) self.nwmc_resolver.connect("finished(QNetworkReply*)", self.resolveReply) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))
def printAvatarUsers(self, schid): (err, clist) = ts3lib.getClientList(schid) msg = [] for c in clist: (err, avatar) = ts3lib.getClientVariable(schid, c, ts3defines.ClientPropertiesRare.CLIENT_FLAG_AVATAR) if not avatar or avatar.strip() == "": continue msg.append("{}: {}".format(clientURL(schid, c), avatar)) ts3lib.printMessageToCurrentTab("{}[u]Online users with avatars[/u]: [b]{}[/b]".format(timestamp(), len(msg))) i = 1 for m in msg: ts3lib.printMessageToCurrentTab("{} {}".format(i, m)); i += 1
def __init__(self): if os.path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['filters'] = {"Male": "m/", "Female": "f/"} with open(self.ini, 'w') as configfile: self.cfg.write(configfile) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(timestamp(), self.name, self.author))
def processCommand(self, schid, cmd): cmd = cmd.split(' ', 1) command = cmd[0].lower() if command == "client": clid = int(cmd[1]) (err, cid) = ts3.getChannelOfClient(schid, clid) ts3.printMessageToCurrentTab( "<{0}> Client {1} in channel {2}".format( Time(), clientURL(schid, clid), channelURL(schid, cid))) return 1
def onMenuItemEvent(self, schid, atype, menuItemID, channel): try: description = ts3lib.getChannelVariableAsString( schid, channel, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION)[1] ts3lib.printMessageToCurrentTab(description) except: from traceback import format_exc ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)