Beispiel #1
0
 def on_btn_ban_clicked(self):
     try:
         ip = self.txt_ip.text if self.grp_ip.isChecked() else ""
         name = self.txt_name.text if self.grp_name.isChecked() else ""
         uid = self.txt_uid.text if self.grp_uid.isChecked() else ""
         reason = self.box_reason.currentText
         if reason[0].isdigit():
             reason = "§" + reason
         duration = self.int_duration.value
         if self.moveBeforeBan: ts3lib.requestClientMove(self.schid, self.clid, 26, "")
         if ip:
             check = True
             if len(self.whitelist) < 1: check = confirm("Empty IP Whitelist!", "The IP whitelist is empty! Are you sure you want to ban \"{}\"?\n\nMake sure your whitelist URL\n{}\nis working!".format(ip, self.cfg.get("general", "whitelist")))
             if ip in self.whitelist: ts3lib.printMessageToCurrentTab("{}: [color=red]Not banning whitelisted IP [b]{}".format(self.name, ip))
             elif check: ts3lib.banadd(self.schid, ip, "", "", duration, reason)
         if name: ts3lib.banadd(self.schid, "", name, "", duration, reason)
         if uid: ts3lib.banadd(self.schid, "", "", uid, duration, reason)
         # msgBox("schid: %s\nip: %s\nname: %s\nuid: %s\nduration: %s\nreason: %s"%(self.schid, ip, name, uid, duration, reason))
         self.cfg["last"] = {
             "ip": str(self.grp_ip.isChecked()),
             "name": str(self.grp_name.isChecked()),
             "uid": str(self.grp_uid.isChecked()),
             "reason": reason,
             "duration": str(duration),
             "expanded": str(self.lst_reasons.isVisible()),
             "height": str(self.height),
             "alternate": str(self.chk_alternate.isChecked()),
             "ban on doubleclick": str(self.chk_doubleclick.isChecked()),
         }
         if not self.chk_keep.isChecked():
             self.close()
     except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Beispiel #2
0
 def onUpdateChannelEditedEvent(self, schid, channelID, invokerID, invokerName, invokerUniqueIdentifier):
     if not self.cracking: return
     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.cracking = False
Beispiel #3
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
Beispiel #4
0
 def on_btn_ban_clicked(self):
     try:
         ip = self.txt_ip.text if self.grp_ip.isChecked() else ""
         name = self.txt_name.text if self.grp_name.isChecked() else ""
         uid = self.txt_uid.text if self.grp_uid.isChecked() else ""
         mytsid = self.txt_mytsid.text if self.grp_mytsid.isChecked(
         ) else ""
         hwid = self.txt_hwid.text if self.grp_hwid.isVisible(
         ) and self.grp_hwid.isChecked() else ""
         _reason = self.box_reason.currentText
         delta = timedelta(seconds=self.int_duration_s.value,
                           minutes=self.int_duration_m.value,
                           hours=self.int_duration_h.value,
                           days=self.int_duration_d.value)
         # duration = self.templates[_reason]
         err, ownnick = ts3lib.getClientSelfVariable(
             self.schid, ts3defines.ClientProperties.CLIENT_NICKNAME)
         reason = "{}{}{}".format(self.prefix, _reason, self.suffix)
         # delta = timedelta(seconds=duration)
         print(delta)
         reason = reason.replace("%ownnick%",
                                 ownnick).replace("%duration%", str(delta))
         # if reason[0].isdigit(): reason = "" + reason
         duration = int(delta.total_seconds())
         if self.moveBeforeBan:
             ts3lib.requestClientMove(self.schid, self.clid, 26, "")
         # if uid:
         if ip:
             check = True
             if len(self.whitelist) < 1:
                 check = confirm(
                     "Empty IP Whitelist!",
                     "The IP whitelist is empty! Are you sure you want to ban \"{}\"?\n\nMake sure your whitelist URL\n{}\nis working!"
                     .format(ip, self.cfg.get("general", "whitelist")))
             if ip in self.whitelist:
                 ts3lib.printMessageToCurrentTab(
                     "{}: [color=red]Not banning whitelisted IP [b]{}".
                     format(self.name, ip))
             elif check:
                 ts3lib.banadd(self.schid, ip, "", "", duration, reason)
         if name: ts3lib.banadd(self.schid, "", name, "", duration, reason)
         if uid: ts3lib.banadd(self.schid, "", "", uid, duration, reason)
         if mytsid:
             ts3lib.requestSendClientQueryCommand(
                 self.schid,
                 "banadd mytsid={id} banreason={reason} time={duration}".
                 format(id=mytsid,
                        reason=escapeStr(reason),
                        duration=duration))
         if hwid:
             ts3lib.requestSendClientQueryCommand(
                 self.schid,
                 "banadd hwid={id} banreason={reason} time={duration}".
                 format(id=hwid,
                        reason=escapeStr(reason),
                        duration=duration))
         # msgBox("schid: %s\nip: %s\nname: %s\nuid: %s\nduration: %s\nreason: %s"%(self.schid, ip, name, uid, duration, reason))
         self.cfg["last"] = {
             "ip": str(self.grp_ip.isChecked()),
             "name": str(self.grp_name.isChecked()),
             "uid": str(self.grp_uid.isChecked()),
             "mytsid": str(self.grp_mytsid.isChecked()),
             "hwid": str(self.grp_hwid.isChecked()),
             "reason": _reason,
             "duration": str(duration),
             "expanded": str(self.lst_reasons.isVisible()),
             "height": str(self.height),
             "alternate": str(self.chk_alternate.isChecked()),
             "ban on doubleclick": str(self.chk_doubleclick.isChecked()),
         }
         if not self.chk_keep.isChecked():
             self.close()
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)