Example #1
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 #2
0
 def onServerErrorEvent(self, schid, errorMessage, error, returnCode,
                        extraMessage):
     if not returnCode in self.channels: return False
     reason = "finished"
     self.result["processed"] += 1
     if error == ERROR_ok:
         self.result["success"] += 1  # Todo Permissions
     elif error == ERROR_client_is_flooding:
         self.result["failed"] += 1
         self.result["stop"] = True
         reason = "stopped because of flooding"
     elif error in [
             ERROR_permissions_client_insufficient,
             ERROR_permissions_insufficient_group_power,
             ERROR_permissions_insufficient_permission_power
     ]:
         self.result["failed"] += 1
     self.result["msg"] += "\n\"{}\": {}".format(self.channels[returnCode],
                                                 reason)
     del self.channels[returnCode]
     if not len(self.channels):
         icon = QMessageBox.Error if self.result[
             "failed"] else QMessageBox.Confirmation
         msgBox(self.result["msg"], icon, self.name)
     return True
Example #3
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: return
     if menuItemID == 0:
         self.enabled = not self.enabled
         if self.enabled:
             ts3lib.printMessageToCurrentTab(
                 "{} > [color=green]Enabled!".format(self.name))
         else:
             ts3lib.printMessageToCurrentTab(
                 "{} > [color=red]Disabled!".format(self.name))
     elif menuItemID == 1:
         err, host, port, pw = ts3lib.getServerConnectInfo(schid)
         host = inputBox(self.name, "Server address:", host)
         if not host:
             msgBox("Nothing to add!", title=self.name)
             return
         if host in self.whitelist:
             self.whitelist.remove(host)
             ts3lib.printMessageToCurrentTab(
                 "{} > Removed {} from whitelist!".format(self.name, host))
         else:
             self.whitelist.append(host.lower())
             ts3lib.printMessageToCurrentTab(
                 "{} > Added {} to whitelist!".format(self.name, host))
         with open(self.whitelist_ini, "a") as myfile:
             myfile.write('\n{0}'.format(host))
Example #4
0
 def onDelChannelEvent(self, schid, channelID, invokerID, invokerName, invokerUniqueIdentifier):
     if not self.cracking: return
     if not self.cid == channelID: return
     if not self.schid == schid: return
     self.timer.stop()
     msgBox("Channel #{0} got deleted by \"{1}\"\n\nStopping Cracker!".format(self.cid, invokerName), QMessageBox.Warning)
     self.cracking = False
Example #5
0
 def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber):
     if newStatus == ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         self.requested = True
         ts3lib.requestServerVariables(schid)
     if newStatus == ConnectStatus.STATUS_DISCONNECTED:
         if not self.cracking: 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.cracking = False
Example #6
0
 def __init__(self):
     if isfile(self.bin):
         self.yatqa = QProcess()
         self.yatqa.setProgram(self.bin)
     else:
         msgBox(
             "Cannot find YatQA!\nPlease make sure it's installed at\n\n\"{}\""
             .format(self.bin))
         QDesktopServices.openUrl(QUrl("http://yat.qa/"))
     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))
Example #7
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
Example #8
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))
Example #9
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))