Example #1
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if self.schid == schid and self.channel == oldChannelID:
         clients = self.channelClientCount(schid, oldChannelID)
         if self.debug:
             ts3lib.printMessageToCurrentTab("clients: {0}".format(clients))
         (error, maxclients) = ts3lib.getChannelVariable(
             schid, oldChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         (error, maxfamilyclients) = ts3lib.getChannelVariable(
             schid, oldChannelID,
             ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxfamilyclients: {1}".format(
                     error, maxfamilyclients))
         if clients < maxclients and clients < maxfamilyclients:
             (error, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, oldChannelID,
                                      self.password)
             self.schid = 0
             self.channel = 0
             self.password = ""
             self.name = ""
         else:
             ts3lib.printMessageToCurrentTab(
                 "{0} left channel {1}. [color=red]{2}[/color] client(s) remaining."
                 .format(clientURL(schid, clientID),
                         channelURL(schid, oldChannelID),
                         maxclients - clients + 1))
Example #2
0
 def onUpdateChannelEditedEvent(self, schid, channelID, invokerID, invokerName, invokerUniqueIdentifier):
     (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if invokerID == ownID:
         (err, self.settings["maxclients"]) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         (err, self.settings["tp"]) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     (err, ownChannel) = ts3lib.getChannelOfClient(schid, ownID)
     if channelID != ownChannel: return
     (err, invokerChannel) = ts3lib.getChannelOfClient(schid, invokerID)
     if invokerChannel == channelID: return
     _needed = False
     (err, ntp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if ntp != self.settings["tp"]:
         _needed = True
         ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, self.settings["tp"])
     (err, cmc) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
     ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0)
     if cmc != self.settings["maxclients"]:
         _needed = True
         ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.settings["maxclients"])
     if _needed:
         ts3lib.flushChannelUpdates(schid, channelID)
         self.violations[invokerUniqueIdentifier] += 1
         if self.violations[invokerUniqueIdentifier] > 2:
             (err, dbid) = ts3lib.getClientVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
             ts3lib.requestSetClientChannelGroup(schid, [9], [channelID], [dbid])
             del self.violations[invokerUniqueIdentifier]
Example #3
0
 def onUpdateChannelEditedEvent(self, schid, channelID, invokerID,
                                invokerName, invokerUniqueIdentifier):
     if self.debug:
         ts3lib.printMessageToCurrentTab(
             "self.schid: {0} | schid: {1}".format(self.schid, schid))
     if self.debug:
         ts3lib.printMessageToCurrentTab(
             "self.channel: {0} | channelID: {1}".format(
                 self.channel, channelID))
     if self.schid == schid and self.channel == channelID:
         clients = self.channelClientCount(schid, channelID)
         if self.debug:
             ts3lib.printMessageToCurrentTab("clients: {0}".format(clients))
         (error, maxclients) = ts3lib.getChannelVariable(
             schid, channelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         (error, maxfamilyclients) = ts3lib.getChannelVariable(
             schid, channelID,
             ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxfamilyclients: {1}".format(
                     error, maxfamilyclients))
         if clients < maxclients and clients < maxfamilyclients:
             (error, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, channelID,
                                      self.password)
             self.schid = 0
             self.channel = 0
             self.password = ""
             self.name = ""
