示例#1
0
def doDiscovery(Framework, shell, client, ip, codepage, connectedOSCredentialID,
                credentialId, warningsList, errorsList):
    clientType = client.getClientType()
    if clientType == shellutils.PowerShell.PROTOCOL_TYPE:
        return doPowerShellDiscovery(Framework, shell, ip, credentialId,
                                     codepage, clientType, warningsList, errorsList)
    else:
        return HostConnectionByShell.doDiscovery(Framework, shell, client, ip, codepage, connectedOSCredentialID)
示例#2
0
def doDiscovery(Framework, shell, client, ip, codepage,
                connectedOSCredentialID, credentialId, warningsList,
                errorsList):
    clientType = client.getClientType()
    if clientType == shellutils.PowerShell.PROTOCOL_TYPE:
        return doPowerShellDiscovery(Framework, shell, ip, credentialId,
                                     codepage, clientType, warningsList,
                                     errorsList)
    else:
        return HostConnectionByShell.doDiscovery(Framework, shell, client, ip,
                                                 codepage,
                                                 connectedOSCredentialID)
示例#3
0
            msg = str(jex)
            logger.debugException(msg)
            logger.debug(
                'Fail to create client by existed credential id, try all credentials again'
            )

    # only for case where no connection established before
    if not client:
        # checks whether there are credential for specified protocol
        if credentialsByType:
            if not client:
                for clientType in SHELL_CLIENT_PROTOCOLS:
                    credentials = credentialsByType.get(clientType)
                    if credentials:
                        client = HostConnectionByShell.createClient(
                            Framework, clientType, credentials, ip, codepage,
                            warningsList, errorsList)
                        if client:
                            warningsList = []
                            errorsList = []
                            # save credentials id for further reuse
                            Framework.saveState(client.getCredentialId())
                            break
        else:
            for shellType in SHELL_CLIENT_PROTOCOLS:
                #error messages, need to refactor
                msg = errormessages.makeErrorMessage(
                    shellType, pattern=errormessages.ERROR_NO_CREDENTIALS)
                errobj = errorobject.createError(
                    errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP, [shellType],
                    msg)
示例#4
0
        try:
            client = Framework.createClient()
        except (Exception, JException), jex:
            msg = str(jex)
            logger.debugException(msg)
            logger.debug('Fail to create client by existed credential id, try all credentials again')

    # only for case where no connection established before
    if not client:
        # checks whether there are credential for specified protocol
        if credentialsByType:
            if not client:
                for clientType in SHELL_CLIENT_PROTOCOLS:
                    credentials = credentialsByType.get(clientType)
                    if credentials:
                        client = HostConnectionByShell.createClient(Framework, clientType, credentials, ip, codepage,
                                                                    warningsList, errorsList)
                        if client:
                            warningsList = []
                            errorsList = []
                            # save credentials id for further reuse
                            Framework.saveState(client.getCredentialId())
                            break
        else:
            for shellType in SHELL_CLIENT_PROTOCOLS:
                #error messages, need to refactor
                msg = errormessages.makeErrorMessage(shellType, pattern=errormessages.ERROR_NO_CREDENTIALS)
                errobj = errorobject.createError(errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP, [shellType], msg)
                errorsList.append(errobj)

    if not client:
        Framework.clearState()