Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jarelllama authored Mar 22, 2024
1 parent a4cebe1 commit ce64b78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ function check_raw_file {
log_event "$domains_in_toplist" "toplist"
fi

clean_domain_log # Clean domain log

tr -s '\n' < filter_log.tmp | sort -u > temp.tmp && mv temp.tmp filter_log.tmp # Remove empty lines, sort and remove duplicates (note filter log has whitespaces)
[[ ! -s filter_log.tmp ]] && exit # Exit if no domains were filtered

Expand Down Expand Up @@ -133,12 +135,11 @@ function check_raw_file {
after_count=$(wc -w <<< "$domains") # Count number of domains after filtering
printf "\nBefore: %s After: %s Subdomains: %s Whitelisted: %s Invalid %s Redundant: %s Toplist: %s\n\n" "$before_count" "$after_count" "$domains_with_subdomains_count" "$total_whitelisted_count" "$invalid_entries_count" "$redundant_domains_count" "$in_toplist_count"

clean_domain_log
[[ -s filter_log.tmp ]] && exit 1 || exit 0 # Exit with error if the blocklist required filtering
}

function clean_domain_log {
[[ $(wc -w < "$domain_log") -gt 10000 ]] && sed -i '1,200d' "$domain_log"
[[ $(wc -w < "$domain_log") -gt 10000 ]] && sed -i '1,200d' "$domain_log" || printf "" # printf to return 0
}

function log_event {
Expand Down
4 changes: 2 additions & 2 deletions dead.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function main {
check_subdomains
check_redundant
check_for_dead
#clean_dead_domains_file
clean_dead_domains_file
}

function check_for_alive {
Expand Down Expand Up @@ -83,7 +83,7 @@ function check_for_dead {
}

function clean_dead_domains_file {
[[ $(wc -w < "$dead_domains_file") -gt 5000 ]] && sed -i '1,100d' "$dead_domains_file"
[[ $(wc -w < "$dead_domains_file") -gt 5000 ]] && sed -i '1,100d' "$dead_domains_file" || printf "" # printf to return 0
}

function log_event {
Expand Down

0 comments on commit ce64b78

Please sign in to comment.