Beispiel #1
0
class RunCommand(ops.cmd.DszCommand, ):

    def __init__(self, plugin='run', command=None, **optdict):
        ops.cmd.DszCommand.__init__(self, plugin, **optdict)
        self.command = command

    def validateInput(self):
        for opt in self.optdict:
            if (opt not in VALID_OPTIONS):
                return False
            if (opt == 'command'):
                cmdstr = self.optdict['command']
                cmdstr = cmdstr.strip()
                if (cmdstr[0] != '"'):
                    cmdstr = ('"' + cmdstr)
                if (cmdstr[(-1)] != '"'):
                    cmdstr += '"'
                if (cmdstr[(-2)] == '"'):
                    cmdstr = (cmdstr[:(-1)] + ' "')
                lastquote = cmdstr.find('"', 1)
                while (lastquote < (len(cmdstr) - 1)):
                    if (cmdstr[(lastquote - 1)] != '\\'):
                        cmdstr = ((cmdstr[:lastquote] + '\\') + cmdstr[lastquote:])
                    lastquote = cmdstr.find('"', (lastquote + 1))
                self.optdict['command'] = cmdstr
        return True
    noinput = property((lambda x: getBoolOption(x, 'noinput')), (lambda x, y: setBoolOption(x, y, 'noinput')))
    wait = property((lambda x: getBoolOption(x, 'wait')), (lambda x, y: setBoolOption(x, y, 'wait')))
    redirect = property((lambda x: getBoolOption(x, 'redirect')), (lambda x, y: setBoolOption(x, y, 'redirect')))
    allowdsz = property((lambda x: getBoolOption(x, 'allowdsz')), (lambda x, y: setBoolOption(x, y, 'allowdsz')))
    background = property((lambda x: getBoolOption(x, 'background')), (lambda x, y: setBoolOption(x, y, 'background')))
    input = property((lambda x: getValueOption(x, 'input')), (lambda x, y: setListOption(x, y, 'input', ['ascii', 'oem', 'unicode', 'utf8'])))
    output = property((lambda x: getValueOption(x, 'output')), (lambda x, y: setListOption(x, y, 'output', ['ascii', 'auto', 'oem', 'unicode', 'utf8'])))
    command = property((lambda x: getValueOption(x, 'command')), (lambda x, y: setStringOption(x, y, 'command')))
    directory = property((lambda x: getValueOption(x, 'directory')), (lambda x, y: setStringOption(x, y, 'directory')))
Beispiel #2
0
class DriversCommand(
        ops.cmd.DszCommand, ):
    optgroups = {'operation': ['load', 'unload', 'list']}
    reqgroups = ['operation']
    rejects = {
        'load': ['minimal', 'nosignature', 'version'],
        'unload': ['minimal', 'nosignature', 'version']
    }
    reqopts = []
    defopts = {}

    def __init__(self, plugin='drivers', autominimal=False, **optdict):
        self.autominimal = autominimal
        ops.cmd.DszCommand.__init__(self, plugin, **optdict)

    def validateInput(self):
        for opt in self.optdict:
            if (opt not in VALID_OPTIONS):
                return False
        if ((not self.driver_list) and (self.load is None)
                and (self.unload is None)):
            return False
        if (((self.load is not None) or (self.unload is not None))
                and (self.minimal or self.nosignature or self.noversion)):
            return False
        return True

    def __getAutoMinimal(self):
        return self.__autoMinimal

    def __setAutoMinimal(self, val):
        self.__autoMinimal = val

    autominimal = property(__getAutoMinimal, __setAutoMinimal)
    minimal = property((lambda x: getBoolOption(x, 'minimal')),
                       (lambda x, y: setBoolOption(x, y, 'minimal')))
    nosignature = property((lambda x: getBoolOption(x, 'nosignature')),
                           (lambda x, y: setBoolOption(x, y, 'nosignature')))
    noversion = property((lambda x: getBoolOption(x, 'noversion')),
                         (lambda x, y: setBoolOption(x, y, 'noversion')))
    driver_list = property((lambda x: getBoolOption(x, 'list')),
                           (lambda x, y: setBoolOption(x, y, 'list')))
    load = property((lambda x: getValueOption(x, 'load')),
                    (lambda x, y: setStringOption(x, y, 'load')))
    unload = property((lambda x: getValueOption(x, 'unload')),
                      (lambda x, y: setStringOption(x, y, 'unload')))
