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