Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unblob it in case binwalk fails #421

Merged
merged 3 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helpers/helpers_emba_dependency_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ dependency_check()
export MPLCONFIGDIR="$TMP_DIR"

setup_unblob "unblob"
check_dep_tool "unrar" "unrar"
setup_nikto

# jtr
Expand Down
2 changes: 2 additions & 0 deletions installer/IP99_binwalk_default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ IP99_binwalk_default() {
# python-setuptools is needed for ubireader installation
print_tool_info "python-setuptools" 1
print_tool_info "srecord" 1
print_tool_info "unrar-free" 1
print_tool_info "unrar" 1

print_pip_info "nose"
print_pip_info "coverage"
Expand Down
10 changes: 8 additions & 2 deletions modules/P61_unblob_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ P61_unblob_eval() {
print_output "[*] Unblob module currently enabled - disable it in emba.sh setting the UNBLOB variable to 0"

print_output "[!] INFO: This is an evaluation module for the extractor ${ORANGE}unblob - https://unblob.org/$MAGENTA."
print_output "[!] INFO: The results are currently not further used in the EMBA firmware analysis process (this will probably change in the future)."
print_output "[!] INFO: The results are currently only further used if the binwalk extraction process failes (this will probably change in the future)."

export LINUX_PATH_COUNTER_UNBLOB=0
local OUTPUT_DIR_UNBLOB="$LOG_PATH_MODULE"/unblob_extracted
Expand Down Expand Up @@ -104,7 +104,13 @@ P61_unblob_eval() {
print_output "[*] Found $ORANGE$BINS$NC binaries."
print_output "[*] Additionally the Linux path counter is $ORANGE$LINUX_PATH_COUNTER$NC."
print_bar
tree -sh "$OUTPUT_DIR_UNBLOB" | tee -a "$LOG_FILE"
if [[ "$LINUX_PATH_COUNTER" -eq 0 ]] && [[ "$LINUX_PATH_COUNTER_UNBLOB" -gt 0 ]]; then
print_output "[+] Binwalk extraction failed - using Unblob results as additional source for further analysis"
mv "$OUTPUT_DIR_UNBLOB" "$LOG_DIR"/firmware/ || true
detect_root_dir_helper "$LOG_DIR/firmware"
print_ln
fi
tree -sh "$LOG_DIR/firmware/unblob_extracted" | tee -a "$LOG_FILE"
print_ln
fi

Expand Down
2 changes: 2 additions & 0 deletions modules/S06_distribution_identification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ get_csv_rule_distri() {
# F5 BigIP
VERSION_IDENTIFIER="$(echo "$VERSION_IDENTIFIER" | sed -r 's/big-ip\ ltm\ ([0-9]+(\.[0-9]+)+?)/f5:big-ip_local_traffic_manager:\1/')"
VERSION_IDENTIFIER="$(echo "$VERSION_IDENTIFIER" | sed -r 's/big-ip\ asm\ ([0-9]+(\.[0-9]+)+?)/f5:big-ip_application_security_manager:\1/')"
# Yocto linux - e.g.: poky:(yocto:project:reference:distro):2.2:(morty)
VERSION_IDENTIFIER="$(echo "$VERSION_IDENTIFIER" | sed -r 's/.*\(yocto:project:reference:distro\):([0-9]+(\.[0-9]+)+?):\(.*\)$/yoctoproject:yocto:\1/')"
# Buildroot 2022.01.01
VERSION_IDENTIFIER="$(echo "$VERSION_IDENTIFIER" | sed -r 's/buildroot\ ([0-9]+(\.[0-9]+)+?)/buildroot:\1/')"
VERSION_IDENTIFIER="${VERSION_IDENTIFIER// /:}"
Expand Down