3 # @(#) $Id: main.exp,v 1.5 2009/06/24 17:06:21 dcid Exp $
6 # Copyright (C) 2009 Trend Micro Inc.
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 3) as published by the FSF - Free Software
16 send_user "\nERROR: ssh_integrity_check <hostname> <arguments>\n";
21 # NOTE: this script must be called from within /var/ossec for it to work.
22 set passlist "agentless/.passlist"
23 set sshsrc "agentless/ssh.exp"
24 set susrc "agentless/su.exp"
25 set sshloginsrc "agentless/sshlogin.exp"
26 set sshnopasssrc "agentless/ssh_nopass.exp"
27 set hostname [lindex $argv 0]
28 set args [lrange $argv 1 end]
37 if {[string compare $hostname "test"] == 0} {
38 if {[string compare $args "test"] == 0} {
43 # Checking if the hostname (first argument) is an option.
44 if {[string compare $hostname "use_su"] == 0} {
46 set hostname [lindex $argv 1]
47 set args [lrange $argv 2 end]
49 # Checking if the hostname (first argument) is an option.
50 if {[string compare $hostname "use_sudo"] == 0} {
51 set use_sudo "sudo sh;"
52 set hostname [lindex $argv 1]
53 set args [lrange $argv 2 end]
57 # Reading the password list.
59 set in [open "$passlist" r]
61 send_user "\nERROR: Password list not present (use \"register_host\" first).\n"
65 while {[gets $in line] != -1} {
66 set me [string first "|" $line]
67 set me2 [string last "|" $line]
68 set length [string length $line]
83 set host_list [string range $line 0 $me]
85 set pass_list [string range $line $me $me2]
87 set addpass_list [string range $line $me2 $length]
89 if {[string compare $host_list $hostname] == 0} {
91 set addpass "$addpass_list"
98 if {[string compare $pass "x"] == 0} {
99 send_user "\nERROR: Password for '$hostname' not found.\n"