Skip to content

Commit

Permalink
checksummer
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyclenerd committed Mar 18, 2017
1 parent ff242e3 commit bbf0f57
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions checksummer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Checksummer

Script to create checksums (MD5) of static files. Useful for firewall installations to detect root kits.
39 changes: 39 additions & 0 deletions checksummer/checksummer-bsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/local/bin/bash

#
# Simple md5 Chechsum Builder for *BSD
#

STATICDIRS="/bin /boot /etc /sbin /usr"
#STATICDIRS="/etc"

CFV="/usr/local/bin/cfv"

if [ "$UID" != "0" ]; then
echo -e "\033[40m\033[1;31mERROR: Root check FAILED (you MUST be root to use this script)!\033[0m"
exit 1
fi

case "$1" in
create)
for dir in ${STATICDIRS}
do
find "$dir" -type f \! \( -path "/usr/ports/*" \
-or -path "/usr/src/*" \
-or -path "/usr/local/man/*" \
-or -path "/usr/local/lib/perl5/5.6.1/man/*" \
-or -path "/usr/share/openssl/man/*" \
-or -path "/usr/share/man/*" \) \
-exec $CFV -t md5 -C -VV -f - \{\} \;
done
;;
check)
$CFV -t md5 -f -
;;
*)
echo "Usage:"
echo "Create: $0 create > file"
echo "Check: $0 check < file"
exit 1
;;
esac
31 changes: 31 additions & 0 deletions checksummer/checksummer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

#
# Simple md5 Chechsum Builder
#

#STATICDIRS="/bin /boot /etc /sbin /lib /opt /usr"
STATICDIRS="/bin"

if [ "$UID" != "0" ]; then
echo -e "\033[40m\033[1;31mERROR: Root check FAILED (you MUST be root to use this script)!\033[0m"
exit 1
fi

case "$1" in
create)
for dir in ${STATICDIRS}
do
find "$dir" -mount -type f -exec md5sum \{\} \;
done
;;
check)
md5sum -c
;;
*)
echo "Usage:"
echo "Create: $0 create > file"
echo "Check: $0 check < file"
exit 1
;;
esac

0 comments on commit bbf0f57

Please sign in to comment.