diff --git a/PROJECTS.md b/PROJECTS.md index 0408a393..d4fe87f8 100644 --- a/PROJECTS.md +++ b/PROJECTS.md @@ -4,6 +4,12 @@ In this document we list all known projects around EMBA and EMBArk. Feel free to open issues or a pull request to list your project also in here. +## EMBA-MCP + +Model Context Protocol (MCP) server for EMBA firmware analysis. EMBA-MCP exposes EMBA firmware analysis results as structured tools via MCP, allowing LLMs (Claude, ChatGPT, etc.) to query, reason, and correlate firmware security findings programmatically. It parses, normalizes, and reasons over EMBA output. + +[Repository](https://github.com/0xbuz3R/EMBA-MCP) + ## UTSA Software Capstone Design Project - Spring 2025 P51 Mustang binwalk extractor is a module for EMBA (Embedded Malware Binary Analyzer) to improve the speed and scalability of firmware analysis by performing a depth-first traversal of the file system, using GPU acceleration, and parallelization of file operations. diff --git a/helpers/helpers_emba_helpers.sh b/helpers/helpers_emba_helpers.sh index caaaa349..3ff037c5 100755 --- a/helpers/helpers_emba_helpers.sh +++ b/helpers/helpers_emba_helpers.sh @@ -51,7 +51,7 @@ wait_for_pid() { # print_output "[*] wait pid protection - running pid: $lPID" print_dot # if S115 is running we have to kill old qemu processes - if [[ -f "${LOG_DIR}"/"${MAIN_LOG_FILE}" ]] && [[ $(grep -i -c S115_ "${LOG_DIR}"/"${MAIN_LOG_FILE}") -gt 0 && -n "${QRUNTIME}" ]]; then + if [[ -f "${LOG_DIR}/${MAIN_LOG_FILE}" ]] && [[ $(grep -i -c S115_ "${LOG_DIR}/${MAIN_LOG_FILE}") -gt 0 && -v QRUNTIME ]]; then killall -9 --quiet --older-than "${QRUNTIME}" -r .*qemu-.*-sta.* || true fi done @@ -115,13 +115,13 @@ cleaner() { if [[ "${IN_DOCKER}" -eq 0 ]] && [[ -n "${QUEST_CONTAINER}" ]]; then if [[ "$(docker container inspect -f '{{.State.Status}}' "${QUEST_CONTAINER}" 2>/dev/null)" == "running" ]]; then print_output "[*] $(print_date) - Stopping Quest Container ..." "no_log" - docker kill "${QUEST_CONTAINER}" 2>/dev/null + docker kill "${QUEST_CONTAINER}" 2>/dev/null || true fi fi if [[ "${IN_DOCKER}" -eq 0 ]] && [[ -n "${MAIN_CONTAINER}" ]]; then if [[ "$(docker container inspect -f '{{.State.Status}}' "${MAIN_CONTAINER}" 2>/dev/null)" == "running" ]]; then print_output "[*] $(print_date) - Stopping EMBA main Container ..." "no_log" - docker kill "${MAIN_CONTAINER}" 2>/dev/null + docker kill "${MAIN_CONTAINER}" 2>/dev/null || true fi fi # stop inotifywait on host diff --git a/helpers/helpers_emba_print.sh b/helpers/helpers_emba_print.sh index e13635ea..5664731a 100755 --- a/helpers/helpers_emba_print.sh +++ b/helpers/helpers_emba_print.sh @@ -138,6 +138,13 @@ print_error() { safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")" "${ERROR_LOG}" } +# usage: +# print_output "asdf" -> logs to screena and to default LOG_FILE +# print_output "asdf" "main" -> logs to screen and to main log +# print_output "asdf" "no_log" -> just logs to screen +# print_output "asdf" "other_log_file" -> logs to screen and to other log file +# print_output "asdf" "" "link" -> logs to LOG_FILE and includes a link (REF) +# print_output "asdf" "other_log_file" "" 0 -> does not log to default LOG_FILE. Logs to screen and to other_log_file print_output() { local lOUTPUT="${1:-\n}" local lLOG_SETTING="${2:-}" @@ -146,6 +153,8 @@ print_output() { fi # add a link as third argument to add a link marker for web report local lREF_LINK="${3:-}" + # log into default log LOG_FILE + local lDEF_LOG="${4:-1}" local lTYPE_CHECK="" lTYPE_CHECK="$( echo "${lOUTPUT}" | cut -c1-3 )" @@ -157,29 +166,39 @@ print_output() { safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")" "${MAIN_LOG}" elif [[ "${lLOG_SETTING}" != "no_log" ]] ; then if [[ -z "${lREF_LINK:-}" ]] ; then - safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")" "${LOG_FILE}" + if [[ "${lDEF_LOG}" -eq 1 ]]; then + safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")" "${LOG_FILE}" + fi if [[ -n "${lLOG_FILE_MOD:-}" ]]; then safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")" "${lLOG_FILE_MOD}" fi else - safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")""\\r\\n""$(format_log "[REF] ""${lREF_LINK}" 1)" "${LOG_FILE}" + if [[ "${lDEF_LOG}" -eq 1 ]]; then + safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")""\\r\\n""$(format_log "[REF] ""${lREF_LINK}" 1)" "${LOG_FILE}" + fi if [[ -n "${lLOG_FILE_MOD:-}" ]]; then safe_echo "$(format_log "${lCOLOR_OUTPUT_STRING}")""\\r\\n""$(format_log "[REF] ""${lREF_LINK}" 1)" "${lLOG_FILE_MOD}" fi fi fi else - safe_echo "${lOUTPUT}" + if [[ "${lDEF_LOG}" -eq 1 ]]; then + safe_echo "${lOUTPUT}" + fi if [[ "${lLOG_SETTING}" == "main" ]] ; then safe_echo "$(format_log "${lOUTPUT}")" "${MAIN_LOG}" elif [[ "${lLOG_SETTING}" != "no_log" ]] ; then if [[ -z "${lREF_LINK}" ]] ; then - safe_echo "$(format_log "${lOUTPUT}")" "${LOG_FILE:-}" + if [[ "${lDEF_LOG}" -eq 1 ]]; then + safe_echo "$(format_log "${lOUTPUT}")" "${LOG_FILE:-}" + fi if [[ -n "${lLOG_FILE_MOD:-}" ]]; then safe_echo "$(format_log "${lOUTPUT}")" "${lLOG_FILE_MOD}" fi else - safe_echo "$(format_log "${lOUTPUT}")""\\r\\n""$(format_log "[REF] ""${lREF_LINK}" 1)" "${LOG_FILE}" + if [[ "${lDEF_LOG}" -eq 1 ]]; then + safe_echo "$(format_log "${lOUTPUT}")""\\r\\n""$(format_log "[REF] ""${lREF_LINK}" 1)" "${LOG_FILE}" + fi if [[ -n "${lLOG_FILE_MOD:-}" ]]; then safe_echo "$(format_log "${lOUTPUT}")""\\r\\n""$(format_log "[REF] ""${lREF_LINK}" 1)" "${lLOG_FILE_MOD}" fi