#!/usr/bin/env expect # @(#) $Id: ./src/agentlessd/scripts/ssh_nopass.exp, 2011/09/08 dcid Exp $ # Agentless monitoring # # Copyright (C) 2009 Trend Micro Inc. # All rights reserved. # # This program is a free software; you can redistribute it # and/or modify it under the terms of the GNU General Public # License (version 2) as published by the FSF - Free Software # Foundation. expect { "WARNING: REMOTE HOST" { send_user "\nERROR: RSA host key for '$hostname' has changed. Unable to access.\n" exit 1; } "*sure you want to continue connecting*" { send "yes\r" source $sshnopasssrc return } "ssh: connect to host*" { send_user "\nERROR: Unable to connect to remote host: $hostname .\n" exit 1; } "no address associated with name" { send_user "\nERROR: Unable to connect to remote host: $hostname .\n" exit 1; } "*Connection refused*" { send_user "\nERROR: Unable to connect to remote host: $hostname .\n" exit 1; } "*Connection closed by remote host*" { send_user "\nERROR: Unable to connect to remote host: $hostname .\n" exit 1; } "* password:*" { send_user "\nERROR: Public key authentication failed to host: $hostname .\n" exit 1 } "*\\\$" { send_user "\nINFO: Started.\n" } "*#" { send_user "\nINFO: Started.\n" } timeout { send_user "\nERROR: Timeout while connecting to host: $hostname . \n" exit 1; } }