def backup(self, serverConnectionHandlerID): ownID = ts3lib.getClientID(serverConnectionHandlerID)[1] ip = ts3lib.getConnectionVariableAsString( serverConnectionHandlerID, ownID, ts3defines.ConnectionProperties.CONNECTION_SERVER_IP)[1] self.cfg['data']['ip'] = ip port = ts3lib.getConnectionVariableAsUInt64( serverConnectionHandlerID, ownID, ts3defines.ConnectionProperties.CONNECTION_SERVER_PORT)[1] self.cfg['data']['port'] = str(port) serverPassword = ts3lib.getServerConnectInfo(serverConnectionHandlerID, 256)[3] self.currentServerPW = serverPassword nickname = ts3lib.getClientSelfVariableAsString( serverConnectionHandlerID, ts3defines.ClientProperties.CLIENT_NICKNAME)[1] self.cfg.set('data', 'nickname', nickname) tabID = ts3defines.PluginConnectTab.PLUGIN_CONNECT_TAB_CURRENT self.cfg['data']['tabID'] = str(tabID) channelID = ts3lib.getChannelOfClient(serverConnectionHandlerID, ownID)[1] channelPassword = ts3lib.getChannelConnectInfo( serverConnectionHandlerID, channelID, 256)[2] self.currentChannelPW = channelPassword return
def onMenuItemEvent(self, serverConnectionHandlerID, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if menuItemID == 0: #self.reconnect(serverConnectionHandlerID) ownID = ts3lib.getClientID(serverConnectionHandlerID)[1] channelID = ts3lib.getChannelOfClient(serverConnectionHandlerID, ownID)[1] channelPassword = ts3lib.getChannelConnectInfo(serverConnectionHandlerID, channelID, 256)[2] ts3lib.printMessageToCurrentTab(channelPassword) ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "yee.wav")) ts3lib.printMessageToCurrentTab("F**k off. You know this has no use. Like your life. Pew Pew.") if menuItemID == 1: self.antiMoveStatus = not self.antiMoveStatus ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiMoveStatus)) if menuItemID == 2: self.antiChannelKickStatus = not self.antiChannelKickStatus ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiChannelKickStatus)) if menuItemID == 3: self.antiServerKickStatus = not self.antiServerKickStatus ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiServerKickStatus)) if menuItemID == 4: self.antiServerBanStatus = not self.antiServerBanStatus ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiServerBanStatus)) if menuItemID == 5: self.backup(serverConnectionHandlerID) ts3lib.printMessageToCurrentTab("{0}[color=green]Backup complete![/color]".format(timestamp()))
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
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if schid not in self.tabs: return if clientID != self.tabs[schid]["clid"]: return self.tabs[schid]["cid"] = newChannelID (err, self.tabs[schid]["cpath"], self.tabs[schid]["cpw"]) = ts3lib.getChannelConnectInfo( schid, newChannelID)
def joinTarget(self, schid=0): if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID() (err, ownID) = ts3lib.getClientID(schid) (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) (err, cid) = ts3lib.getChannelOfClient(schid, self.targets[schid]) if ownCID == cid: return (err, path, pw) = ts3lib.getChannelConnectInfo(schid, cid) ts3lib.requestClientMove(schid, ownID, cid, pw)
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
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if clientID != self.tabs[schid]["clid"]: return # (err, pw) = ts3lib.getChannelVariable(schid, newChannelID, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD) (err, self.tabs[schid]["cpath"], self.tabs[schid]["cpw"]) = ts3lib.getChannelConnectInfo( schid, newChannelID) self.log(LogLevel.LogLevel_DEBUG, "Tab updated: {}".format(self.tabs[schid]), 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 saveTab(self, schid): if not hasattr(self.tabs, '%s'%schid): self.tabs[schid] = {} (err, self.tabs[schid]["name"]) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME) (err, self.tabs[schid]["host"], self.tabs[schid]["port"], self.tabs[schid]["pw"]) = ts3lib.getServerConnectInfo(schid) (err, self.tabs[schid]["clid"]) = ts3lib.getClientID(schid) (err, self.tabs[schid]["nick"]) = ts3lib.getClientDisplayName(schid, self.tabs[schid]["clid"]) (err, cid) = ts3lib.getChannelOfClient(schid, self.tabs[schid]["clid"]) (err, self.tabs[schid]["cpath"], self.tabs[schid]["cpw"]) = ts3lib.getChannelConnectInfo(schid, cid) self.log(LogLevel.LogLevel_DEBUG, "Saved Tab: {}".format(self.tabs[schid]), schid)
def onClientMoveEvent(self, serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, moveMessage): try: if newChannelID in self.sourceChannel: if len(self.destinationChannel) > 0: destChannel = self.destinationChannel[0] #TODO: Check which channel is best (err, path, password) = ts3lib.getChannelConnectInfo(serverConnectionHandlerID, destChannel) ts3lib.requestClientMove(serverConnectionHandlerID, clientID, destChannel, password) else: ts3lib.printMessageToCurrentTab("No Destination Channel availabe.") except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
def onConnectStatusChangeEvent(self, schid, status, errorNumber): if status == ConnectStatus.STATUS_CONNECTION_ESTABLISHED: srv = self.ts3host.getServer(schid) self.tabs[schid] = { "channelBanGroup": None, "channelModGroup": None, # "clients": {} } srv.requestServerGroupList() srv.requestChannelGroupList() self.tabs[schid][ "name"] = srv.name # ts3lib.getServerVariable(schid, VirtualServerProperties.VIRTUALSERVER_NAME) err, self.tabs[schid]["host"], self.tabs[schid]["port"], self.tabs[ schid]["pw"] = ts3lib.getServerConnectInfo(schid) self.tabs[schid]["address"] = '{}:{}'.format( self.tabs[schid]["host"], self.tabs[schid]["port"]) if hasattr( self.tabs[schid], 'port') else self.tabs[schid]["host"] self.tabs[schid]["clid"] = srv.me.clientID self.tabs[schid][ "nick"] = srv.me.name # ts3lib.getClientSelfVariable(schid, ClientProperties.CLIENT_NICKNAME) # ts3lib.getClientVariable(schid, self.tabs[schid]["clid"], ClientProperties.CLIENT_NICKNAME) err, self.tabs[schid][ "nick_phonetic"] = ts3lib.getClientSelfVariable( schid, ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC) self.tabs[schid][ "uid"] = srv.me.uid # ts3lib.getClientSelfVariable(schid, ClientProperties.CLIENT_UNIQUE_IDENTIFIER) err, self.tabs[schid]["token"] = ts3lib.getClientSelfVariable( schid, ClientPropertiesRare.CLIENT_DEFAULT_TOKEN) self.tabs[schid][ "cid"] = srv.me.channel.channelID # ts3lib.getChannelOfClient(schid, self.tabs[schid]["clid"]) err, self.tabs[schid]["cpath"], self.tabs[schid][ "cpw"] = ts3lib.getChannelConnectInfo(schid, self.tabs[schid]["cid"]) err, self.tabs[schid][ "input_muted"] = ts3lib.getClientSelfVariable( schid, ClientProperties.CLIENT_INPUT_MUTED) # srv.me.isInputMuted err, self.tabs[schid][ "input_deactivated"] = ts3lib.getClientSelfVariable( schid, ClientProperties.CLIENT_INPUT_DEACTIVATED) err, self.tabs[schid][ "input_enabled"] = ts3lib.getClientSelfVariable( schid, ClientProperties.CLIENT_INPUT_HARDWARE) err, self.tabs[schid][ "output_muted"] = ts3lib.getClientSelfVariableAsInt( schid, ClientProperties.CLIENT_OUTPUT_MUTED ) # srv.me.isOutputMuted err, self.tabs[schid][ "output_enabled"] = ts3lib.getClientSelfVariable( schid, ClientProperties.CLIENT_OUTPUT_HARDWARE) # elif status == ConnectStatus.STATUS_DISCONNECTED: if schid in self.tabs: self.tabs[schid]["status"] = status
def reconnect(self, schid=0, cid=0): if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID() err, host, port, pw = ts3lib.getServerConnectInfo(schid) address = host if not "." in host else "{}:{}".format(host, port) # ts3lib.stopConnection(schid, "") err, nickname = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_NICKNAME) err, nickname_phonetic = ts3lib.getClientSelfVariable( schid, ts3defines.ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC) err, uid = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) cpw = "" if not cid: err, cid = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL) err, cpw = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_DEFAULT_CHANNEL_PASSWORD) else: (err, cid, cpw) = ts3lib.getChannelConnectInfo(schid, cid) err, default_token = ts3lib.getClientSelfVariable( schid, ts3defines.ClientPropertiesRare.CLIENT_DEFAULT_TOKEN) args = [ ts3defines.PluginConnectTab. PLUGIN_CONNECT_TAB_CURRENT, # connectTab: int, address, # serverLabel: Union[str, unicode], address, # serverAddress: Union[str, unicode], pw, # serverPassword: Union[str, unicode], nickname, # nickname: Union[str, unicode], cid, # channel: Union[str, unicode], cpw if cpw else "123", # channelPassword: Union[str, unicode] "", # captureProfile: Union[str, unicode], "", # playbackProfile: Union[str, unicode] "", # hotkeyProfile: Union[str, unicode], "Default Sound Pack (Female)", # soundPack uid, # userIdentity: Union[str, unicode], default_token, # oneTimeKey: Union[str, unicode], nickname_phonetic, # phoneticName: Union[str, unicode] ] print("ts3lib.guiConnect({})".format("\", \"".join( str(x) for x in args))) ts3lib.guiConnect(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13])
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
def onClientMoveMovedEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moverID, moverName, moverUniqueIdentifier, moveMessage): if moverID == 0: return (err, ownID) = ts3lib.getClientID(schid) if clientID != ownID or moverID == ownID: 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.schid = schid self.clid = ownID self.cid = oldChannelID (err, cpath, self.cpw) = ts3lib.getChannelConnectInfo(schid, oldChannelID) if self.delay >= 0: QTimer.singleShot(self.delay, self.moveBack) else: self.moveBack()
def onClientKickFromChannelEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, kickMessage): (err, ownID) = ts3lib.getClientID(schid) if clientID != ownID or kickerID == ownID: return (err, sgids) = ts3lib.getClientVariableAsString( schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS) sgids = intList(sgids) if any(i in sgids for i in self.whitelistSGIDs): return (err, uid) = ts3lib.getClientVariable( schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if uid in self.whitelistUIDs: return (err, cpath, self.cpw) = ts3lib.getChannelConnectInfo(schid, oldChannelID) self.schid = schid self.clid = ownID self.cid = oldChannelID if self.delay >= 0: QTimer.singleShot(self.delay, self.moveBack) else: self.moveBack()
def fakeChannel(self, schid, channelID): channel = self.ts3host.getChannel(schid, channelID) debug = PluginHost.cfg.getboolean("general", "verbose") (error, name) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME) name = name.encode("utf-8").decode(sys.stdout.encoding) # TODO MODIFY NAME if debug: print("err:", error, "CHANNEL_NAME", name) if not error and name: ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_NAME, name) (error, phonetic) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC) if debug: print("err:", error, "CHANNEL_NAME_PHONETIC", phonetic) if not error and phonetic: ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_NAME_PHONETIC, phonetic) (error, pw) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD) if debug: print("err:", error, "CHANNEL_FLAG_PASSWORD", pw) if pw: (err, path, _pw) = ts3lib.getChannelConnectInfo(schid, channelID) if debug: print("err:", error, "_pw", _pw) ts3lib.setChannelVariableAsString( schid, 0, ts3defines.ChannelProperties.CHANNEL_PASSWORD, _pw if _pw else ".") """ (error, topic) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_TOPIC) if debug: print("err:", error, "CHANNEL_TOPIC", topic) if not error and topic: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_TOPIC,topic) ts3lib.requestChannelDescription(schid, channelID) (error, description) = ts3lib.getChannelVariable(schid, channelID, ts3defines.ChannelProperties.CHANNEL_DESCRIPTION) if debug: print("err:", error, "CHANNEL_DESCRIPTION", description) if not error and description: ts3lib.setChannelVariableAsString(schid, 0,ts3defines.ChannelProperties.CHANNEL_DESCRIPTION,description.decode('utf-8')) """ (error, neededtp) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER) if debug: print("err:", error, "CHANNEL_NEEDED_TALK_POWER", neededtp) if not error and neededtp: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER, neededtp) (error, codec) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC) if debug: print("err:", error, "CHANNEL_CODEC", codec) if not error and codec: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC, codec) (error, quality) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY) if debug: print("err:", error, "CHANNEL_CODEC_QUALITY", quality) if not error and quality: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_QUALITY, quality) (error, latency) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR) if debug: print("err:", error, "CHANNEL_CODEC_LATENCY_FACTOR", latency) if not error and latency: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_LATENCY_FACTOR, latency) (error, unencrypted) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED) if debug: print("err:", error, "CHANNEL_CODEC_IS_UNENCRYPTED", unencrypted) if not error and unencrypted: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_CODEC_IS_UNENCRYPTED, unencrypted) (error, maxclients) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS) if debug: print("err:", error, "CHANNEL_MAXCLIENTS", maxclients) if not error and maxclients: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS, maxclients) (error, maxfamilyclients) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS) if debug: print("err:", error, "CHANNEL_MAXFAMILYCLIENTS", maxfamilyclients) if not error and maxfamilyclients: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS, maxfamilyclients) (error, iconid) = ts3lib.getChannelVariable( schid, channelID, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID) if debug: print("err:", error, "CHANNEL_ICON_ID", iconid) if not error and iconid: ts3lib.setChannelVariableAsInt( schid, 0, ts3defines.ChannelPropertiesRare.CHANNEL_ICON_ID, iconid) ts3lib.flushChannelCreation(schid, 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) (err, name) = ts3lib.getChannelVariable( schid, selectedItemID, ChannelProperties.CHANNEL_NAME) if not haspw: msgBox( "Channel \"{0}\" has no password to crack!".format( name), QMessageBox.Warning) return self.mode = 0 self.step = 1 self.pwc = 0 content = [] with open(self.pwpath, encoding="utf-8") as f: content = f.readlines() self.pws = [x.strip() for x in content] (err, clids) = ts3lib.getChannelClientList(schid, selectedItemID) for clid in clids: (err, cname) = ts3lib.getClientVariable( schid, clid, ClientProperties.CLIENT_NICKNAME) self.pws[:0] = [cname, cname.lower(), cname.upper()] (err, cnamep) = ts3lib.getClientVariable( schid, selectedItemID, ClientPropertiesRare.CLIENT_NICKNAME_PHONETIC) if cnamep: self.pws[:0] = [cnamep, cnamep.lower(), cnamep.upper()] self.pws[:0] = [name, name.lower(), name.upper()] list(OrderedDict.fromkeys(self.pws)) 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 moveBack(self): if self.backup is None: return (err, ownID) = ts3lib.getClientID(self.backup["schid"]) (err, path, pw) = ts3lib.getChannelConnectInfo(self.backup["schid"], self.backup["cid"]) ts3lib.requestClientMove(self.backup["schid"], ownID, self.backup["cid"], pw) self.backup = {}