Skip to content

Commit

Permalink
retrieve: use grep -E instead of mawk for regex source
Browse files Browse the repository at this point in the history
tests: exit shellcheck if no scripts found
  • Loading branch information
jarelllama authored Feb 6, 2025
1 parent 3b0fa62 commit e15f2bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/retrieve_domains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ search_google() {
printf "%s\n" "$page_domains" >> "$source_results"

# Stop search term if no more pages are required
(( $(wc -w <<< "$page_domains") < 10 )) && break
(( $(wc -l <<< "$page_domains") < 10 )) && break
done

process_source_results
Expand Down Expand Up @@ -691,7 +691,7 @@ source_dga_detector() {
}

source_regex() {
# Last checked: 21/01/25
# Last checked: 06/02/25
source_name='Regex'
exclude_from_light=true

Expand All @@ -715,7 +715,7 @@ source_regex() {
local regex="${pattern//&/${escaped_domain}}"

# Get matches in NRD feed
results="$(mawk "/${regex}/" nrd.tmp | sort -u)"
results="$(grep -E "$regex" nrd.tmp | sort -u)"

# Collate results
printf "%s\n" "$results" >> source_results.tmp
Expand Down
2 changes: 2 additions & 0 deletions scripts/test_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ SHELLCHECK() {
# Find scripts
scripts=$(find . -type f -name "*.sh")

[[ -z "$scripts" ]] && error 'No scripts found.'

# Run ShellCheck for each script
for script in $scripts; do
shellcheck-stable/shellcheck "$script" || error=true
Expand Down

0 comments on commit e15f2bd

Please sign in to comment.