Example #4
0
 def updateChannel(self, schid, ownID=0, ownCID=0):
     if not ownID: (err, ownID) = ts3lib.getClientID(schid)
     if not ownCID: (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     (err, cname) = ts3lib.getChannelVariable(
         schid, ownCID, ts3defines.ChannelProperties.CHANNEL_NAME)
     name = re.sub(r'^\[[crl\*]spacer(.*)?\]',
                   '',
                   cname,
                   flags=re.IGNORECASE | re.UNICODE)
     from unidecode import unidecode
     self.activity["state"] = unidecode(name)
     clients = len(ts3lib.getChannelClientList(schid, ownCID)[1])
     # (err, clients) = ts3lib.getChannelVariable(schid, ts3defines.ChannelPropertiesRare.)
     (err, cmax) = ts3lib.getChannelVariable(
         schid, ownCID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
     if cmax >= clients:
         if PluginHost.cfg.getboolean("general", "verbose"):
             print("cmax", cmax, ">=", "clients", clients)
         self.activity["party"]["size"] = [clients, cmax]
     else:
         (err, smax) = ts3lib.getServerVariable(
             schid,
             ts3defines.VirtualServerProperties.VIRTUALSERVER_MAXCLIENTS)
         # (err, clients) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_CLIENTS_ONLINE)
         # clients = len(ts3lib.getClientList(schid)[1])
         self.activity["party"] = {"size": [clients, smax]}
     (err, ip) = ts3lib.getConnectionVariable(
         schid, ownID, ts3defines.ConnectionProperties.CONNECTION_SERVER_IP)
     (err, port) = ts3lib.getConnectionVariable(
         schid, ownID,
         ts3defines.ConnectionProperties.CONNECTION_SERVER_PORT)
     self.activity["secrets"] = {
         "join": "ts3server://{}?port={}&cid={}".format(ip, port, ownCID)
     }
     self.update = True
Example #5
0
def getChannelPassword(schid: int,
                       cid: int,
                       crack: bool = False,
                       ask: bool = False,
                       calculate: bool = False):
    """
    Tries several methods to get the channel password.
    :param calculate: Wether to try to solve math riddles
    :param schid: serverConnectionHandlerID
    :param cid: channelID of the target channel
    :param crack: wether to try a dictionary attack on the channel to get the password
    :param ask: wether to ask the user for the password in case he knows
    :return password: the possible password
    """
    # type: (int, int, bool, bool, bool) -> str
    (err, passworded) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
    if err != ts3defines.ERROR_ok or not passworded:
        return False
    (err, path, pw) = ts3lib.getChannelConnectInfo(schid, cid)
    if pw:
        return pw
    (err, name) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
    if err != ts3defines.ERROR_ok or not name: return err
    name = name.strip()
    pattern = r"(?:pw|pass(?:wor[dt])?)[|:=]?\s*(.*)"
    # pattern = r"^.*[kennwort|pw|password|passwort|pass|passwd](.*)$"
    regex = search(pattern, name, IGNORECASE)
    if regex:
        result = regex.group(1).strip()
        result = sub(r"[)|\]|\}]$", "", result)
        if calculate and any(i in result
                             for i in ["/", "%", "+", "-", "^", "*"]):
            nsp = NumericStringParser()
            result = str(nsp.eval(result)).replace(".0", "")
        return result
    # if name.isdigit(): return name
    last = name.split(" ")[-1]
    if last.isdigit():
        return last
    if crack:
        active = PluginHost.active
        if "PW Cracker" in active:
            active["PW Cracker"].onMenuItemEvent(
                schid, ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 1,
                cid)
    if ask:
        pw = inputBox("Enter Channel Password", "Password:"******"/", "%", "+", "-", "^", "*"]):
        nsp = NumericStringParser()
        try:
            return str(nsp.eval(name)).replace(".0", "")
        except:
            pass
    return name
Example #6
0
 def onMenuItemEvent(self, schid, atype, menuItemID, channel):
     if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: return
     try:
         (error, ownID) = ts3lib.getClientID(schid)
         (error, maxclients) = ts3lib.getChannelVariable(
             schid, channel,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         if self.debug:
             ts3lib.printMessageToCurrentTab(
                 "error: {0} | maxclients: {1}".format(error, maxclients))
         if menuItemID == 0:
             pw = inputBox("Enter Channel Password", "Password:"******"clients: {0}".format(clients))
             (error, maxfamilyclients) = ts3lib.getChannelVariable(
                 schid, channel,
                 ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "error: {0} | maxfamilyclients: {1}".format(
                         error, maxfamilyclients))
             if clients < maxclients and clients < maxfamilyclients:
                 ts3lib.requestClientMove(schid, ownID, channel, pw)
                 return True
             (error, name) = ts3lib.getChannelVariableAsString(
                 schid, channel, ts3defines.ChannelProperties.CHANNEL_NAME)
             self.schid = schid
             self.channel = channel
             self.password = pw
             self.cname = name
             if not pw:
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url]. [color=red]{2}[/color] client(s) remaining."
                     .format(channel, name, maxclients - clients + 1))
             else:
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url] with password \"{2}\". [color=red]{3}[/color] client(s) remaining."
                     .format(channel, name, pw, maxclients - clients + 1))
         elif menuItemID == 1:
             pw = inputBox("Enter Channel Password", "Password:"******"pyTSon", 0)
