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

Improve PW cracking module s107 #773

Merged
merged 4 commits into from
Sep 5, 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: 2 additions & 0 deletions config/trickest_blacklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ jasnow/585-652-ruby-advisory-db
pvergain/github-stars
scordero1234/java_sec_demo-main
BFHS-Robotics/BFHS-
Kuromesi/Py4CSKG
scmanjarrez/CVEScannerV2
11 changes: 7 additions & 4 deletions modules/S107_deep_password_search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ S107_deep_password_search()
local PW_HASH_CONFIG="$CONFIG_DIR"/password_regex.cfg
local PW_COUNTER=0
local PW_PATH=""
local PW_HASHES=()
local PW_HASH=""

find "$FIRMWARE_PATH" -xdev -type f -exec grep --color -n -a -E -H -f "$PW_HASH_CONFIG" {} \; > "$TMP_DIR"/pw_hashes.txt
Expand All @@ -32,10 +33,12 @@ S107_deep_password_search()
write_csv_log "PW_PATH" "PW_HASH"
while read -r PW_HASH; do
PW_PATH=$(echo "$PW_HASH" | cut -d: -f1)
PW_HASH=$(echo "$PW_HASH" | cut -d: -f2- | sed -r "s/[[:blank:]]+/\ /g")
print_output "[+] PATH: $ORANGE$(print_path "$PW_PATH")$GREEN\t-\tHash: $ORANGE$PW_HASH$GREEN."
write_csv_log "$PW_PATH" "$PW_HASH"
((PW_COUNTER+=1))
mapfile -t PW_HASHES < <(strings "$PW_PATH" | grep --color -a -E -f "$PW_HASH_CONFIG")
for PW_HASH in "${PW_HASHES[@]}"; do
print_output "[+] PATH: $ORANGE$(print_path "$PW_PATH")$GREEN\t-\tHash: $ORANGE$PW_HASH$GREEN."
write_csv_log "NA" "$PW_PATH" "$PW_HASH"
((PW_COUNTER+=1))
done
done < "$TMP_DIR"/pw_hashes.txt

print_ln
Expand Down
12 changes: 10 additions & 2 deletions modules/S109_jtr_local_pw_cracking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ S109_jtr_local_pw_cracking()
module_log_init "${FUNCNAME[0]}"

local PW_FILE="$CSV_DIR"/s108_stacs_password_search.csv
local PW_FILE_S107="$CSV_DIR"/s107_deep_password_search.csv
local NEG_LOG=0
local HASHES_S107=()
local HASHES_S108=()
local HASHES=()
local HASH=""
local HASH_SOURCE=""
Expand All @@ -33,15 +36,20 @@ S109_jtr_local_pw_cracking()
# optional wordlist for JTR - if no wordlist is there JTR runs in default mode
local JTR_WORDLIST="$CONFIG_DIR/jtr_wordlist.txt"

# This module waits for S108_stacs_password_search
# This module waits for S108_stacs_password_search and S107_deep_password_search
# check emba.log for S108_stacs_password_search starting
module_wait "S107_deep_password_search"
module_wait "S108_stacs_password_search"

module_title "Cracking identified password hashes"
pre_module_reporter "${FUNCNAME[0]}"

if [[ -f "$PW_FILE" ]]; then
mapfile -t HASHES < <(cut -d\; -f1,2,3 "$PW_FILE" | grep -v "PW_PATH;PW_HASH" | sort -k 2 -t \; -u)
mapfile -t HASHES_S108 < <(cut -d\; -f1,2,3 "$PW_FILE" | grep -v "PW_PATH;PW_HASH" | sort -k 2 -t \; -u)
mapfile -t HASHES_S107 < <(cut -d\; -f1,2,3 "$PW_FILE_S107" | grep -v "PW_HASH" | sort -k 2 -t \; -u)

HASHES=("${HASHES_S107[@]}" "${HASHES_S108[@]}")

for HASH in "${HASHES[@]}"; do
HASH_DESCRIPTION=$(basename "$(echo "$HASH" | cut -d\; -f1)")
HASH_SOURCE=$(basename "$(echo "$HASH" | cut -d\; -f2)")
Expand Down