Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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!")
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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))
Exemplo n.º 6
0
 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))
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 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 ====")
Exemplo n.º 9
0
 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"]))
Exemplo n.º 10
0
 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
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
 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)
Exemplo n.º 13
0
 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)
Exemplo n.º 14
0
 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)
Exemplo n.º 15
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)
Exemplo n.º 16
0
 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)
Exemplo n.º 17
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))
Exemplo n.º 18
0
 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)
Exemplo n.º 19
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))
Exemplo n.º 20
0
 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!')
Exemplo n.º 21
0
 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 = {}
Exemplo n.º 22
0
 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)
Exemplo n.º 23
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)
Exemplo n.º 24
0
 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
Exemplo n.º 25
0
 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
Exemplo n.º 26
0
 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))
Exemplo n.º 27
0
 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
Exemplo n.º 28
0
 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))
Exemplo n.º 29
0
 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
Exemplo n.º 30
0
 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)