Example #7
0
 def getChannel(self, schid):
     (err, cids) = ts3lib.getChannelList(schid)
     for cid in cids:
         (err, perm) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_SEMI_PERMANENT)
         if not perm: continue
         (err, name) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
         if not self.chan.get("props", "name") in name: continue
         (err, parent) = ts3lib.getParentChannelOfChannel(schid, cid)
         if not parent == self.schids[schid]: continue
         return cid
     return 0
Example #8
0
 def onUpdateChannelEditedEvent(self, schid, channelID, invokerID, invokerName, invokerUniqueIdentifier):
     if not self.cid == channelID: return
     if not self.schid == schid: return
     (err, haspw) = ts3lib.getChannelVariable(schid, channelID, ChannelProperties.CHANNEL_FLAG_PASSWORD)
     if haspw: return
     self.timer.stop()
     (err, name) = ts3lib.getChannelVariable(schid, channelID, ChannelProperties.CHANNEL_NAME)
     if confirm("Password removed", "Password was removed from channel \"{0}\" by \"{1}\"\n\nDo you want to join now?".format(name, invokerName)):
         (err, ownID) = ts3lib.getClientID(self.schid)
         ts3lib.requestClientMove(schid, ownID, channelID, "")
     self.schid = 0;self.cid = 0;self.pwc = 0
