示例#1
0
def ssh_linux(**kwargs):
    if 'nx-os' in kwargs.get('snmp_name', '').lower():
        return False, 'incompatible Nexus found.', kwargs
    kwargs['guessmodel'] = gvendor, gmodel = guessmodel.guessmodel(**kwargs)
    if gmodel not in {'Linux', 'ESX', 'XEN'}:
        return False, 'no match: %s %s' % (gvendor, gmodel), kwargs
    ip = str(kwargs['ip'])
    if not network.check_tcp_port(ip, 22):
        return False, 'closed.', kwargs
    ssh = None
    auths = [
        (settings.SSH_USER or 'root', settings.SSH_PASSWORD),
        (settings.XEN_USER, settings.XEN_PASSWORD),
    ]
    try:
        for user, password in auths:
            if user is None or password is None:
                continue
            try:
                ssh = network.connect_ssh(ip, user, password)
            except network.AuthError:
                pass
            else:
                break
        else:
            return False, 'Authorization failed', kwargs
        name = run_ssh_linux(ssh, ip)
    except (network.Error, paramiko.SSHException) as e:
        return False, str(e), kwargs
    return True, name, kwargs
def _connect_ssh(ip):
    return network.connect_ssh(
        ip,
        settings.SSH_IBM_USER,
        settings.SSH_IBM_PASSWORD,
        client=IBMSSHClient,
    )
示例#3
0
def _connect_ssh(ip):
    return network.connect_ssh(
        ip,
        settings.SSH_IBM_USER,
        settings.SSH_IBM_PASSWORD,
        client=IBMSSHClient,
    )
示例#4
0
def _connect_ssh(ip):
    return network.connect_ssh(
        ip,
        settings.SCAN_PLUGINS.get(__name__, {})['ssh_ibm_user'],
        settings.SCAN_PLUGINS.get(__name__, {})['ssh_ibm_password'],
        client=IBMSSHClient,
    )
示例#5
0
def ssh_linux(**kwargs):
    if 'nx-os' in kwargs.get('snmp_name', '').lower():
        return False, 'incompatible Nexus found.', kwargs
    kwargs['guessmodel'] = gvendor, gmodel = guessmodel.guessmodel(**kwargs)
    if gmodel not in {'Linux', 'ESX', 'XEN'}:
        return False, 'no match: %s %s' % (gvendor, gmodel), kwargs
    ip = str(kwargs['ip'])
    if not network.check_tcp_port(ip, 22):
        return False, 'closed.', kwargs
    ssh = None
    auths = [
        (settings.SSH_USER or 'root', settings.SSH_PASSWORD),
        (settings.XEN_USER, settings.XEN_PASSWORD),
    ]
    try:
        for user, password in auths:
            if user is None or password is None:
                continue
            try:
                ssh = network.connect_ssh(ip, user, password)
            except network.AuthError:
                pass
            else:
                break
        else:
            return False, 'Authorization failed', kwargs
        name = run_ssh_linux(ssh, ip)
    except (network.Error, paramiko.SSHException) as e:
        return False, str(e), kwargs
    return True, name, kwargs
示例#6
0
def _connect_ssh(ip):
    return network.connect_ssh(
        ip,
        settings.SCAN_PLUGINS.get(__name__, {})['ssh_ibm_user'],
        settings.SCAN_PLUGINS.get(__name__, {})['ssh_ibm_password'],
        client=IBMSSHClient,
    )
示例#7
0
def _connect_ssh(ip):
    return network.connect_ssh(
        ip,
        SSH_USER,
        SSH_PASSWORD,
        client=CiscoSSHClient,
    )
示例#8
0
def ssh_linux(**kwargs):
    if "nx-os" in kwargs.get("snmp_name", "").lower():
        return False, "incompatible Nexus found.", kwargs
    kwargs["guessmodel"] = gvendor, gmodel = guessmodel.guessmodel(**kwargs)
    if gmodel not in {"Linux", "ESX", "XEN"}:
        return False, "no match: %s %s" % (gvendor, gmodel), kwargs
    ip = str(kwargs["ip"])
    if not network.check_tcp_port(ip, 22):
        return False, "closed.", kwargs
    ssh = None
    auths = [(settings.SSH_USER or "root", settings.SSH_PASSWORD), (settings.XEN_USER, settings.XEN_PASSWORD)]
    try:
        for user, password in auths:
            if user is None or password is None:
                continue
            try:
                ssh = network.connect_ssh(ip, user, password)
            except network.AuthError:
                pass
            else:
                break
        else:
            return False, "Authorization failed", kwargs
        name = run_ssh_linux(ssh, ip)
    except (network.Error, paramiko.SSHException) as e:
        return False, str(e), kwargs
    return True, name, kwargs
示例#9
0
def _connect_ssh(ip):
    if not settings.SSH_PASSWORD:
        raise Error('no password defined')
    return network.connect_ssh(
        ip,
        settings.SSH_USER or 'root',
        settings.SSH_PASSWORD,
    )
