diff --git a/blockcheck2.sh b/blockcheck2.sh index 6063e3a..73ef158 100755 --- a/blockcheck2.sh +++ b/blockcheck2.sh @@ -1184,6 +1184,29 @@ result_intersection_print() n=$(($n + 1)) done } +result_coverage_print() +{ + # Lists every distinct successful strategy together with how many of the + # DOMAINS_COUNT domains/targets it worked for, most-covered first. + # Unlike result_intersection_print, a strategy doesn't need 100% coverage + # to be listed here - useful when DOMAINS is a set of largely independent + # targets (e.g. one IP per ASN/provider) where no single strategy is + # expected to satisfy every one of them, and the question is which + # strategy gets closest. + local n=0 hash hashvar hashcountvar ct val + while : ; do + eval hash=\"\$RES_$n\" + [ -n "$hash" ] || break + hashvar=RESHASH_${hash} + hashcountvar=${hashvar}_COUNTER + eval ct=\"\$$hashcountvar\" + eval val=\"\$$hashvar\" + printf '%s %s\n' "$ct" "$val" + n=$(($n + 1)) + done | sort -rn | while IFS=' ' read -r ct rest; do + echo "$ct/$DOMAINS_COUNT : $rest" + done +} report_strategy() { # $1 - test function @@ -1931,10 +1954,13 @@ report_print echo \* COMMON result_intersection_print echo + echo \* COVERAGE + result_coverage_print + echo [ "$SCANLEVEL" = force ] || { echo "blockcheck optimizes test sequence. To save time some strategies can be skipped if their test is considered useless." - echo "That's why COMMON intersection can miss strategies that would work for all domains." - echo "Use \"force\" scan level to test all strategies and generate trustable intersection." + echo "That's why COMMON intersection can miss strategies that would work for all domains, and COVERAGE counts can undercount." + echo "Use \"force\" scan level to test all strategies and generate trustable results." echo "Current scan level was \"$SCANLEVEL\"". } } diff --git a/docs/manual.en.md b/docs/manual.en.md index 609bed0..a8446c0 100644 --- a/docs/manual.en.md +++ b/docs/manual.en.md @@ -4961,7 +4961,7 @@ The recommended way to use this is to copy it into its own subdirectory within ` ## Summary -At the end of the test, all successful strategies are displayed for each domain and each IP protocol version. If more than one domain was tested, the intersection of successful strategies (those that worked for all) is also provided. However, this intersection can only be fully relied upon when using `SCANLEVEL=force`. Otherwise, strategies that might have worked for subsequent domains might not have been tested for the first one. +At the end of the test, all successful strategies are displayed for each domain and each IP protocol version. If more than one domain was tested, the intersection of successful strategies (those that worked for all, labeled COMMON) is also provided, together with a COVERAGE listing of every successful strategy and how many of the domains it worked for, most-covered first - useful when testing a set of largely independent targets where no single strategy is expected to satisfy all of them. However, COMMON and the COVERAGE counts can only be fully relied upon when using `SCANLEVEL=force`. Otherwise, strategies that might have worked for subsequent domains might not have been tested for the first one. ## Shell variables diff --git a/docs/manual.md b/docs/manual.md index 64dd275..6c8925b 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -5149,7 +5149,7 @@ blockcheck2 будет выдавать параметры стратегий б ## Summary -В конце теста выдаются все успешные стратегии по каждому домену и каждой версии ip протокола. Если тестировалось более одного домена, дополнительно выдается пересечение успешных стратегий. Однако, ему можно полностью доверять только при использовании SCANLEVEL=force. Иначе возможна ситуация, когда для первого домена не стали тестировать стратегии, которые подошли бы для последующих. +В конце теста выдаются все успешные стратегии по каждому домену и каждой версии ip протокола. Если тестировалось более одного домена, дополнительно выдается пересечение успешных стратегий (те, что сработали для всех, блок COMMON), а также список COVERAGE - каждая успешная стратегия и число доменов, для которых она сработала, по убыванию - полезно, когда цели в DOMAINS во многом независимы друг от друга и ни одна стратегия не обязана подходить для всех сразу. Однако, и COMMON, и счетчики в COVERAGE можно полностью доверять только при использовании SCANLEVEL=force. Иначе возможна ситуация, когда для первого домена не стали тестировать стратегии, которые подошли бы для последующих. ## Shell переменные