Example #9
0
 def onClientChannelGroupChangedEvent(self, schid, channelGroupID,
                                      channelID, clientID, invokerClientID,
                                      invokerName, invokerUniqueIdentity):
     (err, suid) = ts3lib.getServerVariable(
         schid,
         ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     # if self.debug: ts3lib.printMessageToCurrentTab('suid != self.suid: {}'.format(suid != self.suid))
     if suid != self.suid: return
     (err, ownID) = ts3lib.getClientID(schid)
     # if self.debug: ts3lib.printMessageToCurrentTab('clientID != ownID: {}'.format(clientID != ownID))
     if clientID != ownID: return
     # if self.debug: ts3lib.printMessageToCurrentTab('channelGroupID != self.channelAdminGroupID: {}'.format(channelGroupID != self.channelAdminGroupID))
     if channelGroupID != self.channelAdminGroupID: return
     # if self.debug: ts3lib.printMessageToCurrentTab('invokerClientID != 0: {}'.format(invokerClientID != 0))
     if invokerClientID == 0:
         (err, ntp) = ts3lib.getChannelVariable(
             schid, channelID,
             ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
         if not ntp or ntp == 0:
             ts3lib.setChannelVariableAsInt(
                 schid, channelID,
                 ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER,
                 self.settings["tp"])
         # (err, cmc) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
         ts3lib.setChannelVariableAsInt(
             schid, channelID, ts3defines.ChannelPropertiesRare.
             CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0)
         ts3lib.setChannelVariableAsInt(
             schid, channelID,
             ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS,
             self.settings["maxclients"])
         (err, cnp) = ts3lib.getChannelVariable(
             schid, channelID,
             ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC)
         if not cnp or cnp == "":
             ts3lib.setChannelVariableAsString(
                 schid, channelID,
                 ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC,
                 "Team | Lounge 1")
         ts3lib.flushChannelUpdates(schid, channelID)
     return
     # clid = ts3lib.getClientIDbyNickname(schid, self.gommeBotNick)
     # if not clid: ts3lib.printMessage(schid, 'Gomme-Bot not found.', ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
     # (err, uid) = ts3lib.getClientVariable(schid, self.gommeBotID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     # if uid != "serveradmin": return
     # if self.debug: ts3lib.printMessageToCurrentTab('self.gommeBotID == 0: {}'.format(self.gommeBotID == 0))
     if self.gommeBotID == 0: return
     ts3lib.requestSendPrivateTextMsg(schid, "registriert", self.gommeBotID)
Example #10
0
 def __init__(self, channelGroupManager, schid, cid, parent=None):
     try:
         super(QWidget, self).__init__(parent)
         setupUi(self, channelGroupManager.ui)
         self.schid = schid
         self.cid = cid
         cgroups = channelGroupManager.cgroups
         cgroups = cgroups[schid]
         cgroups = cgroups["groups"]
         self.cgroups = cgroups
         self.db = channelGroupManager.db
         self.execSQL = channelGroupManager.execSQL
         self.setAttribute(Qt.WA_DeleteOnClose)
         (err, cname) = ts3lib.getChannelVariable(
             schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
         self.setWindowTitle("Members of \"{}\"".format(cname))
         self.tbl_members.setColumnWidth(0, 130)
         self.tbl_members.setColumnWidth(1, 250)
         self.tbl_members.setColumnWidth(2, 215)
         self.tbl_members.setColumnWidth(3, 50)
         self.tbl_members.setColumnWidth(4, 140)
         self.setupTable()
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Example #11
0
 def getInfo(self, schid, selectedItemID, lists):
     i = []
     for lst in lists:
         for name, var in getItems(lst):
             (name, var) = self.preProcessVar(schid, selectedItemID, name,
                                              var, lst)
             if var is None: continue
             if lst in [
                     VirtualServerProperties, VirtualServerPropertiesRare
             ]:
                 (err, var) = ts3.getServerVariable(schid, var)
             elif lst in [ChannelProperties, ChannelPropertiesRare]:
                 (err,
                  var) = ts3.getChannelVariable(schid, selectedItemID, var)
             elif lst in [ConnectionProperties, ConnectionPropertiesRare]:
                 (err,
                  var) = ts3.getConnectionVariable(schid, selectedItemID,
                                                   var)
             else:
                 (err, var) = ts3.getClientVariable(schid, selectedItemID,
                                                    var)
             if err != ERROR_ok or var == "" or var == 0: continue
             if isinstance(var, map): var = ", ".join(map(str, var))
             if name in ["VIRTUALSERVER_IP", "CONNECTION_CLIENT_IP"]:
                 i.extend(self.ipInfo(var))
             (name, var) = self.postProcessVar(schid, selectedItemID, name,
                                               var, lst)
             i.append('{0}: {1}'.format(name, var))
     return i
Example #12
0
 def onClientChannelGroupChangedEvent(self, schid, channelGroupID, channelID, clientID, invokerClientID, invokerName, invokerUniqueIdentity):
     (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID: return
     if channelGroupID != self.channelAdminGroupID: return
     if invokerClientID == 0:
         (err, ntp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
         if not ntp or ntp == 0: ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, self.settings["tp"])
         ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, 0)
         ts3lib.setChannelVariableAsInt(schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, self.settings["maxclients"])
         (err, cnp) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC)
         if not cnp or cnp == "": ts3lib.setChannelVariableAsString(schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC, "Team | Lounge 1")
         ts3lib.flushChannelUpdates(schid, channelID)
     if self.gommeBotID < 1: return
     ts3lib.requestSendPrivateTextMsg(schid, "registriert", self.gommeBotID)
Example #13
0
 def setupTable(self):
     tbl = self.tbl_variables
     tbl.clearContents()
     tbl.setRowCount(0)
     for i in self.info.getInfoData(self.schid, self.selectedItemID,
                                    self.atype):
         k = i.split(': ')[0]
         v = i.split(': ')[1]
         pos = tbl.rowCount
         tbl.insertRow(pos)
         tbl.setItem(pos, 0, QTableWidgetItem(k))
         tbl.setItem(pos, 1, QTableWidgetItem(v))
     name = info.name
     if self.atype == PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         err, name = ts3lib.getServerVariable(
             self.schid, VirtualServerProperties.VIRTUALSERVER_NAME)
     elif self.atype == PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL:
         err, name = ts3lib.getChannelVariable(
             self.schid, self.selectedItemID,
             ChannelProperties.CHANNEL_NAME)
     elif self.atype == PluginMenuType.PLUGIN_MENU_TYPE_CLIENT:
         err, name = ts3lib.getClientVariable(
             self.schid, self.selectedItemID,
             ClientProperties.CLIENT_NICKNAME)
     tbl.sortItems(0)
     self.setWindowTitle("{}'s Variables".format(name))
Example #14
0
 def tick(self):
     try:
         self.retcode = ts3lib.createReturnCode()
         if self.mode == 0:
             if self.pwc >= len(self.pws):
                 self.timer.stop()
                 (err, name) = ts3lib.getChannelVariable(
                     self.schid, self.cid, ChannelProperties.CHANNEL_NAME)
                 msgBox(
                     "Password for channel \"{0}\" was not found :(\n\nTried {1} passwords."
                     .format(name, self.pwc + 1))
                 self.cracking = False
                 return
             pw = self.pws[self.pwc]
         elif self.mode == 1:
             pw = str(self.pwc)
         err = ts3lib.verifyChannelPassword(self.schid, self.cid, pw,
                                            self.retcode)
         if err != ERROR_ok:
             (er, status) = ts3lib.getErrorMessage(err)
             print(
                 'ERROR {0} ({1}) while trying password \"{2}\" for channel #{3} on server #{4}'
                 .format(status, err, pw, self.cid, self.schid))
         # else: print('[{0}] Trying password \"{1}\" for channel #{2} on server #{3}'.format(self.pwc, pw, self.cid, self.schid))
         if not self.flooding: self.pwc += self.step
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), LogLevel.LogLevel_ERROR, "pyTSon",
                           0)
