+
+
+
+
Overall Score
+
${SCORE_OVERALL}%
+
+
+
+
+
+
+
+
+
+
Level 1 Score
+
${l1_display}
+
+
+
Level 2 Score
+
${l2_display}
+
+
+HEADEREOF
+}
+
+_emit_html_section_table() {
+ cat <<'TABLESTART'
+
Section Breakdown
+
+
+
+| Section |
+Pass |
+Fail |
+Warn |
+Skip |
+Score |
+Progress |
+
+
+
+TABLESTART
+
+ local section
+ for section in "${SECTION_ORDER[@]}"; do
+ local p="${SECTION_PASS[$section]:-0}"
+ local f="${SECTION_FAIL[$section]:-0}"
+ local w="${SECTION_WARN[$section]:-0}"
+ local s="${SECTION_SKIP[$section]:-0}"
+ local score="${SCORE_BY_SECTION[$section]:-N/A}"
+
+ local score_display
+ if [[ "$score" == "N/A" ]]; then
+ score_display="N/A"
+ else
+ score_display="${score}%"
+ fi
+
+ local bar_width
+ if [[ "$score" == "N/A" ]]; then
+ bar_width="0"
+ else
+ bar_width="$score"
+ fi
+
+ local bar_color
+ bar_color=$(_html_score_color "$score")
+
+ local esc_section
+ esc_section=$(html_escape "$section")
+
+ printf '\n'
+ printf '| %s | \n' "$esc_section"
+ printf '%d | \n' "$p"
+ printf '%d | \n' "$f"
+ printf '%d | \n' "$w"
+ printf '%d | \n' "$s"
+ printf '%s | \n' "$bar_color" "$score_display"
+ printf ' | \n' "$bar_width" "$bar_color"
+ printf '
\n'
+ done
+
+ cat <<'TABLEEND'
+
+
+TABLEEND
+}
+
+_emit_html_details() {
+ printf '
Detailed Results
\n'
+
+ local section
+ for section in "${SECTION_ORDER[@]}"; do
+ local has_results=0
+ local id
+ for id in "${RESULT_ORDER[@]}"; do
+ if [[ "${CTRL_SECTION[$id]}" == "$section" ]]; then
+ has_results=1
+ break
+ fi
+ done
+
+ if (( has_results == 0 )); then
+ continue
+ fi
+
+ local esc_section
+ esc_section=$(html_escape "$section")
+
+ printf '
\n'
+ printf '
%s
\n' "$esc_section"
+
+ for id in "${RESULT_ORDER[@]}"; do
+ if [[ "${CTRL_SECTION[$id]}" != "$section" ]]; then
+ continue
+ fi
+
+ local status="${RESULT_STATUS[$id]}"
+ local title="${CTRL_TITLE[$id]}"
+ local level="${CTRL_LEVEL[$id]}"
+ local evidence="${RESULT_EVIDENCE[$id]:-}"
+ local remediation="${CTRL_REMEDIATION[$id]:-}"
+
+ local cls
+ cls=$(_html_status_class "$status")
+
+ local esc_id
+ esc_id=$(html_escape "$id")
+ local esc_title
+ esc_title=$(html_escape "$title")
+
+ local open_attr=""
+ if [[ "$status" == "$STATUS_FAIL" ]]; then
+ open_attr=" open"
+ fi
+
+ printf '
\n' "$cls" "$open_attr"
+ printf '\n'
+ printf '%s\n' "$cls" "$status"
+ printf '%s\n' "$esc_id"
+ printf '%s\n' "$esc_title"
+ printf 'L%s\n' "$level"
+ printf '
\n'
+
+ if [[ -n "$evidence" || -n "$remediation" ]]; then
+ printf '\n'
+ if [[ -n "$evidence" ]]; then
+ local esc_evidence
+ esc_evidence=$(html_escape "$evidence")
+ printf '
%s
\n' "$esc_evidence"
+ fi
+ if [[ -n "$remediation" ]]; then
+ local esc_remediation
+ esc_remediation=$(html_escape "$remediation")
+ printf '
Remediation: %s
\n' "$esc_remediation"
+ fi
+ printf '
\n'
+ fi
+
+ printf ' \n'
+ done
+
+ printf '
\n'
+ done
+}
+
+_emit_html_footer() {
+ local esc_version
+ esc_version=$(html_escape "$VERSION")
+
+ cat <
+cisaudit v${esc_version}
+
+
+
+