Imported Upstream version 2.7
[ossec-hids.git] / src / agentlessd / scripts / ssh_generic_diff
1 #!/usr/bin/env expect
2
3 # @(#) $Id: ./src/agentlessd/scripts/ssh_generic_diff, 2011/09/08 dcid Exp $
4
5 # Agentless monitoring
6 #
7 # Copyright (C) 2009 Trend Micro Inc.
8 # All rights reserved.
9
10 # This program is a free software; you can redistribute it
11 # and/or modify it under the terms of the GNU General Public
12 # License (version 2) as published by the FSF - Free Software
13 # Foundation.
14
15
16 # Main script.
17 source "agentless/main.exp"
18
19
20 # SSHing to the box and passing the directories to check.
21 if [catch {
22     spawn ssh $hostname
23 } loc_error] {
24     send_user "ERROR: Opening connection: $loc_error.\n"
25     exit 1;
26 }
27
28
29 source $sshsrc
30 source $susrc
31
32
33 set timeout 600
34 send_user "INFO: Starting.\n"
35 send_user "\nSTORE: now\n"
36 send "$args\r"
37 send "exit\r"
38
39 expect {
40     timeout {
41         send_user "ERROR: Timeout while running commands on host: $hostname .\n"
42         exit 1;
43     }
44     eof {
45         send_user "\nINFO: Finished.\n"
46         exit 0;
47     }
48 }
49
50 exit 0;