Example #15
0
def isPassworded(schid, cid):
    (error, pw) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
    if PluginHost.cfg.getboolean("general", "verbose"):
        ts3lib.printMessageToCurrentTab("Channel #{} is {}".format(
            cid,
            "[color=red]passworded" if pw else "[color=green]not passworded"))
    return bool(pw)
Example #16
0
def isSemiPermanent(schid, cid):
    (error, semipermanent) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_SEMI_PERMANENT)
    if PluginHost.cfg.getboolean("general", "verbose"):
        ts3lib.printMessageToCurrentTab("Channel #{} is {}".format(
            cid, "[color=red]semi permanent"
            if semipermanent else "[color=green]not semi permanent"))
    return bool(semipermanent)
Example #17
0
def isBlacklisted(schid, cid):
    (error, name) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
    if PluginHost.cfg.getboolean("general", "verbose"):
        bl = []
        for b in blacklist:
            if b in name.lower(): bl.append(b)
        ts3lib.printMessageToCurrentTab("Channel #{} is {} ({})".format(cid, "[color=red]blacklisted ({})".format(", ".join(bl)) if any(x in name.lower() for x in blacklist) else "[color=green]not blacklisted", name))
    return any(x in name.lower() for x in blacklist)
Example #18
0
 def getChannelInfo(self, schid, cid):
     i = []
     (err, path, password) = ts3.getChannelConnectInfo(schid, cid)
     (err, name) = ts3.getChannelVariable(schid, cid, ChannelProperties.CHANNEL_NAME)
     if path != name: i.append('Path: {0}'.format(path))
     if password != "": i.append('Password: {0}'.format(password))
     i.extend(self.getInfo(schid, cid, [ChannelProperties, ChannelPropertiesRare]))
     return i if len(i) > 0 else None
Example #19
0
def isPWInName(schid, cid):
    (error, name) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
    if PluginHost.cfg.getboolean("general", "verbose"):
        bl = []
        for b in passwords:
            if b in name.lower(): bl.append(b)
        ts3lib.printMessageToCurrentTab("Channel #{} {} [{}]".format(cid, "[color=yellow]has pw in name ({})".format(", ".join(bl)) if any(x in name.lower() for x in passwords) else "[color=grey]doesn't have pw in name", name))
    return any(x in name.lower() for x in passwords)
