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

Avoiding /proc and /sys paths (-xdev) in symlink script and check for missing symlinks in s115 #590

Merged
merged 2 commits into from
Apr 20, 2023
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
5 changes: 4 additions & 1 deletion helpers/fix_bins_lnk_emulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ fi

echo ""
echo "[*] Identifying possible dead symlinks"
mapfile -t POSSIBLE_DEAD_SYMLNKS < <(find "." -type f) # -exec file {} \; | grep "data\|ASCII\ text" | cut -d: -f1)
mapfile -t POSSIBLE_DEAD_SYMLNKS < <(find "." -xdev -type f) # -exec file {} \; | grep "data\|ASCII\ text" | cut -d: -f1)

for POSSIBLE_DEAD_SYMLNK in "${POSSIBLE_DEAD_SYMLNKS[@]}"; do
if [[ "$POSSIBLE_DEAD_SYMLNK" == *"/proc/"* ]]; then
continue
fi
DIR_ORIG_FILE=""
if [[ "$(strings "$POSSIBLE_DEAD_SYMLNK" | wc -l)" -gt 1 ]]; then
continue
Expand Down
4 changes: 2 additions & 2 deletions modules/S115_usermode_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ S115_usermode_emulator() {
print_ln
NEG_LOG=1
print_output "[*] Detected root path: $ORANGE$R_PATH$NC"
if [[ -f "$HELP_DIR"/fix_bins_lnk_emulation.sh ]]; then
print_output "[*] Starting link fixing helper ..."
if [[ -f "$HELP_DIR"/fix_bins_lnk_emulation.sh ]] && [[ $(find "$R_PATH" -type l | wc -l) -lt 10 ]]; then
print_output "[*] No symlinks found in firmware ... Starting link fixing helper ..."
"$HELP_DIR"/fix_bins_lnk_emulation.sh "$R_PATH"
fi
# MD5_DONE_INT is the array of all MD5 checksums for all root paths -> this is needed to ensure that we do not test bins twice
Expand Down