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

force utf8 for htmls #964

Merged
merged 6 commits into from
Dec 18, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.2-d127c9c3
1.3.2-e02b7305
23 changes: 23 additions & 0 deletions helpers/helpers_emba_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,26 @@ disk_space_monitor() {
sleep 5
done
}

safe_logging() {
# forced utf8 logging into file
# $1 File to log into
# $2 suppress stdout
# Example/test:
# printf "%b" 'Hi from foo\n' |& safe_logging ./test.log 0
# printf "%b" '\xE2\x98\xA0\n' |& safe_logging ./test.log
# printf "%b" '\xF5\xFF\n' |& safe_logging ./test.log
# printf "%b" 'end from bar\n' |& safe_logging ./test.log 1
local lLOG_FILE_="${1:-}"
local lALT_OUT_="${2:-}"
local lINPUT_

## Force UTF-8 charset
while read -r lINPUT_; do
if [[ "${lALT_OUT_}" -eq 1 ]]; then
echo "${lINPUT_}" | iconv -c --to-code=UTF-8 >> "${lLOG_FILE_}"
else
echo "${lINPUT_}" | iconv -c --to-code=UTF-8 | tee -a "${lLOG_FILE_}"
fi
done
}
4 changes: 2 additions & 2 deletions modules/S109_jtr_local_pw_cracking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ S109_jtr_local_pw_cracking()
print_ln
if [[ -f "${JTR_WORDLIST}" ]]; then
print_output "[*] Starting jtr with the following wordlist: ${ORANGE}${JTR_WORDLIST}${NC} with ${ORANGE}$(wc -l "${JTR_WORDLIST}" | awk '{print $1}')${NC} entries."
john --progress-every=120 --wordlist="${JTR_WORDLIST}" "${LOG_PATH_MODULE}"/jtr_hashes.txt 2>&1 | tee -a "${LOG_FILE}" || true &
john --progress-every=120 --wordlist="${JTR_WORDLIST}" "${LOG_PATH_MODULE}"/jtr_hashes.txt |& safe_logging "${LOG_FILE}" 0 || true &
PID="$!"
else
john --progress-every=120 "${LOG_PATH_MODULE}"/jtr_hashes.txt 2>&1 | tee -a "${LOG_FILE}" || true &
john --progress-every=120 "${LOG_PATH_MODULE}"/jtr_hashes.txt |& safe_logging "${LOG_FILE}" 0 || true &
PID="$!"
fi
sleep 5
Expand Down
2 changes: 1 addition & 1 deletion modules/S99_grepit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ grepit_search() {
fi

ulimit -Sv "${MEM_LIMIT}"
"${GREP_COMMAND}" "${ARGS_FOR_GREP[@]}" "${STANDARD_GREP_ARGUMENTS[@]}" -- "${SEARCH_REGEX}" "${FIRMWARE_PATH}" >> "${LOG_PATH_MODULE}/${OUTFILE}" 2>&1 || true
"${GREP_COMMAND}" "${ARGS_FOR_GREP[@]}" "${STANDARD_GREP_ARGUMENTS[@]}" -- "${SEARCH_REGEX}" "${FIRMWARE_PATH}" |& safe_logging "${LOG_PATH_MODULE}/${OUTFILE}" 0 || true
ulimit -Sv unlimited

if [[ "${LOG_DETAILS}" -eq 1 ]]; then
Expand Down