Example #20
0
def channelURL(schid=None, cid=0, name=None):
    if schid == None:
        try: schid = ts3lib.getCurrentServerConnectionHandlerID()
        except: pass
    if name == None:
        try: (error, name) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
        except: name = cid
    return '[b][url=channelid://{0}]"{1}"[/url][/b]'.format(cid, name)
Example #21
0
def isMusicChannel(schid, cid):
    (error, codec) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_CODEC)
    if PluginHost.cfg.getboolean("general", "verbose"):
        ts3lib.printMessageToCurrentTab("Channel #{} is {} ({})".format(
            cid, "[color=red]music channel".format()
            if codec == 5 else "[color=green]no music channel", codec))
    return codec == ts3defines.CodecType.CODEC_OPUS_MUSIC
Example #22
0
 def neededTalkPower(self):
     (err, tp) = ts3lib.getChannelVariable(
         self.schid, self.channelID,
         ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if err != ts3defines.ERROR_ok:
         raise ts3Error(
             "Error getting client channel needed talk power: (%s, %s)" %
             (err, ts3lib.getErrorMessage(err)[1]))
     return tp
Example #23
0
 def checkChannel(self, schid):
     (err, clients) = ts3lib.getChannelClientList(schid, self.supchan); clients = len(clients)
     (err, maxclients) = ts3lib.getChannelVariable(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
     if clients < maxclients:
         ts3lib.setChannelVariableAsString(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_NAME,self.chan.get("props", "name open"))
     elif clients >= maxclients:
         ts3lib.setChannelVariableAsString(schid, self.supchan, ts3defines.ChannelProperties.CHANNEL_NAME, self.chan.get("props", "name in use"))
     else: return
     ts3lib.flushChannelUpdates(schid, self.supchan)
Example #24
0
 def onNewChannelCreatedEvent(self, schid, cid, channelParentID, invokerID,
                              invokerName, invokerUniqueIdentifier):
     if schid != self.schid:
         print(cid, "schid != self.schid")
         return
     (err, ownID) = ts3lib.getClientID(schid)
     if invokerID == ownID:
         print(cid, "invokerID == ownID")
         return
     if isPermanent(schid, cid) or isSemiPermanent(schid, cid):
         print("isPermanent(schid, cid) or isSemiPermanent(schid, cid)")
         return
     (error, maxclients) = ts3lib.getChannelVariable(
         schid, cid, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
     # (error, maxfamilyclients) = ts3lib.getChannelVariable(schid, cid, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
     if maxclients != -1:
         clients = channelClientCount(schid, cid)
         if clients >= maxclients:
             print(cid, "clients >= maxclients")
             return
     (err, needed_tp) = ts3lib.getChannelVariable(
         schid, cid,
         ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if needed_tp >= 0:
         (err, ownTP) = ts3lib.getClientSelfVariable(
             schid, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
         if int(ownTP) < needed_tp: self.request_tp = True
     (err, pw) = ts3lib.getChannelVariable(
         schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
     if err == ts3defines.ERROR_ok and pw:
         pw = getChannelPassword(schid, cid, False, False, True)
         # ts3lib.verifyChannelPassword(schid, cid, pw, "passwordCracker:manual")
         if not pw:
             print(cid, "not pw")
             return
     status = getContactStatus(invokerUniqueIdentifier)
     if status == ContactStatus.BLOCKED:
         print(cid, invokerUniqueIdentifier, "blocked")
         return
     ts3lib.printMessage(
         schid, "{} > Joining into {}".format(self.name,
                                              channelURL(schid, cid)),
         ts3defines.PluginMessageTarget.PLUGIN_MESSAGE_TARGET_SERVER)
     ts3lib.requestClientMove(schid, ownID, cid, pw if pw else "123")
Example #25
0
def getChannelPassword(schid, cid, crack=False, ask=False):
    """
    Tries several methods to get the channel password.
    :param schid: serverConnectionHandlerID
    :param cid: channelID of the target channel
    :param crack: wether to try a dictionary attack on the channel to get the password
    :param ask: wether to ask the user for the password in case he knows
    :return password: the possible password
    """
    # type: (int, int, bool, bool) -> str
    (err, passworded) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
    if err != ts3defines.ERROR_ok or not passworded: return False
    (err, path, pw) = ts3lib.getChannelConnectInfo(schid, cid)
    if pw: return pw
    (err, name) = ts3lib.getChannelVariable(
        schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
    if err != ts3defines.ERROR_ok or not name: return err
    name = name.strip()
    pattern = r"(?:p|pw|pass(?:wor[dt])?)[|:=]?\s*(.*)"
    regex = search(pattern, name, IGNORECASE)
    if regex:
        result = regex.group(1).strip()
        result = sub(r"[)|\]|\}]$", "", result)
        return result
    """
    pattern = r"^.*[kennwort|pw|password|passwort|pass|passwd](.*)$"
    regex = search(pattern, name, IGNORECASE)
    if regex:
        result = regex.group(1).strip()
        result = sub(r"[)|\]|\}]$", "", result)
        return result
    """
    if name.isdigit(): return name
    if crack:
        active = PluginHost.active
        if "PW Cracker" in active:
            active["PW Cracker"].onMenuItemEvent(
                schid, ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL, 1,
                cid)
    if ask:
        pw = inputBox("Enter Channel Password", "Password:", name)
        return pw
    return name
Example #26
0
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if not newStatus == ConnectStatus.STATUS_DISCONNECTED: return
     if not self.schid == schid: return
     self.timer.stop()
     (err, name) = ts3lib.getChannelVariable(schid, self.cid,
                                             ChannelProperties.CHANNEL_NAME)
     msgBox("Server left\n\nStopping Cracker!", QMessageBox.Warning)
     self.schid = 0
     self.cid = 0
     self.pwc = 0
Example #27
0
def countChannels(schid, find: str, case_sensitive=False):
    if not case_sensitive: find = find.lower()
    (error, cids) = ts3lib.getChannelList(schid)
    ret = {}
    for cid in cids:
        (err, name) = ts3lib.getChannelVariable(
            schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
        if not case_sensitive: name = name.lower()
        if find in name: ret[cid] = name
    return ret
Example #28
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage):
     if schid != self.schid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID: return
     if not self.request_tp: return
     self.request_tp = False
     (err, needed_tp) = ts3lib.getChannelVariable(schid, newChannelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if needed_tp >=0:
         (err, ownTP) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
         if int(ownTP) < needed_tp: ts3lib.requestIsTalker(schid, True, "")
Example #29
0
 def onMenuItemEvent(self, schid, atype, menuItemID, channel):
     if menuItemID == 0:
         err, cids = ts3lib.getChannelList(schid)
         channels = dict()
         for cid in cids:
             (err, name) = ts3lib.getChannelVariable(
                 schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
             (err, order) = ts3lib.getChannelVariable(
                 schid, cid, ts3defines.ChannelProperties.CHANNEL_ORDER)
             if err == ts3defines.ERROR_ok and name: channels[order] = name
         channels = OrderedDict(sorted(channels.items(),
                                       key=lambda t: t[0]))
         for name in channels.values():
             ts3lib.printMessageToCurrentTab(name)
     elif menuItemID == 1:
         description = ts3lib.getChannelVariableAsString(
             schid, channel,
             ts3defines.ChannelProperties.CHANNEL_DESCRIPTION)[1]
         ts3lib.printMessageToCurrentTab(description)
         QApplication.clipboard().setText(description)
Example #30
0
def getChannelIDByName(name: str, schid: int = 0, multi: bool = False):
    if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
    if multi: results = []
    (err, cids) = ts3lib.getChannelList(schid)
    for cid in cids:
        (err, _name) = ts3lib.getChannelVariable(
            schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
        if name == _name:
            if multi: results.append(cid)
            else: return cid
    if multi and len(results): return results