--- rkhunter/files/development/createfilehashes.pl.orig 2004-06-08 12:02:18 +0400 +++ rkhunter/files/development/createfilehashes.pl 2004-09-22 14:58:24 +0400 @@ -23,5 +23,6 @@ } close(FILE); -print "OSNUMBER:",$file,":",$md5->hexdigest,":",$sha1->hexdigest,":",$filesize,":-:\n"; +$os_number = $ENV{"OSNUMBER"} || "OSNUMBER"; +print $os_number,":",$file,":",$md5->hexdigest,":",$sha1->hexdigest,":",$filesize,":-:\n"; --- rkhunter/files/development/createhashes.sh.orig 2004-06-08 15:29:04 +0400 +++ rkhunter/files/development/createhashes.sh 2004-09-23 04:03:45 +0400 @@ -3,7 +3,10 @@ # Temporary file for sorting the results TMPFILE="`mktemp /tmp/rkhunter.createhashes.XXXXXX`" || exit 1 -DIRS="/sbin /bin /usr/bin /usr/sbin" +dir0=`dirname $0` +export OSNUMBER=`$dir0/printosnumber.sh 2>/dev/null` + +DIRS="/sbin /bin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin" FILES="find cron ifconfig @@ -48,9 +51,10 @@ ip" for I in ${FILES}; do for J in ${DIRS}; do + [ -d "$J" ] || continue FILE="${J}/${I}" if [ -f ${FILE} ]; then - ./createfilehashes.pl ${FILE} >> ${TMPFILE} + "$dir0/createfilehashes.pl" ${FILE} >> ${TMPFILE} fi done done --- rkhunter/files/development/printosnumber.sh.orig 2004-09-23 04:10:00 +0400 +++ rkhunter/files/development/printosnumber.sh 2004-09-23 04:02:38 +0400 @@ -0,0 +1,66 @@ +#!/bin/sh +# +# printosnumber.sh -- part of Rootkit Hunter +# +# Lookups OS.dat and displays number of current platform. +# +# This helper is used by another scripts located in current directory. +# +# Tested under ALTLinux only (derived from Mandrake) +# + +function lookup_os_dat() { + dir0=`dirname $0` + if [ -e "$dir0/../os.dat" ]; then + echo $dir0/../os.dat + return 0 + fi + if [ -e /etc/rkhunter.conf ]; then + . /etc/rkhunter.conf + if [ -n "$DBDIR" ]; then + if [ -e "$DBDIR/os.dat" ]; then + echo $DBDIR/os.dat + return 0 + fi + fi + fi + return 1 +} + +function read_os_id() { # Tested on RH-like Linux only + for f in /etc/*-release; do + if [ -e "$f" ]; then + cat $f + return 0 + fi + done + return 1 +} + +function main() +{ + os_dat="`lookup_os_dat`" + if [ -z "$os_dat" ]; then + echo "Error: cannot lookup os.dat!" 1>&2 + return 1 + fi + + os_id="`read_os_id`" + if [ -z "$os_id" ]; then + echo "Error: cannot lookup platform ID" 1>&2 + return 1 + fi + + os_record="`grep -- "$os_id" "$os_dat" 2>/dev/null`" + if [ -z "$os_record" ]; then + echo "Error: cannot lookup '$os_id' in $os_dat" 1>&2 + return 1 + fi + + echo $os_record | cut -d ':' -f1 + return 0 +} + +main "$@" + +## EOF ## --- rkhunter/files/development/rpmhashes.sh.orig 2004-05-10 21:09:23 +0400 +++ rkhunter/files/development/rpmhashes.sh 2004-09-23 04:07:12 +0400 @@ -1,6 +1,9 @@ #!/bin/sh FILES="/usr/bin/find /usr/sbin/cron /sbin/ifconfig /usr/bin/watch /usr/bin/w /usr/bin/whoami /usr/bin/who /usr/bin/users /usr/bin/stat /usr/bin/sha1sum /usr/bin/kill /usr/bin/find /usr/bin/file /usr/bin/pstree /usr/bin/killall /usr/bin/lsattr /bin/mount /bin/netstat /bin/egrep /bin/fgrep /bin/grep /bin/cat /bin/chmod /bin/chown /bin/env /bin/ls /bin/su /bin/ps /bin/dmesg /bin/kill /bin/login /sbin/chkconfig /sbin/depmod /sbin/insmod /sbin/modinfo /sbin/sysctl /sbin/syslogd /sbin/init /sbin/runlevel /usr/bin/groups /sbin/ip" -OSID="OSNO" +FILES="$FILES /bin/find /usr/bin/cat /usr/bin/env" +dir0=`dirname $0` +OSID=`$dir0/printosnumber.sh 2>/dev/null` +: ${OSID:=OSNO} for I in ${FILES}; do if [ -f ${I} ]