Beispiel #3
0
class GroupsCommand(ops.cmd.DszCommand, ):
    optgroups = {}
    reqgroups = []
    reqopts = []
    defopts = {}

    def __init__(self, plugin='groups', netmap_type=None, **optdict):
        ops.cmd.DszCommand.__init__(self, plugin, **optdict)

    def validateInput(self):
        for opt in self.optdict:
            if (opt not in VALID_OPTIONS):
                return False
        return True
    local = property((lambda x: getBoolOption(x, 'local')), (lambda x, y: setBoolOption(x, y, 'local')))
    remote = property((lambda x: getBoolOption(x, 'remote')), (lambda x, y: setBoolOption(x, y, 'remote')))
    target = property((lambda x: getValueOption(x, 'target')), (lambda x, y: setStringOption(x, y, 'target')))
    user = property((lambda x: getValueOption(x, 'user')), (lambda x, y: setStringOption(x, y, 'user')))
Beispiel #4
0
class CommandsCommand(ops.cmd.DszCommand, ):

    def __init__(self, plugin='commands', **optdict):
        ops.cmd.DszCommand.__init__(self, plugin, **optdict)

    def validateInput(self):
        for opt in self.optdict:
            if (opt not in VALID_OPTIONS):
                return False
        return True
    all = property((lambda x: getBoolOption(x, 'all')), (lambda x, y: setBoolOption(x, y, 'all')))
    any = property((lambda x: getBoolOption(x, 'any')), (lambda x, y: setBoolOption(x, y, 'any')))
    local = property((lambda x: getBoolOption(x, 'local')), (lambda x, y: setBoolOption(x, y, 'local')))
    remote = property((lambda x: getBoolOption(x, 'remote')), (lambda x, y: setBoolOption(x, y, 'remote')))
    astyped = property((lambda x: getBoolOption(x, 'astyped')), (lambda x, y: setBoolOption(x, y, 'astyped')))
    verbose = property((lambda x: getBoolOption(x, 'verbose')), (lambda x, y: setBoolOption(x, y, 'verbose')))
Beispiel #5
0
class NetmapCommand(
        ops.cmd.DszCommand, ):
    optgroups = {}
    reqgroups = []
    reqopts = []
    defopts = {}

    def __init__(self, plugin='netmap', netmap_type=None, **optdict):
        ops.cmd.DszCommand.__init__(self, plugin, **optdict)
        self.netmap_type = netmap_type

    def validateInput(self):
        for opt in self.optdict:
            if (opt not in VALID_OPTIONS):
                return False
        return True

    minimal = property((lambda x: getBoolOption(x, 'minimal')),
                       (lambda x, y: setBoolOption(x, y, 'minimal')))
    netmap_type = property(
        (lambda x: getValueOption(x, 'type')), (lambda x, y: setListOption(
            x, y, 'type', ['all', 'connected', 'remembered'])))
class EventlogfilterCommand(ops.cmd.DszCommand, ):
    optgroups = {}
    reqgroups = []
    reqopts = []
    defopts = {}

    def __init__(self, plugin='eventlogfilter', **optdict):
        ops.cmd.DszCommand.__init__(self, plugin, **optdict)

    def validateInput(self):
        for opt in self.optdict:
            if (opt not in VALID_OPTIONS):
                return False
        return True
    num = property((lambda x: getValueOption(x, 'num')), (lambda x, y: setStringOption(x, y, 'num')))
    id = property((lambda x: getValueOption(x, 'id')), (lambda x, y: setStringOption(x, y, 'id')))
    log = property((lambda x: getValueOption(x, 'log')), (lambda x, y: setStringOption(x, y, 'log')))
    sid = property((lambda x: getValueOption(x, 'sid')), (lambda x, y: setStringOption(x, y, 'sid')))
    string = property((lambda x: getValueOption(x, 'string')), (lambda x, y: setStringOption(x, y, 'string')))
    startrecord = property((lambda x: getValueOption(x, 'startrecord')), (lambda x, y: setStringOption(x, y, 'startrecord')))
    xpath = property((lambda x: getValueOption(x, 'xpath')), (lambda x, y: setStringOption(x, y, 'xpath')))
    max = property((lambda x: getValueOption(x, 'max')), (lambda x, y: setStringOption(x, y, 'max')))
    target = property((lambda x: getValueOption(x, 'target')), (lambda x, y: setStringOption(x, y, 'target')))
    classic = property((lambda x: getBoolOption(x, 'classic')), (lambda x, y: setBoolOption(x, y, 'classic')))