mirror of
https://github.com/e-m-b-a/emba.git
synced 2026-10-11 22:09:54 +00:00
51 lines
2.0 KiB
Bash
Executable File
51 lines
2.0 KiB
Bash
Executable File
#!/bin/bash -p
|
|
# see: https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ShellScripting/ShellScriptSecurity/ShellScriptSecurity.html#//apple_ref/doc/uid/TP40004268-CH8-SW29
|
|
|
|
# EMBA - EMBEDDED LINUX ANALYZER
|
|
#
|
|
# Copyright 2020-2026 Siemens Energy AG
|
|
#
|
|
# EMBA comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
|
|
# welcome to redistribute it under the terms of the GNU General Public License.
|
|
# See LICENSE file for usage of this software.
|
|
#
|
|
# EMBA is licensed under GPLv3
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
#
|
|
# Author(s): Michael Messner
|
|
|
|
# Description: Update script for collection of known exploited vulnerabilities
|
|
|
|
EMBA_CONFIG_PATH="./config"
|
|
KEV_CSV_FILE="${EMBA_CONFIG_PATH}/known_exploited_vulnerabilities.csv"
|
|
|
|
## Color definition
|
|
GREEN="\033[0;32m"
|
|
ORANGE="\033[0;33m"
|
|
NC="\033[0m" # no color
|
|
|
|
if ! [[ -d "${EMBA_CONFIG_PATH}" ]]; then
|
|
echo "[-] No EMBA config directory found! Please start this crawler from the EMBA directory"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -f "${KEV_CSV_FILE}" ]]; then
|
|
echo -e "${GREEN}[+] Known exploit database has ${ORANGE}$(wc -l "${KEV_CSV_FILE}" | awk '{print $1}')${GREEN} exploit entries (before update).${NC}"
|
|
fi
|
|
|
|
echo "[*] Update the known_exploited_vulnerabilities database"
|
|
wget https://www.cisa.gov/sites/default/files/csv/known_exploited_vulnerabilities.csv -O "${KEV_CSV_FILE}.new" || (echo "[-] Update of known exploited vulnerabilities failed" && exit 1)
|
|
|
|
if [[ -f "${KEV_CSV_FILE}.new" ]]; then
|
|
if [[ $(wc -l "${KEV_CSV_FILE}.new" | awk '{print $1}') -ge $(wc -l "${KEV_CSV_FILE}" | awk '{print $1}') ]]; then
|
|
# copy it only if the updated file is greater or equal than the installed one
|
|
mv "${KEV_CSV_FILE}.new" "${KEV_CSV_FILE}" || (echo "[-] Update of known exploited vulnerabilities failed" && exit 1)
|
|
fi
|
|
|
|
rm -f "${KEV_CSV_FILE}.new"
|
|
fi
|
|
|
|
if [[ -f "${KEV_CSV_FILE}" ]]; then
|
|
echo -e "${GREEN}[+] Known exploit database now has ${ORANGE}$(wc -l "${KEV_CSV_FILE}" | awk '{print $1}')${GREEN} exploit entries (after update).${NC}"
|
|
fi
|