示例#10
0
def _connect_ssh(ip):
    if not settings.SSH_PASSWORD:
        raise Error('no password defined')
    return network.connect_ssh(
        ip,
        settings.SSH_USER or 'root',
        settings.SSH_PASSWORD,
    )
示例#11
0
def _connect_ssh(ip_address, user, password):
    if not network.check_tcp_port(ip_address, 22):
        raise ConnectionError('Port 22 closed on a HP MSA Storage.')
    return network.connect_ssh(
        ip_address,
        user,
        password,
        client=HPSSHClient,
    )
示例#12
0
def _connect_ssh(ip_address, user, password):
    if not network.check_tcp_port(ip_address, 22):
        raise ConnectionError('Port 22 closed on a HP MSA Storage.')
    return network.connect_ssh(
        ip_address,
        user,
        password,
        client=HPSSHClient,
    )
示例#13
0
def _connect_ssh(ip, username, password):
    if not network.check_tcp_port(ip, 22):
        raise ConnectionError('Port 22 closed.')
    return network.connect_ssh(
        ip,
        username,
        password,
        client=CiscoSSHClient,
    )
示例#14
0
def _connect_ssh(ip):
    if not network.check_tcp_port(ip, 22):
        raise ConnectionError('Port 22 closed.')
    return network.connect_ssh(
        ip,
        SSH_USER,
        SSH_PASSWORD,
        client=CiscoSSHClient,
    )
示例#15
0
def _connect_ssh(ip):
    SETTINGS = settings.SCAN_PLUGINS.get(__name__, {})
    SSH_USER, SSH_PASSWORD = SETTINGS['ssh_user'], SETTINGS['ssh_password']
    if not SSH_PASSWORD:
        raise NotConfiguredError(
            "ssh not configured in plugin {}".format(__name__), )
    return network.connect_ssh(
        ip,
        SSH_USER or 'root',
        SSH_PASSWORD,
    )
示例#16
0
def _connect_ssh(ip):
    SETTINGS = settings.SCAN_PLUGINS.get(__name__, {})
    SSH_USER, SSH_PASSWORD = SETTINGS['ssh_user'], SETTINGS['ssh_password']
    if not SSH_PASSWORD:
        raise NotConfiguredError(
            "ssh not configured in plugin {}".format(__name__),
        )
    return network.connect_ssh(
        ip,
        SSH_USER or 'root',
        SSH_PASSWORD,
    )
示例#17
0
文件: ssh_linux.py 项目: lmzopq/ralph
def scan_address(ip_address, **kwargs):
    messages = []
    result = get_base_result_template('ssh_linux', messages)
    snmp_name = kwargs.get('snmp_name', '') or ''
    if not snmp_name:
        raise NoMatchError("No snmp found")
    snmp_name = snmp_name.lower()
    if 'nx-os' in snmp_name:
        messages.append('Incompatible Nexus found.')
        result['status'] = 'error'
        return result
    if all((
            'linux' not in snmp_name,
            'xen' not in snmp_name,
            not snmp_name.startswith('vmware esx'),
    )):
        messages.append('No match.')
        result['status'] = 'error'
        return result
    ssh = None
    auths = SETTINGS.get('auths', [])
    for user, password in auths:
        if user is None or password is None:
            continue
        try:
            ssh = network.connect_ssh(ip_address, user, password)
        except network.AuthError:
            continue
        else:
            break
    if not ssh:
        messages.append('Authorization failed')
        result['status'] = 'error'
        return result
    try:
        device_info = _ssh_linux(ssh, ip_address)
    except (network.Error, paramiko.SSHException) as e:
        messages.append(unicode(e))
        result['status'] = 'error'
    else:
        result.update({
            'status': 'success',
            'device': device_info,
        })
    return result
示例#18
0
def scan_address(ip_address, **kwargs):
    messages = []
    result = get_base_result_template('ssh_linux', messages)
    snmp_name = kwargs.get('snmp_name', '') or ''
    if not snmp_name:
        raise NoMatchError("No snmp found")
    snmp_name = snmp_name.lower()
    if 'nx-os' in snmp_name:
        messages.append('Incompatible Nexus found.')
        result['status'] = 'error'
        return result
    if all((
        'linux' not in snmp_name,
        'xen' not in snmp_name,
        not snmp_name.startswith('vmware esx'),
    )):
        messages.append('No match.')
        result['status'] = 'error'
        return result
    ssh = None
    auths = SETTINGS.get('auths', [])
    for user, password in auths:
        if user is None or password is None:
            continue
        try:
            ssh = network.connect_ssh(ip_address, user, password)
        except network.AuthError:
            continue
        else:
            break
    if not ssh:
        messages.append('Authorization failed')
        result['status'] = 'error'
        return result
    try:
        device_info = _ssh_linux(ssh, ip_address)
    except (network.Error, paramiko.SSHException) as e:
        messages.append(unicode(e))
        result['status'] = 'error'
    else:
        result.update({
            'status': 'success',
            'device': device_info,
        })
    return result
示例#19
0
def _connect_ssh(ip_address, user, password):
    if not check_tcp_port(ip_address, 22):
        raise ConnectionError('Port 22 closed on a XEN server.')
    return connect_ssh(ip_address, user, password)
