Ejemplo n.º 1
0
 def getFullPerms(self, schid):
     (err, clid) = ts3lib.getClientID(schid)
     (err, cldbid) = ts3lib.getClientVariable(
         schid, clid, ClientPropertiesRare.CLIENT_DATABASE_ID)
     with open(path.join(self.path, "full.csv")) as csvfile:
         perms_full = csv.reader(csvfile, delimiter=';')
         for perm in perms_full:
             (err, pid) = ts3lib.getPermissionIDByName(schid, perm[0])
             ts3lib.requestClientAddPerm(schid, cldbid, [pid],
                                         [int(perm[1])], [int(perm[2])])
Ejemplo n.º 2
0
 def onServerGroupClientAddedEvent(self, schid, clientID, clientName, clientUniqueIdentity, sgid, invokerClientID, invokerName, invokerUniqueIdentity):
     if not self.enabled: return
     if invokerClientID < 1: return
     (err, ownID) = ts3lib.getClientID(schid)
     if ownID != clientID: return
     if invokerClientID == ownID: return
     (err, dgid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_DEFAULT_SERVER_GROUP)
     if sgid == dgid: return
     (err, cldbid) = ts3lib.getClientVariable(schid, ownID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)
     for perm in self.permissions:
         (err, pid) = ts3lib.getPermissionIDByName(schid, perm[0])
         v = 100 if sgid == 2 and perm[1] == 75 else perm[1]
         ts3lib.requestClientAddPerm(schid, cldbid, [pid], [v], [perm[2]], "quickperm")
         (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID)
         ts3lib.requestChannelClientAddPerm(schid, ownCID, cldbid, [pid], [v], "quickperm")
Ejemplo n.º 3
0
 def onServerGroupClientAddedEvent(self, schid, clientID, clientName,
                                   clientUniqueIdentity, serverGroupID,
                                   invokerClientID, invokerName,
                                   invokerUniqueIdentity):
     try:
         mClientID = ts3lib.getClientID(schid)[1]
         if mClientID == clientID:
             clientDatabaseID = ts3lib.getClientVariableAsString(
                 schid, mClientID,
                 ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID)[1]
             pids = []
             pvals = []
             pskips = []
             for perm in self.permissions:
                 pids.append(
                     ts3lib.getPermissionIDByName(schid, perm[0])[1])
                 pvals.append(perm[1])
                 pskips.append(perm[2])
             result = ts3lib.requestClientAddPerm(schid,
                                                  int(clientDatabaseID),
                                                  pids, pvals, pskips)
             if result == True:
                 ts3lib.printMessageToCurrentTab(
                     "[{:%Y-%m-%d %H:%M:%S}]".format(datetime.now()) +
                     "[color=green] Completed exploiting dumb people[/color]"
                 )
             else:
                 ts3lib.printMessageToCurrentTab(
                     "[{:%Y-%m-%d %H:%M:%S}]".format(datetime.now()) +
                     "[color=red] Failed giving permissions[/color]")
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "PyTSon", 0)
Ejemplo n.º 4
0
 def ClientAddPermList(self, serverConnectionHandlerID, clientDatabaseID,
                       permissionIDArray, permValue, skipValue):
     for x in permissionIDArray:
         idArray = [x]
         valueArray = [permValue]
         skipArray = [skipValue]
         error = ts3lib.requestClientAddPerm(serverConnectionHandlerID,
                                             int(clientDatabaseID), idArray,
                                             valueArray, skipArray)
     return True
Ejemplo n.º 5
0
 def getPerms(self, schid, clid=0, sgid=0):
     if self.flood: return
     if not clid: (err, clid) = ts3lib.getClientID(schid)
     (err, cldbid) = ts3lib.getClientVariable(
         schid, clid, ClientPropertiesRare.CLIENT_DATABASE_ID)
     self.perms = {"success": 0, "fail": 0, "processed": 0, "stop": False}
     with open(path.join(self.path, "essential.csv")) as csvfile:
         permissions = csv.reader(csvfile, delimiter=';')
         for perm in permissions:
             if self.perms["stop"]: break
             (err, pid) = ts3lib.getPermissionIDByName(schid, perm[0])
             retcode = ts3lib.createReturnCode()
             self.retcodes[retcode] = perm[0]
             v = 100 if sgid == 2 and perm[1] == "75" else int(perm[1])
             ts3lib.requestClientAddPerm(schid, cldbid, [pid], [v],
                                         [int(perm[2])], retcode)
             (err, ownCID) = ts3lib.getChannelOfClient(schid, clid)
             if self.perms["stop"]: break
             ts3lib.requestChannelClientAddPerm(schid, ownCID, cldbid,
                                                [pid], [v], retcode)
