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 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)
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))