Skip to content

Commit 1239736

Browse files
committed
Adding more details to the output
1 parent 5620e9a commit 1239736

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

FirewallRuleAnalysis/FirewallRuleAnalysis.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ try
6565
std::sort(normalizedServiceRules.begin(), normalizedServiceRules.end());
6666

6767
// find duplicates
68-
uint32_t totalDuplicateCount{};
68+
uint32_t rulesWithDuplicates{};
69+
uint32_t sumOfAllDuplicates{};
6970
std::vector<NormalizedRuleInfo>::iterator startingIterator = normalizedRules.begin();
7071
for (;;)
7172
{
@@ -74,7 +75,7 @@ try
7475
{
7576
break;
7677
}
77-
++totalDuplicateCount;
78+
++rulesWithDuplicates;
7879

7980
// find all duplicates of this instance
8081
auto localDuplicateIterator = duplicateRuleIterator;
@@ -89,15 +90,18 @@ try
8990
++localDuplicateRuleCount;
9091
++localDuplicateIterator;
9192
}
93+
94+
sumOfAllDuplicates += localDuplicateRuleCount;
9295
wprintf(L"\nDuplicate rule found! Duplicate count (%u)\n", localDuplicateRuleCount);
93-
// startingIterator is now updated to the next rule after the duplicates
96+
97+
// startingIterator is now updated to the next rule after the duplicates
9498
while (duplicateRuleIterator != startingIterator)
9599
{
96100
wprintf(L"\tname: %ws, description: %ws\n", duplicateRuleIterator->ruleName.get(), duplicateRuleIterator->ruleDescription.get());
97101
++duplicateRuleIterator;
98102
}
99103
}
100104

101-
wprintf(L"\n\nTotal rules: %llu\nTotal duplicate rules: %u\n", normalizedRules.size(), totalDuplicateCount);
105+
wprintf(L"\n\nTotal rules: %llu\nRules with duplicates: %u\nTotal of all duplicate rules: %u\n", normalizedRules.size(), rulesWithDuplicates, sumOfAllDuplicates);
102106
}
103107
CATCH_RETURN()

0 commit comments

Comments
 (0)