mirror of https://schlomp.space/tastytea/hashboot
parent
db4669df68
commit
5b02e0e994
17
hashboot
17
hashboot
|
@ -12,7 +12,7 @@
|
||||||
# meet some day, and you think this stuff is worth it, you can give us a hug. #
|
# meet some day, and you think this stuff is worth it, you can give us a hug. #
|
||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
VERSION="0.9.1"
|
VERSION="0.9.2"
|
||||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin:${PATH}"
|
PATH="/bin:/usr/bin:/sbin:/usr/sbin:${PATH}"
|
||||||
|
|
||||||
DIGEST_FILE="/var/lib/hashboot.digest"
|
DIGEST_FILE="/var/lib/hashboot.digest"
|
||||||
|
@ -223,32 +223,37 @@ then
|
||||||
HASHER=$(head -n1 ${DIGEST_FILE} | awk '{print $5}')
|
HASHER=$(head -n1 ${DIGEST_FILE} | awk '{print $5}')
|
||||||
if [ $((${CKMODES} & 001)) != 0 ]; then
|
if [ $((${CKMODES} & 001)) != 0 ]; then
|
||||||
dd if=${MBR_DEVICE} of=${MBR_TMP} bs=${MBR_SIZE}K count=1 status=${DD_STATUS} || die 8
|
dd if=${MBR_DEVICE} of=${MBR_TMP} bs=${MBR_SIZE}K count=1 status=${DD_STATUS} || die 8
|
||||||
if ! grep ${MBR_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee ${LOG_FILE}
|
grep ${MBR_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee ${LOG_FILE}
|
||||||
|
if [ ${PIPESTATUS[1]} -ne 0 ]
|
||||||
then
|
then
|
||||||
echo " !! TIME TO PANIK: MBR WAS MODIFIED !!"
|
echo " !! TIME TO PANIK: MBR WAS MODIFIED !!"
|
||||||
COUNTER=$((COUNTER + 1))
|
COUNTER=$((COUNTER + 1))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $((${CKMODES} & 010)) != 0 ]; then
|
if [ $((${CKMODES} & 010)) != 0 ]; then
|
||||||
if ! grep -v ${MBR_TMP} ${DIGEST_FILE} | grep -v ${BIOS_TMP} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE}
|
grep -v ${MBR_TMP} ${DIGEST_FILE} | grep -v ${BIOS_TMP} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE}
|
||||||
|
if [ ${PIPESTATUS[1]} -ne 0 ]
|
||||||
then
|
then
|
||||||
echo " !! TIME TO PANIK: AT LEAST 1 FILE WAS MODIFIED !!"
|
echo " !! TIME TO PANIK: AT LEAST 1 FILE WAS MODIFIED !!"
|
||||||
COUNTER=$((COUNTER + 2))
|
COUNTER=$((COUNTER + 2))
|
||||||
die $COUNTER
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $((${CKMODES} & 100)) != 0 ]; then
|
if [ $((${CKMODES} & 100)) != 0 ]; then
|
||||||
flashrom --programmer ${PROGRAMMER} -r ${BIOS_TMP} > /dev/null 2>&1
|
flashrom --programmer ${PROGRAMMER} -r ${BIOS_TMP} > /dev/null 2>&1
|
||||||
#if we set an programmer chip in config, find line with hash for bios and compare. if smthg wrong, panic
|
#if we set an programmer chip in config, find line with hash for bios and compare. if smthg wrong, panic
|
||||||
if [ ! ${PROGRAMMER} == "no" ]; then
|
if [ ! ${PROGRAMMER} == "no" ]; then
|
||||||
if ! grep ${BIOS_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE}
|
grep ${BIOS_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE}
|
||||||
|
if [ ${PIPESTATUS[1]} -ne 0 ]
|
||||||
then
|
then
|
||||||
echo " !! TIME TO PANIK: BIOS WAS MODIFIED !!"
|
echo " !! TIME TO PANIK: BIOS WAS MODIFIED !!"
|
||||||
COUNTER=$((COUNTER + 10))
|
COUNTER=$((COUNTER + 10))
|
||||||
die $COUNTER
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ${COUNTER} -gt 0 ]; then
|
||||||
|
die ${COUNTER}
|
||||||
|
fi
|
||||||
elif [ "${1}" == "recover" ]
|
elif [ "${1}" == "recover" ]
|
||||||
then
|
then
|
||||||
echo "Restoring files from backup... (type yes or no for each file)"
|
echo "Restoring files from backup... (type yes or no for each file)"
|
||||||
|
|
Loading…
Reference in New Issue