Adjust counting and reporting of plugins

This commit is contained in:
mboelen 2016-01-19 12:09:42 +01:00
parent 6bab259a5e
commit 00ebad930a

11
lynis
View File

@ -649,6 +649,9 @@
if [ ${RUN_PLUGINS} -eq 1 ]; then if [ ${RUN_PLUGINS} -eq 1 ]; then
N_PLUGIN=0
N_PLUGIN_ENABLED=0
# Plugins function # Plugins function
RunPlugins() RunPlugins()
{ {
@ -662,8 +665,6 @@
Display --text " " Display --text " "
logtext "Searching plugins..." logtext "Searching plugins..."
fi fi
N_PLUGIN=0
N_PLUGIN_ENABLED=0
# Search plugins # Search plugins
FIND_PLUGINS=`find ${PLUGINDIR} -type f -name "plugin_[a-z]*" -exec echo \{\} \; | sort` FIND_PLUGINS=`find ${PLUGINDIR} -type f -name "plugin_[a-z]*" -exec echo \{\} \; | sort`
@ -673,7 +674,7 @@
if [ -f ${PLUGIN_FILE} ]; then if [ -f ${PLUGIN_FILE} ]; then
FIND2=`grep "^# PLUGIN_NAME=" ${PLUGIN_FILE} | awk -F= '{ print $2 }'` FIND2=`grep "^# PLUGIN_NAME=" ${PLUGIN_FILE} | awk -F= '{ print $2 }'`
if [ ! "${FIND2}" = "" -a ! "${FIND2}" = "[plugin_name]" ]; then if [ ! "${FIND2}" = "" -a ! "${FIND2}" = "[plugin_name]" ]; then
N_PLUGIN=`expr ${N_PLUGIN} + 1` if [ ${PLUGIN_PHASE} -eq 1 ]; then N_PLUGIN=`expr ${N_PLUGIN} + 1`; fi
FIND3=`grep "^plugin=${FIND2}" ${PROFILE}` FIND3=`grep "^plugin=${FIND2}" ${PROFILE}`
if [ ! "${FIND3}" = "" ]; then if [ ! "${FIND3}" = "" ]; then
logtext "Plugin ${FIND2} is enabled" logtext "Plugin ${FIND2} is enabled"
@ -685,8 +686,8 @@
FIND4=`ls -l ${PLUGINFILE} | cut -c 2-10` FIND4=`ls -l ${PLUGINFILE} | cut -c 2-10`
if [ "${FIND4}" = "rw-r--r--" -o "${FIND4}" = "rw-r-----" -o "${FIND4}" = "rw-------" -o "${FIND4}" = "r--------" ]; then if [ "${FIND4}" = "rw-r--r--" -o "${FIND4}" = "rw-r-----" -o "${FIND4}" = "rw-------" -o "${FIND4}" = "r--------" ]; then
logtext "Including plugin file: ${PLUGINFILE} (version: ${PLUGIN_VERSION})" logtext "Including plugin file: ${PLUGINFILE} (version: ${PLUGIN_VERSION})"
report "plugin_enabled_phase1[]=${FIND2}|${PLUGIN_VERSION}|" report "plugin_enabled_phase${PLUGIN_PHASE}[]=${FIND2}|${PLUGIN_VERSION}|"
N_PLUGIN_ENABLED=`expr ${N_PLUGIN_ENABLED} + 1` if [ ${PLUGIN_PHASE} -eq 1 ]; then N_PLUGIN_ENABLED=`expr ${N_PLUGIN_ENABLED} + 1`; fi
Display --indent 2 --text "- ${CYAN}Plugin${NORMAL}: ${WHITE}${FIND2}${NORMAL}" Display --indent 2 --text "- ${CYAN}Plugin${NORMAL}: ${WHITE}${FIND2}${NORMAL}"
if [ ${PLUGIN_PHASE} -eq 1 ]; then Progress " ["; fi if [ ${PLUGIN_PHASE} -eq 1 ]; then Progress " ["; fi
. ${PLUGINFILE} . ${PLUGINFILE}