Added:
/HnTool/modules/tools.py
Modified:
/HnTool/modules/__init__.py
/HnTool/modules/authentication.py
/HnTool/modules/util.py
/README
=======================================
--- /dev/null
+++ /HnTool/modules/tools.py Tue Sep 14 18:55:12 2010
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+#
+# HnTool rules - tools
+# Copyright (C) 2009-2010 Hugo Doria <ma...@hugodoria.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+#
+
+import os
+import stat
+from HnTool.modules.util import which
+from HnTool.modules.rule import MasterRule
+
+class Rule(MasterRule):
+ def __init__(self, options):
+ MasterRule.__init__(self, options)
+ self.short_name="tools"
+ self.long_name="Checks if there are security-related tools
installed"
+ self.type="config"
+
+ def analyze(self, options):
+ check_results = self.check_results
+
+ # Checking if chkrootkit is installed
+ if which('chkrootkit'):
+ check_results['info'].append('Chkrootkit is installed')
+ else:
+ check_results['low'].append('Chkrootkit is not installed')
+
+ # Checking if rkhunter is installed
+ if which('rkhunter'):
+ check_results['info'].append('Rkhunter is installed')
+ else:
+ check_results['low'].append('Rkhunter is not installed')
+
+ return check_results
=======================================
--- /HnTool/modules/__init__.py Fri May 28 05:22:45 2010
+++ /HnTool/modules/__init__.py Tue Sep 14 18:55:12 2010
@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
#
-__files__ =
['authentication', 'filesystems', 'php', 'remote', 'system-wide']
+__files__ =
['authentication', 'filesystems', 'php', 'remote', 'system-wide', 'tools']
__services__ =
['apache', 'proftpd', 'ports', 'postgresql', 'ssh', 'vsftpd']
__all__ = __files__ + __services__
=======================================
--- /HnTool/modules/authentication.py Sun Aug 22 07:48:58 2010
+++ /HnTool/modules/authentication.py Tue Sep 14 18:55:12 2010
@@ -122,8 +122,8 @@
lines = HnTool.modules.util.hntool_conf_parser(logindefs_file)
# Checking when passwords expires
- if 'PASS_MAX_DAYS' in lines:
- if int(lines['PASS_MAX_DAYS']) > 90:
+ if lines.has_key('PASS_MAX_DAYS'):
+ if int(lines.get('PASS_MAX_DAYS')) > 90:
check_results['medium'].append('By default passwords
do not ' +
'expires on 90 days or
less')
else:
@@ -133,8 +133,8 @@
check_results['high'].append('By default passwords does
not expires')
# Checking the fail delay
- if 'FAIL_DELAY' in lines:
- if int(lines['FAIL_DELAY']) < 3:
+ if lines.has_key('FAIL_DELAY'):
+ if int(lines.get('FAIL_DELAY')) < 3:
check_results['medium'].append('Delay between failed
login prompts is less than 3s')
else:
check_results['ok'].append('Delay between failed login
prompts is more than 3s')
@@ -142,8 +142,8 @@
check_results['high'].append('Delay between failed login
prompts is not defined')
# Checking pass min days
- if 'PASS_MIN_DAYS' in lines:
- if int(lines['PASS_MIN_DAYS']) < 5:
+ if lines.has_key('PASS_MIN_DAYS'):
+ if int(lines.get('PASS_MIN_DAYS')) < 5:
check_results['medium'].append('Min. number of days
between password changes is less than 5')
else:
check_results['ok'].append('Min. number of days
between password changes is more than 5')
=======================================
--- /HnTool/modules/util.py Wed May 26 08:06:53 2010
+++ /HnTool/modules/util.py Tue Sep 14 18:55:12 2010
@@ -81,3 +81,22 @@
return True
return False
+
+
+def which(program):
+ '''This method check if a command can be found on the system. It
+ works like the "which" command'''
+
+ def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ exe_file = os.path.join(path, program)
+ if is_exe(exe_file):
+ return exe_file
+ return None
=======================================
--- /README Fri Apr 9 04:57:52 2010
+++ /README Tue Sep 14 18:55:12 2010
@@ -22,6 +22,7 @@
* Debian
* Fedora
* Gentoo
+ * Slackware
* Ubuntu
If you are using HnTool on a system that is not listed above, please, let
us know.