示例#20
0
def _connect_ssh(ip):
    return network.connect_ssh(ip, SSH_MSA_USER, SSH_MSA_PASSWORD,
                               client=storageworks.HPSSHClient)
示例#21
0
def _connect_ssh(ip, username='******', password=''):
    return network.connect_ssh(ip, 'root', settings.SSH_PASSWORD)
示例#22
0
def _connect_ssh(ip_address, user, password):
    if not network.check_tcp_port(ip_address, 22):
        raise ConnectionError("Port 22 closed on a Proxmox server.")
    return network.connect_ssh(ip_address, user, password)
示例#23
0
def _connect_ssh(ip):
    return network.connect_ssh(ip, SSH_P2000_USER, SSH_P2000_PASSWORD,
                               client=storageworks.HPSSHClient)
示例#24
0
文件: ssh_ssg.py 项目: szaydel/ralph
def _connect_ssh(ip):
    return network.connect_ssh(ip, settings.SSH_SSG_USER,
            settings.SSH_SSG_PASSWORD, client=SSGSSHClient)
示例#25
0
def _connect_ssh(ip):
    return network.connect_ssh(
        ip, SSH_USER, SSH_PASSWORD, client=CiscoSSHClient,
    )
示例#26
0
文件: ssh_xen.py 项目: szaydel/ralph
def _connect_ssh(ip):
    return network.connect_ssh(ip, XEN_USER, XEN_PASSWORD)
示例#27
0
文件: ssh_xen.py 项目: WootEpix/ralph
def _connect_ssh(ip_address, user, password):
    if not check_tcp_port(ip_address, 22):
        raise ConnectionError('Port 22 closed on a XEN server.')
    return connect_ssh(ip_address, user, password)
示例#28
0
def _connect_ssh(ip, username='******', password=''):
    return network.connect_ssh(ip, SSH_USER, SSH_PASS, client=CiscoSSHClient)
示例#29
0
def _connect_ssh(ip_address, user, password):
    if not check_tcp_port(ip_address, 22):
        raise ConnectionError("Port 22 closed on a Juniper switch.")
    return connect_ssh(ip_address, user, password)
示例#30
0
def _connect_ssh(ip, username='******', password=''):
    return network.connect_ssh(ip, 'root', settings.SSH_PASSWORD)
示例#31
0
def _connect_ssh(ip):
    if not network.check_tcp_port(ip, 22):
        raise ConnectionError('Port 22 closed.')
    return network.connect_ssh(
        ip, SSH_USER, SSH_PASSWORD, client=CiscoSSHClient,
    )
示例#32
0
def _connect_ssh(ip, username='******', password=''):
    return network.connect_ssh(ip, SSH_USER, SSH_PASS, client=CiscoSSHClient)
示例#33
0
文件: ssh_aix.py 项目: smagowr/ralph
def _connect_ssh(ip):
    return network.connect_ssh(ip, AIX_USER, AIX_PASSWORD, key=AIX_KEY)
示例#34
0
def _connect_ssh(ip):
    return network.connect_ssh(ip,
                               settings.SSH_SSG_USER,
                               settings.SSH_SSG_PASSWORD,
                               client=SSGSSHClient)
示例#35
0
def _connect_ssh(ip):
    return network.connect_ssh(ip,
                               SSH_P2000_USER,
                               SSH_P2000_PASSWORD,
                               client=HPSSHClient)
示例#36
0
文件: ssh_xen.py 项目: iwwwwwwi/ralph
def _connect_ssh(ip):
    return network.connect_ssh(ip, XEN_USER, XEN_PASSWORD)
示例#37
0
def _connect_ssh(ip, username="******", password=""):
    return network.connect_ssh(ip, "root", settings.SSH_PASSWORD)
示例#38
0
def _connect_ssh(ip):
    return network.connect_ssh(ip, AIX_USER, AIX_PASSWORD, key=AIX_KEY)
示例#39
0
def _connect_ssh(ip_address, user, password):
    if not check_tcp_port(ip_address, 22):
        raise ConnectionError('Port 22 closed.')
    return connect_ssh(ip_address, user, password, client=SSGSSHClient)
示例#40
0
def _connect_ssh(ip):
    return network.connect_ssh(ip, SSH_3PAR_USER, SSH_3PAR_PASSWORD)
示例#41
0
def _connect_ssh(ip):
    return network.connect_ssh(ip, SSH_ONSTOR_USER, SSH_ONSTOR_PASSWORD)
示例#42
0
def _connect_ssh(ip, username, password):
    if not network.check_tcp_port(ip, 22):
        raise ConnectionError('Port 22 closed.')
    return network.connect_ssh(
        ip, username, password, client=CiscoSSHClient,
    )
示例#43
0
def _connect_ssh(ip_address, user, password):
    if not network.check_tcp_port(ip_address, 22):
        raise ConnectionError('Port 22 closed on a Proxmox server.')
    return network.connect_ssh(ip_address, user, password)