Esempio n. 1
0
 def processCommand(self, schid, cmd):
     cmd = cmd.split(' ', 1)
     command = cmd[0].lower()
     id = int(cmd[1])
     if command == "client":
         (err, cid) = ts3lib.getChannelOfClient(schid, id)
         ts3lib.printMessageToCurrentTab(
             "<{}> Client {} in channel {}".format(Time(),
                                                   clientURL(schid, id),
                                                   channelURL(schid, cid)))
         return True
     elif command == "channel":
         (err, clids) = ts3lib.getChannelClientList(schid, id)
         channel_clients = []
         for clid in clids:
             channel_clients.append(clientURL(schid, clid))
         ts3lib.printMessageToCurrentTab(
             "<{}> Channel {} with [b]{}[/b] clients: {}".format(
                 Time(), channelURL(schid, id), len(clids),
                 ','.join(channel_clients)))
         return True
     elif command == "server":
         ts3lib.printMessageToCurrentTab("<{}> Server {}".format(
             Time(), serverURL(schid)))
         return True
     else:
         ts3lib.printMessageToCurrentTab(
             schid, "Syntax: /py info client/channel/server <id>")
         return False
Esempio n. 2
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))
Esempio n. 3
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)
Esempio n. 4
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])
     # pw = getChannelPassword(schid, cid, False, False, True)
     ts3lib.printMessageToCurrentTab(
         "{} {}: Auto-following {} in channel {} in {}ms".format(
             timestamp(), self.name, clientURL(schid, clid),
             channelURL(schid, cid), delay))  # with pw \"{}\" pw
     self.cid = cid
     QTimer.singleShot(delay, self.joinTarget)
Esempio n. 5
0
 def __init__(self):
     schid = ts3lib.getCurrentServerConnectionHandlerID()
     err, clid = ts3lib.getClientID(schid)
     (err, cgid) = ts3lib.getClientVariable(
         schid, clid,
         ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID)
     # ts3lib.printMessageToCurrentTab("{}".format(cgid))
     if cgid == 9:
         err, cid = ts3lib.getChannelOfClient(schid, clid)
         self.mychan = cid
         ts3lib.printMessageToCurrentTab("{} > New channel is {}".format(
             self.name, channelURL(schid, cid)))
     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))
Esempio n. 6
0
 def joinTarget(self, schid=0, cid=0, pw=""):
     if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, ownID) = ts3lib.getClientID(schid)
     (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
     clid = getClientIDByUID(schid, self.targets[schid])
     if not cid: (err, cid) = ts3lib.getChannelOfClient(schid, clid)
     if ownCID == cid: return
     pw = getChannelPassword(schid, cid, False, False, True)
     pw = pw if pw else "123"
     # print(schid, ownID, cid, pw)
     ts3lib.printMessageToCurrentTab(
         "{} {}: Now following {} in channel {} with pw \"{}\"".format(
             timestamp(), self.name, clientURL(schid, clid),
             channelURL(schid, cid), pw))
     ts3lib.requestClientMove(schid, ownID, cid, pw)
     self.cid = 0
Esempio n. 7
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:
         if channelGroupID == 9:
             self.mychan = channelID
             ts3lib.printMessageToCurrentTab(
                 "{} > New channel is {}".format(
                     self.name, channelURL(schid, channelID)))
         else:
             self.mychan = 0
         return
Esempio n. 8
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")
Esempio n. 9
0
 def onServerErrorEvent(self, schid, errorMessage, error, returnCode, extraMessage):
     if returnCode == "passwordCracker:manual":
         (err, name) = ts3lib.getChannelVariable(schid, self.cid, ChannelProperties.CHANNEL_NAME)
         errorMessage = errorMessage.title()
         msgBox("Channel: {0}\n\nPW: {1}\n\nResult: {2}".format(name, self.pw,errorMessage))
     if not returnCode == self.retcode: return
     errorMessage = errorMessage.title()
     if error == ERROR_channel_invalid_password:
         if self.flooding: self.flooding = False
         self.status = '[color=orange]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
     elif error == ERROR_client_is_flooding:
         self.flooding = True
         self.timer.stop()
         QTimer.singleShot(self.antiflood_delay, self.startTimer)
         self.status = '[color=red]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
     elif error == ERROR_channel_invalid_id:
         self.timer.stop()
         self.status = '[color=red]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
         msgBox("Channel #{0} is invalid!\n\nStopping Cracker!".format(self.cid), QMessageBox.Warning)
     elif error == ERROR_ok:
         if self.flooding: self.flooding = False
         self.timer.stop()
         (err, name) = ts3lib.getChannelVariable(schid, self.cid, ChannelProperties.CHANNEL_NAME)
         ts3lib.printMessageToCurrentTab('Channel: {0} Password: \"{1}\"'.format(channelURL(schid, self.cid, name), self.pws[self.pwc-1] if self.mode == 0 else self.pwc-1))
         self.status = '[color=green]{0}[/color]'.format(errorMessage)
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
         if confirm("Password found! ({0} / {1})".format(self.pwc, len(self.pws)) if self.mode == 0 else "Password found!",
                    "Password \"{0}\" was found for channel \"{1}\"\n\nDo you want to join now?".format(self.pws[self.pwc-1] if self.mode == 0 else self.pwc-1,name)):
             (err, ownID) = ts3lib.getClientID(schid)
             ts3lib.requestClientMove(schid, ownID, self.cid, self.pws[self.pwc-1] if self.mode == 0 else str(self.pwc-1))
     else:
         self.status = errorMessage
         ts3lib.requestInfoUpdate(schid, PluginItemType.PLUGIN_CHANNEL, self.cid)
     if error in [ERROR_channel_invalid_id, ERROR_ok] or returnCode in ["passwordCracker:manual"]: self.cracking = False
     return 1
Esempio n. 10
0
 def onClientMoveMovedEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moverID, moverName, moverUniqueIdentifier, moveMessage):
     if moverID == 0 or self.backup is None: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID or moverID == ownID or moverID == 0: return
     (err, sgids) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS)
     if not set(sgids).isdisjoint(self.whitelistSGIDs): return
     (err, uid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER)
     if uid in self.whitelistUIDs: return
     self.backup = {"schid": schid, "cid": oldChannelID}
     delay = randint(self.delay[0], self.delay[1])
     ts3lib.printMessageToCurrentTab("{} {}: Switching back to channel {} in {}ms".format(timestamp(),self.name,channelURL(schid, self.backup["cid"]), delay))# clientURL(schid, self.backup["schid"]), 
     QTimer.singleShot(delay, self.moveBack)