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