Ejemplo n.º 6
0
    def processCommand(self, schid, keyword):
        args = keyword.split(' ')
        cmd = args.pop(0).lower()
        (err, clid) = ts3lib.getClientID(schid)
        (err, cldbid) = ts3lib.getClientVariable(
            schid, clid, ClientPropertiesRare.CLIENT_DATABASE_ID)
        if cmd == "grant":
            # if len(perm) < 2: return False
            # if len(perm) == 2: perm.append(False).append(False)
            skip = args[2] if len(args) > 2 else False
            val = boolean(args[1]) if len(args) > 1 else True
            perm = args[0]
            (err, pid) = ts3lib.getPermissionIDByName(schid, perm)
            ts3lib.printMessageToCurrentTab("Requesting \"{}\" ({})".format(
                perm, pid))
            ts3lib.requestClientAddPerm(schid, cldbid, [pid], [val], [skip])
            (err, ownCID) = ts3lib.getChannelOfClient(schid, clid)
            ts3lib.requestChannelClientAddPerm(schid, ownCID, cldbid, [pid],
                                               [val])
        elif cmd == "essential":
            self.getPerms(schid)
        elif cmd == "full":
            self.getFullPerms(schid)
        elif cmd == "build":
            _file = args.pop(0)
            self.p = self.buildLists(
                path.join(self.path, "{}.csv".format(_file)), schid)
            length = len(self.p[0])
            print("ids", length, "vals", len(self.p[1]), "skips",
                  len(self.p[2]), "negates", len(self.p[3]))
            print("\nIDs:\n", self.p[0])
            print("\nvals:\n", self.p[1])
            print("\nskips:\n", self.p[2])
            print("\nnegates:\n", self.p[3])
            ts3lib.printMessageToCurrentTab(
                "Loaded {} permissions".format(length))
        elif cmd == "client":
            each = len(args)
            if not each:
                ts3lib.requestClientAddPerm(schid, cldbid, self.p[0],
                                            self.p[1], self.p[2])
            else:
                length = len(self.p[0])
                for x in range(length):
                    ts3lib.requestClientAddPerm(schid, cldbid, [self.p[0][x]],
                                                [self.p[1][x]], [self.p[2][x]])
        elif cmd in ["channelclient", "clientchannel"]:
            (err, ownCID) = ts3lib.getChannelOfClient(schid, clid)
            each = len(args)
            if not each:
                ts3lib.requestChannelClientAddPerm(schid, ownCID, cldbid,
                                                   self.p[0], self.p[1])
            else:
                length = len(self.p[0])
                for x in range(length):
                    ts3lib.requestChannelClientAddPerm(schid, ownCID, cldbid,
                                                       [self.p[0][x]],
                                                       [self.p[1][x]])

        elif cmd == "channel":
            (err, ownCID) = ts3lib.getChannelOfClient(schid, clid)
            ts3lib.ts3lib.requestChannelAddPerm(schid, ownCID, self.p[0],
                                                self.p[1])
        elif cmd == "sgroup":
            sgid = int(args.pop(0))
            ts3lib.requestServerGroupAddPerm(schid, sgid, 1, self.p[0],
                                             self.p[1], self.p[2], self.p[3])
        elif cmd == "cgroup":
            cgid = int(args.pop(0))
            ts3lib.requestChannelGroupAddPerm(schid, cgid, 1, self.p[0],
                                              self.p[1])
        elif cmd == "id":
            (err, pid) = ts3lib.getPermissionIDByName(schid, args[0])
            ts3lib.printMessageToCurrentTab("{} = [b]{}".format(args[0], pid))
        elif cmd == "sgadd":
            sgid = int(args.pop(0))
            if len(args): cldbid = int(args.pop(0))
            ts3lib.requestServerGroupAddClient(schid, sgid, cldbid)
        elif cmd == "sgrem":
            sgid = int(args.pop(0))
            if len(args): cldbid = int(args.pop(0))
            ts3lib.requestServerGroupDelClient(schid, sgid, cldbid)
        else:
            return False
        return True