Improvements to report output, including custom URLs

This commit is contained in:
mboelen 2015-01-30 18:09:18 +01:00
parent b23a730e7e
commit 391476f38e
1 changed files with 196 additions and 189 deletions

View File

@ -18,33 +18,26 @@
#
#################################################################################
#
logtextbreak
#if [ ${QUIET} -eq 0 ]; then
# echo ""
# echo " ---------------------------------------------------"
# echo " Program version: ${PROGRAM_version}"
# echo " Operating system: ${OS_NAME}"
# echo " Operating system version: ${OS_VERSION}"
# if [ ! "${OS_MODE}" = "" ]; then echo " Operating system mode: ${OS_MODE}"; fi
# echo " Kernel version: ${OS_KERNELVERSION}"
# echo " Hardware platform: ${HARDWARE}"
# echo " Hostname: ${HOSTNAME}"
# echo " Auditor: ${AUDITORNAME}"
# echo " Profile: ${PROFILE}"
# echo " Log file: ${LOGFILE}"
# echo " Report file: ${REPORTFILE}"
# echo " Report version: ${REPORT_version}"
# echo " ---------------------------------------------------"
# fi
#
#################################################################################
#
# Hardening Index
# Define approximately how strong a machine has been hardened
#
#################################################################################
#
# Only show overview if not running in quiet mode
if [ ${QUIET} -eq 0 ]; then
echo ""; echo "================================================================================"
echo ""; echo " -[ ${WHITE}${PROGRAM_name} ${PROGRAM_version} Results${NORMAL} ]-"
echo "";
if [ ${SHOW_REPORT} -eq 1 ]; then
logtextbreak
#
#################################################################################
#
# Hardening Index
# Define approximately how strong a machine has been hardened
#
#################################################################################
#
# If no hardening has been found, set value to 1
if [ ${HPPOINTS} -eq 0 ]; then HPPOINTS=1; HPTOTAL=100; fi
HPINDEX=`expr $HPPOINTS \* 100 / $HPTOTAL`
@ -96,23 +89,21 @@
logtext "Hardening strength: ${HIDESCRIPTION}"
report "hardening_index=${HPINDEX}"
#
#################################################################################
#
# Show test results overview
#
#################################################################################
#
# Only show overview if not running in quiet mode
if [ ${QUIET} -eq 0 ]; then
echo ""; echo "================================================================================"
echo ""; echo " -[ ${WHITE}${PROGRAM_name} ${PROGRAM_version} Results${NORMAL} ]-"
echo "";
#
#################################################################################
#
# Show test results overview
#
#################################################################################
#
if [ "${CONTROL_URL_PREPEND}" = "" ]; then CONTROL_URL_PREPEND="https://cisofy.com/controls/"; fi
if [ "${CONTROL_URL_APPEND}" = "" ]; then CONTROL_URL_APPEND="/"; fi
if [ "${CUSTOM_URL_PREPEND}" = "" ]; then CUSTOM_URL_PREPEND="https://your-domain.example.org/controls/"; fi
if [ "${CUSTOM_URL_APPEND}" = "" ]; then CUSTOM_URL_APPEND="/"; fi
# Show warnings from logfile
SWARNINGS=`cat ${LOGFILE} | grep -i 'warning:' | sed 's/ /!space!/g'`
if [ "${SWARNINGS}" = "" ]; then
echo " ${OK}No warnings${NORMAL}"; echo ""
else
@ -121,8 +112,13 @@
for WARNING in ${SWARNINGS}; do
SHOWWARNING=`echo ${WARNING} | sed 's/!space!/ /g' | sed 's/^\[\(.*\)\] Warning: //'`
ADDLINK=`echo ${WARNING} | sed 's/!space!/ /g' | sed 's/^\[\(.*\)\] Warning: \(.*\)\[//' | sed 's/\]//'`
IS_CUSTOM=`echo ${ADDLINK} | grep "^CUST"`
echo " ${WHITE}- ${SHOWWARNING}${NORMAL}"
echo " https://cisofy.com/controls/${ADDLINK}/"
if [ "${IS_CUSTOM}" = "" ]; then
echo " ${CONTROL_URL_PREPEND}${ADDLINK}${CONTROL_URL_APPEND}"
else
echo " ${CUSTOM_URL_PREPEND}${ADDLINK}${CUSTOM_URL_APPEND}"
fi
echo ""
done
fi
@ -138,8 +134,13 @@
for SUGGESTION in ${SSUGGESTIONS}; do
SHOWSUGGESTION=`echo ${SUGGESTION} | sed 's/!space!/ /g' | sed 's/^\[\(.*\)\] Suggestion: //'`
ADDLINK=`echo ${SUGGESTION} | sed 's/!space!/ /g' | sed 's/^\[\(.*\)\] Suggestion: \(.*\)\[//' | sed 's/\]//'`
IS_CUSTOM=`echo ${ADDLINK} | grep "^CUST"`
echo " - ${SHOWSUGGESTION}"
echo " https://cisofy.com/controls/${ADDLINK}/"
if [ "${IS_CUSTOM}" = "" ]; then
echo " ${CONTROL_URL_PREPEND}${ADDLINK}${CONTROL_URL_APPEND}"
else
echo " ${CUSTOM_URL_PREPEND}${ADDLINK}${CUSTOM_URL_APPEND}"
fi
done
echo ""
fi
@ -223,15 +224,21 @@
echo "================================================================================"
fi
echo " ${PROGRAM_name} ${PROGRAM_version}"
echo " ${PROGRAM_copyright}"
echo " ${WHITE}${PROGRAM_extrainfo}${NORMAL}"
echo "================================================================================"
echo ""; echo ""
fi
fi
if [ ${QUIET} -eq 0 ]; then
echo " ${PROGRAM_name} ${PROGRAM_version}"
echo " ${PROGRAM_copyright}"
echo " ${WHITE}${PROGRAM_extrainfo}${NORMAL}"
echo "================================================================================"
fi
#
#================================================================================
# Lynis - Copyright 2007-2015, Michael Boelen - cisofy.com - The Netherlands
# Lynis - Copyright 2007-2015, Michael Boelen, CISOfy - https://cisofy.com