improved group error handling

This commit is contained in:
Toni de la Fuente
2018-07-26 23:30:48 -04:00
parent e12f1f6957
commit 17b821aee6
2 changed files with 24 additions and 12 deletions

View File

@@ -8,8 +8,8 @@
# You should have received a copy of the license along with this # You should have received a copy of the license along with this
# work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>. # work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
GROUP_ID[4]="group4" GROUP_ID[4]='group4'
GROUP_NUMBER[4]="4.0" GROUP_NUMBER[4]='4.0'
GROUP_TITLE[4]="Networking - [group4] ******************************************" GROUP_TITLE[4]='Networking - [group4] ******************************************'
GROUP_RUN_BY_DEFAULT[4]="Y" # run it when execute_all is called GROUP_RUN_BY_DEFAULT[4]='Y' # run it when execute_all is called
GROUP_CHECKS[4]="check41,check42,check43,check44,check45" GROUP_CHECKS[4]='check41,check42,check43,check44,check45'

26
prowler
View File

@@ -99,7 +99,7 @@ while getopts ":hlkp:r:c:g:f:m:M:enbV" OPTION; do
CHECK_ID=$OPTARG CHECK_ID=$OPTARG
;; ;;
g ) g )
GROUP_ID=$OPTARG GROUP_ID_READ=$OPTARG
;; ;;
f ) f )
FILTERREGION=$OPTARG FILTERREGION=$OPTARG
@@ -255,6 +255,12 @@ show_all_titles() {
done done
} }
show_all_group_titles() {
for i in "${!GROUP_TITLE[@]}"; do
show_group_title $i
done
}
### All functions defined above ... run the workflow ### All functions defined above ... run the workflow
if [[ $MODE != "csv" ]]; then if [[ $MODE != "csv" ]]; then
prowlerBanner prowlerBanner
@@ -281,13 +287,19 @@ if [[ $CHECK_ID ]];then
fi fi
# Execute group of checks if called with -g # Execute group of checks if called with -g
if [[ $GROUP_ID ]];then if [[ $GROUP_ID_READ ]];then
if [[ $MODE == "csv" ]]; then if [[ " ${GROUP_ID[@]} " =~ " ${GROUP_ID_READ} " ]]; then
BANNER=0 if [[ $MODE == "csv" ]]; then
BANNER=0
fi
execute_group_by_id $GROUP_ID_READ
cleanTemp
exit $EXITCODE
else
textFail "Use a valid check group ID i.e.: group1, extras, forensics-ready, etc."
show_all_group_titles
exit $EXITCODE
fi fi
execute_group_by_id $GROUP_ID
cleanTemp
exit $EXITCODE
fi fi
# List only check tittles # List only check tittles