Пример #1
0
def scan_host_key(hostname, port):
    logger = logging.getLogger(LOGGER_NAME)
    ip_address = get_ip_from_host(hostname)
    logger.debug(ip_address)
    f = tempfile.NamedTemporaryFile()
    logger.debug('working with file ' + str(f.name))
    if ip_address != hostname:
        logger.debug("writing " + hostname)
        f.write(hostname + '\n')
    f.write(ip_address + '\n')
    f.flush()
    f.close
    #    ssh-keyscan -4 -t ecdsa -f ./keyhost.txt -p \$_port
    logger.debug(exec_cmd(which('bash'), ['-c', 'cat ' + f.name]))
    res = exec_cmd(which('ssh-keyscan'), ['-4', '-t', 'rsa', '-f', f.name, '-p', str(port)], '/tmp', True)
    logger.debug(res)
#    os.unlink(f.name)
    return res
Пример #2
0
def find_java():
    return which('java')
Пример #3
0
def find_java():
    return which('java')