Skip to content

Commit 5ab4f6c

Browse files
committed
init fw differ environment
1 parent 6a1b2da commit 5ab4f6c

11 files changed

+207
-72
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN apt-get update && \
1212
apt-get -y install wget kmod procps sudo dialog apt curl git
1313

1414
# install EMBA, disable coredumps and final cleanup
15-
RUN yes | sudo /installer.sh -D && \
15+
RUN yes | sudo /installer.sh -s -D && \
1616
ulimit -c 0 && rm -rf /var/lib/apt/lists/*
1717

1818
WORKDIR /emba

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ Author(s): Michael Messner, Pascal Eckmann, Benedikt Kühne
3030
# EMBA
3131
## The security analyzer for firmware of embedded devices
3232

33-
*EMBA* is designed as the central firmware analysis tool for penetration testers. It supports the complete security analysis process starting with the *firmware extraction* process, doing *static analysis* and *dynamic analysis* via emulation and finally generating a web report. *EMBA* automatically discovers possible weak spots and vulnerabilities in firmware. Examples are insecure binaries, old and outdated software components, potentially vulnerable scripts or hard-coded passwords. *EMBA* is a command line tool with the option to generate an easy to use web report for further analysis.
33+
*EMBA* is designed as the central firmware analysis tool for penetration testers and product security teams. It supports the complete security analysis process starting with *firmware extraction*, doing *static analysis* and *dynamic analysis* via emulation and finally generating a web report. *EMBA* automatically discovers possible weak spots and vulnerabilities in firmware. Examples are insecure binaries, old and outdated software components, potentially vulnerable scripts, or hard-coded passwords. *EMBA* is a command line tool with the possibility to generate an easy-to-use web report for further analysis.
3434

35-
*EMBA* combines multiple established analysis tools and can be started with one simple command. Afterwards it tests the firmware for possible security risks and interesting areas for further investigation. No manual installation of all helpers, once the integrated installation script has been executed, you are ready to test your firmware.
36-
37-
*EMBA* is designed to assist penetration testers and not as a standalone tool without human interaction. *EMBA* should provide as much information as possible about the firmware, that the tester can decide on focus areas and is responsible for verifying and interpreting the results.
35+
*EMBA* assists the penetration testers and product security teams in the identification of weak spots and vulnerabilities in the firmware image. *EMBA* provides as much information as possible about the firmware, that the tester can decide on focus areas and is responsible for verifying and interpreting the results.
3836

3937
[![Watch EMBA](https://raw.githubusercontent.com/wiki/e-m-b-a/emba/images/youtube-emba.png)](https://youtu.be/_dvdy3klFFY "Watch EMBA")
4038

emba

+59-7
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,15 @@ main() {
547547
export FIRMWARE_PATH="${LOG_DIR}"/firmware/firmware_docker_extracted.tar
548548
export OUTPUT_DIR="${FIRMWARE_PATH}"
549549
export FIRMWARE=1
550-
elif [[ -f "${FIRMWARE_PATH}" ]]; then
550+
elif [[ -f "${FIRMWARE_PATH}" ]] && [[ -z "${FIRMWARE_PATH1}" ]]; then
551551
PRE_CHECK=1
552552
print_output "[*] Firmware binary detected." "no_log"
553553
print_output " EMBA starts with the pre-testing phase." "no_log"
554554
export OUTPUT_DIR="${FIRMWARE_PATH}"
555+
elif [[ -f "${FIRMWARE_PATH}" ]] && [[ -f "${FIRMWARE_PATH1}" ]]; then
556+
DIFF_MODE=1
557+
print_output "[*] Multiple firmware binarie detected." "no_log"
558+
print_output " EMBA starts in firmware diff mode ." "no_log"
555559
elif [[ -f "${KERNEL_CONFIG}" && "${KERNEL}" -eq 1 ]]; then
556560
print_output "[*] Kernel configuration file detected." "no_log"
557561
else
@@ -675,9 +679,9 @@ main() {
675679

676680
OPTIND=1
677681
ARGUMENTS=()
678-
while getopts a:A:BcC:d:De:Ef:Fghijk:l:m:N:op:P:QrsStT:UX:yY:WxzZ: OPT ; do
682+
while getopts a:A:BcC:d:De:Ef:Fghijk:l:m:N:o:p:P:QrsStT:UX:yY:WxzZ: OPT ; do
679683
case ${OPT} in
680-
D|f|i|l)
684+
D|f|i|l|o)
681685
;;
682686
*)
683687
if [[ -v OPTARG[@] ]] ; then
@@ -722,13 +726,19 @@ main() {
722726

723727
disable_strict_mode "${STRICT_MODE}" 0
724728
if [[ "${ONLY_DEP}" -gt 0 ]]; then
729+
# check dependencies mode:
725730
EMBA="${INVOCATION_PATH}" FIRMWARE="${FIRMWARE_PATH}" docker-compose run --rm emba -c './emba -f /firmware -i "$@"' _ "${ARGUMENTS[@]}"
726731
D_RETURN=$?
727732
EMBA="${INVOCATION_PATH}" FIRMWARE="${FIRMWARE_PATH}" docker-compose run --rm emba_quest -c './emba -f /firmware -i "$@"' _ "${ARGUMENTS[@]}"
728733
if [[ $? -ne ${D_RETURN} ]]; then
729734
D_RETURN=1
730735
fi
736+
elif [[ "${DIFF_MODE}" -gt 0 ]]; then
737+
# firmware diff mode - needs two firmware files:
738+
EMBA="${INVOCATION_PATH}" FIRMWARE="${FIRMWARE_PATH}" LOG="${LOG_DIR}" docker-compose run -v "${FIRMWARE_PATH1}":/firmware2 --rm emba -c './emba -l /logs -f /firmware -o /firmware2 -i "$@"' _ "${ARGUMENTS[@]}"
739+
D_RETURN=$?
731740
else
741+
# default EMBA analysis mode:
732742
local QUEST_CONTAINER_=""
733743
QUEST_CONTAINER_="$(EMBA="${INVOCATION_PATH}" FIRMWARE="${FIRMWARE_PATH}" LOG="${LOG_DIR}" docker-compose run --detach --rm emba_quest -c './emba -l /logs -f /firmware -i "$@"' _ "${ARGUMENTS[@]}")"
734744
export QUEST_CONTAINER="${QUEST_CONTAINER_}"
@@ -784,7 +794,7 @@ main() {
784794
# Quests (Q-modules)
785795
#######################################################################################
786796

787-
if [[ -v CONTAINER_NUMBER ]]; then
797+
if [[ -v CONTAINER_NUMBER ]] && [[ "${DIFF_MODE}" -ne 1 ]]; then
788798
if [[ "${CONTAINER_NUMBER}" -eq 2 ]] ; then
789799
while ! grep -q "Pre-checking phase started" "${LOG_DIR}"/"${MAIN_LOG_FILE}"; do
790800
sleep 1
@@ -809,7 +819,7 @@ main() {
809819
#######################################################################################
810820
# Pre-Check (P-modules)
811821
#######################################################################################
812-
if [[ "${PRE_CHECK}" -eq 1 ]] ; then
822+
if [[ "${PRE_CHECK}" -eq 1 ]] && [[ "${DIFF_MODE}" -ne 1 ]]; then
813823

814824
print_ln "no_log"
815825
if [[ -d "${LOG_DIR}" ]]; then
@@ -844,11 +854,53 @@ main() {
844854
# print_output "[!] LINUX_PATH_ARRAY: ${#ROOT_PATH[@]}"
845855
fi
846856

857+
#######################################################################################
858+
# Diff mode (D-modules - currently not public)
859+
#######################################################################################
860+
if [[ "${DIFF_MODE}" -eq 1 ]] ; then
861+
862+
# Diff mode is unthreaded
863+
export THREADED=0
864+
865+
print_ln "no_log"
866+
if [[ -d "${LOG_DIR}" ]]; then
867+
print_output "[!] Diff mode started on ""$(date)" "main"
868+
print_output "$(indent "${NC}""1st Firmware binary path: ""${FIRMWARE_PATH}")" "main"
869+
print_output "$(indent "${NC}""2nd Firmware binary path: ""${FIRMWARE_PATH1}")" "main"
870+
else
871+
print_output "[!] Diff mode started on ""$(date)"
872+
print_output "$(indent "${NC}""1st Firmware binary path: ""${FIRMWARE_PATH}")" "no_log"
873+
print_output "$(indent "${NC}""2nd Firmware binary path: ""${FIRMWARE_PATH1}")" "no_log"
874+
fi
875+
write_notification "Diff mode started"
876+
877+
if [[ -f "${MOD_DIR_LOCAL}"/D10_firmware_diffing.sh ]]; then
878+
run_modules "D" "${THREADED}" "0"
879+
else
880+
if [[ -d "${LOG_DIR}" ]]; then
881+
print_output "[!] Diff mode currently not supported in this EMBA installation." "main"
882+
else
883+
print_output "[!] Diff mode currently not supported in this EMBA installation." "no_log"
884+
fi
885+
exit 1
886+
fi
887+
888+
if [[ -d "${LOG_DIR}" ]]; then
889+
print_output "[!] Diff mode ended on ""$(date)"" and took about ""$(show_runtime)"" \\n" "main"
890+
else
891+
print_output "[!] Diff mode ended on ""$(date)"" and took about ""$(show_runtime)"" \\n" "no_log"
892+
fi
893+
write_notification "Diff mode finished"
894+
895+
TESTING_DONE=1
896+
897+
fi
898+
847899
#######################################################################################
848900
# Firmware-Check (S modules)
849901
#######################################################################################
850902
WAIT_PIDS=()
851-
if [[ ${FIRMWARE} -eq 1 ]] ; then
903+
if [[ ${FIRMWARE} -eq 1 ]] && [[ "${DIFF_MODE}" -ne 1 ]]; then
852904
print_output "\n=================================================================\n" "no_log"
853905

854906
if [[ -d "${LOG_DIR}" ]]; then
@@ -878,7 +930,7 @@ main() {
878930
#######################################################################################
879931
# Live Emulation - Check (L-modules)
880932
#######################################################################################
881-
if [[ "${FULL_EMULATION}" -eq 1 ]] ; then
933+
if [[ "${FULL_EMULATION}" -eq 1 ]] && [[ "${DIFF_MODE}" -ne 1 ]]; then
882934
print_output "\n=================================================================\n" "no_log"
883935
if [[ -d "${LOG_DIR}" ]]; then
884936
print_output "[!] System emulation phase started on ""$(date)""\\n""$(indent "${NC}""Firmware path: ""${FIRMWARE_PATH}")" "main"

helpers/helpers_emba_defaults.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
set_defaults() {
2020
# if this is a release version set RELEASE to 1, add a banner to config/banner and name the banner with the version details
21-
export RELEASE=1
22-
export EMBA_VERSION="1.3.0"
21+
export RELEASE=0
22+
export EMBA_VERSION="1.3.x"
2323

2424
export CLEANED=0 # used for the final cleaner function for not running it multiple times
2525
export STRICT_MODE=0
@@ -89,7 +89,7 @@ set_defaults() {
8989
export EXT_DIR="$INVOCATION_PATH""/external"
9090
export HELP_DIR="$INVOCATION_PATH""/helpers"
9191
export MOD_DIR="$INVOCATION_PATH""/modules"
92-
export MOD_DIR_LOCAL="$INVOCATION_PATH""/modules_local"
92+
export MOD_DIR_LOCAL="$INVOCATION_PATH""/EMBA-Non-free/modules_local"
9393
export PID_LOGGING=0
9494
# this will be in TMP_DIR/pid_notes.log
9595
export PID_LOG_FILE="pid_notes.log"

helpers/helpers_emba_html_generator.sh

+55-18
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ SUBMODUL_LINK="<a class=\"submodul\" href=\"LINK\" title=\"LINK\" >"
5757
ANCHOR="<a class=\"anc\" id=\"ANCHOR\">"
5858
TITLE_ANCHOR="<a id=\"ANCHOR\">"
5959
LINK_END="</a>"
60-
IMAGE_LINK="<img class=\"image\" src=\".$STYLE_PATH/PICTURE\">"
60+
DEPTH="."
6161
ARACHNI_LINK="<a href=\"./l25_web_checks/arachni_report/index.html\" title=\"Arachni web report\" target=\"_blank\" >"
6262

6363

@@ -92,31 +92,47 @@ add_link_tags() {
9292
readarray -t REF_LINKS_L_NUMBER < <(grep -a -n -E '\[REF\].*' "$LINK_FILE" | cut -d':' -f1 )
9393
for REF_LINK_NUMBER in "${REF_LINKS_L_NUMBER[@]}" ; do
9494
REF_LINK="$(sed "$REF_LINK_NUMBER""q;d" "$LINK_FILE" | cut -c12- | cut -d'<' -f1 || true)"
95+
echo "REF_LINK out: $REF_LINK"
96+
echo "REF_LINK out cut: $(echo "$REF_LINK" | cut -d"#" -f1)"
9597
URL_REGEX='(www.|https?|ftp|file):\/\/'
9698
if [[ -f "$(echo "$REF_LINK" | cut -d"#" -f1)" ]] ; then
99+
echo "REF_LINK 1: $REF_LINK"
97100
if [[ ( ("${REF_LINK: -4}" == ".txt") || ("${REF_LINK: -4}" == ".log") ) || ( ("$REF_LINK" == *".txt#"*) || ("$REF_LINK" == *".log#"*) ) ]] ; then
101+
echo "REF_LINK 2: $REF_LINK"
98102
REF_ANCHOR=""
99103
if [[ ( ("$REF_LINK" == *".txt#"*) || ("$REF_LINK" == *".log#"*) ) ]] ; then
100104
REF_ANCHOR="$(echo "$REF_LINK" | cut -d"#" -f2 || true)"
101105
REF_LINK="$(echo "$REF_LINK" | cut -d"#" -f1 || true)"
102106
fi
107+
echo "REF_LINK 3: $REF_LINK"
103108
# generate reference file
104-
if [[ $THREADED -eq 1 ]]; then
105-
generate_info_file "$REF_LINK" "$BACK_LINK" &
106-
WAIT_PIDS_WR+=( "$!" )
107-
else
108-
generate_info_file "$REF_LINK" "$BACK_LINK"
109+
generate_info_file "$REF_LINK" "$BACK_LINK" &
110+
WAIT_PIDS_WR+=( "$!" )
111+
echo "REF_LINK 4: $REF_LINK"
112+
echo "REFERENCE_LINK: $REFERENCE_LINK"
113+
114+
# we need to handle deeper hyrarchies - this is suboptimal but works for now!
115+
# TODO: Currently it only works for the first subdirectory
116+
if [[ "$(echo "${REF_LINK}" | rev | cut -d '/' -f4- | rev)" == "${LOG_DIR}" ]]; then
117+
DEPTH=".."
118+
elif [[ "$(echo "${REF_LINK}" | rev | cut -d '/' -f3- | rev)" == "${LOG_DIR}" ]]; then
119+
DEPTH="."
109120
fi
121+
110122
if [[ -n "$REF_ANCHOR" ]] ; then
111-
HTML_LINK="$(echo "$REFERENCE_LINK" | sed -e "s@LINK@./$(echo "$BACK_LINK" | cut -d"." -f1)/$(basename "${REF_LINK%."${REF_LINK##*.}"}").html""#anchor_$REF_ANCHOR@g" || true)"
123+
HTML_LINK="$(echo "$REFERENCE_LINK" | sed -e "s@LINK@${DEPTH}/$(echo "$BACK_LINK" | cut -d"." -f1)/$(basename "${REF_LINK%."${REF_LINK##*.}"}").html""#anchor_$REF_ANCHOR@g" || true)"
112124
else
113-
HTML_LINK="$(echo "$REFERENCE_LINK" | sed -e "s@LINK@./$(echo "$BACK_LINK" | cut -d"." -f1)/$(basename "${REF_LINK%."${REF_LINK##*.}"}").html@g" || true)"
125+
HTML_LINK="$(echo "$REFERENCE_LINK" | sed -e "s@LINK@${DEPTH}/$(echo "$BACK_LINK" | cut -d"." -f1)/$(basename "${REF_LINK%."${REF_LINK##*.}"}").html@g" || true)"
114126
fi
127+
echo "REF_LINK: $REF_LINK"
128+
echo "REF_ANCHOR: $REF_ANCHOR"
129+
echo "HTML_LINK: $HTML_LINK"
115130
LINE_NUMBER_INFO_PREV="$(( REF_LINK_NUMBER - 1 ))"
116131
while [[ ("$(sed "$LINE_NUMBER_INFO_PREV""q;d" "$LINK_FILE")" == "$P_START$SPAN_END$P_END") || ("$(sed "$LINE_NUMBER_INFO_PREV""q;d" "$LINK_FILE")" == "$BR" ) ]] ; do
117132
LINE_NUMBER_INFO_PREV=$(( LINE_NUMBER_INFO_PREV - 1 ))
118133
done
119134
LINK_COMMAND_ARR+=( "$LINE_NUMBER_INFO_PREV"'s@^@'"$HTML_LINK"'@' "$LINE_NUMBER_INFO_PREV"'s@$@'"$LINK_END"'@')
135+
echo "LINK_COMMAND_ARR: ${LINK_COMMAND_ARR[*]}"
120136
elif [[ "${REF_LINK: -7}" == ".tar.gz" ]] ; then
121137
local RES_PATH
122138
RES_PATH="$ABS_HTML_PATH""/""$(echo "$BACK_LINK" | cut -d"." -f1 )""/res"
@@ -129,12 +145,29 @@ add_link_tags() {
129145
elif [[ "${REF_LINK: -4}" == ".png" ]] ; then
130146
LINE_NUMBER_INFO_PREV="$(grep -a -n -m 1 -E "\[REF\] ""$REF_LINK" "$LINK_FILE" | cut -d":" -f1 || true)"
131147
cp "$REF_LINK" "$ABS_HTML_PATH$STYLE_PATH""/""$(basename "$REF_LINK")" || true
148+
echo "png copy:"
149+
echo "LINK_FILE: $LINK_FILE"
150+
echo "ABS_HTML_PATH: $ABS_HTML_PATH"
151+
echo "STYLE_PATH: $STYLE_PATH"
152+
153+
echo "REF_LINK: $REF_LINK"
154+
echo "LOG_DIR: $LOG_DIR"
155+
echo "LOG_DIR? -> $(echo "${REF_LINK}" | rev | cut -d '/' -f2- | rev)"
156+
if [[ "$(echo "${REF_LINK}" | rev | cut -d '/' -f4- | rev)" == "${LOG_DIR}" ]]; then
157+
DEPTH=".."
158+
elif [[ "$(echo "${REF_LINK}" | rev | cut -d '/' -f3- | rev)" == "${LOG_DIR}" ]]; then
159+
DEPTH="."
160+
fi
161+
IMAGE_LINK="<img class=\"image\" src=\"${DEPTH}${STYLE_PATH}/PICTURE\">"
132162
HTML_LINK="$(echo "$IMAGE_LINK" | sed -e 's@PICTURE@'"$(basename "$REF_LINK")"'@' || true)"
163+
echo "IMAGE_LINK: $IMAGE_LINK"
164+
echo "HTML_LINK: $HTML_LINK"
133165
LINK_COMMAND_ARR+=( "$LINE_NUMBER_INFO_PREV"'s@$@'"$HTML_LINK"'@' )
166+
echo "LINK_COMMAND_ARR: ${LINK_COMMAND_ARR[*]}"
134167
fi
135-
elif [[ ("$REF_LINK" =~ ^(p|l|s|q|f){1}[0-9]{2,3}$ ) || ("$REF_LINK" =~ ^(p|l|s|q|f){1}[0-9]{2,3}\#.*$ ) ]] ; then
168+
elif [[ ("$REF_LINK" =~ ^(d|p|l|s|q|f){1}[0-9]{2,3}$ ) || ("$REF_LINK" =~ ^(d|p|l|s|q|f){1}[0-9]{2,3}\#.*$ ) ]] ; then
136169
REF_ANCHOR=""
137-
if [[ "$REF_LINK" =~ ^(p|l|s|q|f){1}[0-9]{2,3}\#.*$ ]] ; then
170+
if [[ "$REF_LINK" =~ ^(d|p|l|s|q|f){1}[0-9]{2,3}\#.*$ ]] ; then
138171
REF_ANCHOR="$(echo "$REF_LINK" | cut -d"#" -f2 || true)"
139172
REF_LINK="$(echo "$REF_LINK" | cut -d"#" -f1 || true)"
140173
fi
@@ -211,12 +244,12 @@ add_link_tags() {
211244
EXPLOIT_FILE="$LOG_DIR""/f20_vul_aggregator/exploit/""$EXPLOIT_ID"".txt"
212245
if [[ -f "$EXPLOIT_FILE" ]] ; then
213246
# generate exploit file
214-
if [[ $THREADED -eq 1 ]]; then
247+
#if [[ $THREADED -eq 1 ]]; then
215248
generate_info_file "$EXPLOIT_FILE" "$BACK_LINK" &
216249
WAIT_PIDS_WR+=( "$!" )
217-
else
218-
generate_info_file "$EXPLOIT_FILE" "$BACK_LINK"
219-
fi
250+
#else
251+
# generate_info_file "$EXPLOIT_FILE" "$BACK_LINK"
252+
#fi
220253
HTML_LINK="$(echo "$LOCAL_LINK" | sed -e "s@LINK@./$(echo "$BACK_LINK" | cut -d"." -f1 )/$EXPLOIT_ID.html@g")""$EXPLOIT_ID""$LINK_END"
221254
else
222255
HTML_LINK="$(echo "$EXPLOIT_LINK" | sed -e "s@LINK@$EXPLOIT_ID@g")""$EXPLOIT_ID""$LINK_END"
@@ -406,9 +439,7 @@ add_link_tags() {
406439
fi
407440
fi
408441

409-
if [[ $THREADED -eq 1 ]]; then
410-
wait_for_pid "${WAIT_PIDS_WR[@]}"
411-
fi
442+
wait_for_pid "${WAIT_PIDS_WR[@]}"
412443
if [[ -f "$LINK_FILE" ]]; then
413444
sed -i -E 's@^<pre>((\[REF\])|(\[ANC\])).*</pre>@@g' "$LINK_FILE" || true
414445
fi
@@ -425,6 +456,8 @@ generate_info_file()
425456
INFO_FILE=${1:-}
426457
SRC_FILE=${2:-}
427458
CUSTOM_SUB_PATH=${3:-}
459+
echo "generate_info_file - INFO_FILE $INFO_FILE"
460+
echo "generate_info_file - SRC_FILE $SRC_FILE"
428461

429462
INFO_HTML_FILE="$(basename "${INFO_FILE%."${INFO_FILE##*.}"}"".html")"
430463
if [[ -z "$CUSTOM_SUB_PATH" ]] ; then
@@ -449,6 +482,8 @@ generate_info_file()
449482
sed -i "$LINE_NUMBER_INFO_NAV""i""$NAV_INFO_BACK_LINK""&laquo; Back to ""$(basename "${SRC_FILE%.html}")""$LINK_END" "$INFO_PATH""/""$INFO_HTML_FILE"
450483
fi
451484

485+
echo "INFO_FILE: $INFO_FILE"
486+
echo "TMP_INFO_FILE: $TMP_INFO_FILE"
452487
cp "$INFO_FILE" "$TMP_INFO_FILE" 2>/dev/null || true
453488
sed -i -e 's@&@\&amp;@g ; s/@/\&commat;/g ; s@<@\&lt;@g ; s@>@\&gt;@g' "$TMP_INFO_FILE" || true
454489
sed -i '\@\[\*\]\ Statistics@d' "$TMP_INFO_FILE" || true
@@ -654,6 +689,8 @@ scan_report()
654689

655690
add_arrows()
656691
{
692+
local D_MODULE_ARR
693+
readarray -t D_MODULE_ARR < <(find "$ABS_HTML_PATH" -maxdepth 1 -name "*.html" | grep -a -E "./d[0-9]*.*" | sort -V || true)
657694
local P_MODULE_ARR
658695
readarray -t P_MODULE_ARR < <(find "$ABS_HTML_PATH" -maxdepth 1 -name "*.html" | grep -a -E "./p[0-9]*.*" | sort -V || true)
659696
local S_MODULE_ARR
@@ -665,7 +702,7 @@ add_arrows()
665702
local Q_MODULE_ARR
666703
readarray -t Q_MODULE_ARR < <(find "$ABS_HTML_PATH" -maxdepth 1 -name "*.html" | grep -a -E "./q[0-9]*.*" | sort -V || true)
667704
local ALL_MODULE_ARR
668-
ALL_MODULE_ARR=( "$ABS_HTML_PATH""/""$INDEX_FILE" "${P_MODULE_ARR[@]}" "${S_MODULE_ARR[@]}" "${Q_MODULE_ARR[@]}" "${L_MODULE_ARR[@]}" "${F_MODULE_ARR[@]}")
705+
ALL_MODULE_ARR=( "$ABS_HTML_PATH""/""$INDEX_FILE" "${D_MODULE_ARR[@]}" "${P_MODULE_ARR[@]}" "${S_MODULE_ARR[@]}" "${Q_MODULE_ARR[@]}" "${L_MODULE_ARR[@]}" "${F_MODULE_ARR[@]}")
669706
for M_NUM in "${!ALL_MODULE_ARR[@]}"; do
670707
if [[ "$M_NUM" -gt 0 ]] ; then
671708
FIRST_LINK="${ALL_MODULE_ARR[$(( M_NUM - 1 ))]}"

helpers/helpers_emba_parameter_parser.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
emba_parameter_parsing() {
20-
while getopts a:bBA:cC:d:De:Ef:Fghijk:l:m:N:p:P:QrsStT:UVxX:yY:WzZ: OPT ; do
20+
while getopts a:bBA:cC:d:De:Ef:Fghijk:l:m:N:o:p:P:QrsStT:UVxX:yY:WzZ: OPT ; do
2121
case "$OPT" in
2222
a)
2323
check_alnum "$OPTARG"
@@ -77,6 +77,7 @@ emba_parameter_parsing() {
7777
FIRMWARE_PATH="$(escape_echo "$OPTARG")"
7878
readonly FIRMWARE_PATH_BAK="$FIRMWARE_PATH" # as we rewrite the firmware path variable in the pre-checker phase
7979
export FIRMWARE_PATH_BAK # we store the original firmware path variable and make it readonly
80+
# for firmware diff option, see option o
8081
;;
8182
F)
8283
export FORCE=1
@@ -122,6 +123,13 @@ emba_parameter_parsing() {
122123
export FW_NOTES=""
123124
FW_NOTES="$(escape_echo "$OPTARG")"
124125
;;
126+
o)
127+
# other firmware file -> we do a diff check
128+
check_path_input "$OPTARG"
129+
export FIRMWARE=1
130+
export FIRMWARE_PATH1=""
131+
FIRMWARE_PATH1="$(escape_echo "$OPTARG")"
132+
;;
125133
p)
126134
check_path_input "$OPTARG"
127135
export PROFILE=""

0 commit comments

Comments
 (0)