Example signature generating scripts.

This commit is contained in:
blymn 2002-11-23 10:25:03 +00:00
parent 1c475f17bc
commit c06c99cbd3
3 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# $NetBSD: Makefile,v 1.1 2002/11/23 10:25:03 blymn Exp $
NOOBJ= # defined
.include <bsd.own.mk>
.if ${MKSHARE} != "no"
FILES= gen_md5 gen_sha1
FILESDIR=/usr/share/examples/veriexecctl
.endif
.include <bsd.prog.mk>

View File

@ -0,0 +1,26 @@
#!/bin/sh
#
# $NetBSD: gen_md5,v 1.1 2002/11/23 10:25:04 blymn Exp $
#
# This is a helper script that scans all the file systems for
# executables and generates an entry in the signatures file for
# each one found. The script is probably best run by root and
# will move the old signatures file prior to starting the real work.
#
mv signatures signatures.old
echo "Fingerprinting the system, this may take a while...."
#
find / \( \( -fstype ffs -a ! -iregex '^/proc.*' -a -type f -a \( -perm -0100 -o -perm -0010 -o -perm -0001 \) \) -o -name 'lib*so*' \) -print | while read line
do
echo "Fingerprinting $line"
hash=`md5 $line | cut -d'=' -f2 | tr -d ' '`
flag=""
if [ ! -x $line ]
then
flag=" FILE"
fi
if [ "${hash}" != "" ]
then
echo "$line md5 ${hash}${flag}" >> signatures
fi
done

View File

@ -0,0 +1,26 @@
#!/bin/sh
#
# $NetBSD: gen_sha1,v 1.1 2002/11/23 10:25:04 blymn Exp $
#
# This is a helper script that scans all the file systems for
# executables and generates an entry in the signatures file for
# each one found. The script is probably best run by root and
# will move the old signatures file prior to starting the real work.
#
mv signatures signatures.old
echo "Fingerprinting the system, this may take a while...."
#
find / \( \( -fstype ffs -a ! -iregex '^/proc.*' -a -type f -a \( -perm -0100 -o -perm -0010 -o -perm -0001 \) \) -o -name 'lib*so*' \) -print | while read line
do
echo "Fingerprinting $line"
hash=`sha1 $line | cut -d'=' -f2 | tr -d ' '`
flag=""
if [ ! -x $line ]
then
flag=" FILE"
fi
if [ "${hash}" != "" ]
then
echo "$line sha1 ${hash}${flag}" >> signatures
fi
done