Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95dea1f

Browse files
committed
sharp tuning UNION tests even more
1 parent 74cc974 commit 95dea1f

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

lib/techniques/inband/union/test.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ def __findUnionCharCount(comment, place, parameter, value, prefix, suffix, where
7272
ratios.pop(ratios.index(min_))
7373
ratios.pop(ratios.index(max_))
7474

75-
deviation = stdev(ratios)
76-
77-
if abs(max_ - min_) < MIN_STATISTICAL_RANGE:
78-
kb.errorIsNone = popValue()
79-
return None
80-
81-
lower, upper = average(ratios) - UNION_STDEV_COEFF * deviation, average(ratios) + UNION_STDEV_COEFF * deviation
8275
minItem, maxItem = None, None
8376

8477
for item in items:
@@ -87,6 +80,20 @@ def __findUnionCharCount(comment, place, parameter, value, prefix, suffix, where
8780
elif item[1] == max_:
8881
maxItem = item
8982

83+
if all(map(lambda x: x == min_ and x != max_, ratios)):
84+
return maxItem[0]
85+
86+
elif all(map(lambda x: x != min_ and x == max_, ratios)):
87+
return minItem[0]
88+
89+
deviation = stdev(ratios)
90+
91+
if abs(max_ - min_) < MIN_STATISTICAL_RANGE:
92+
kb.errorIsNone = popValue()
93+
return None
94+
95+
lower, upper = average(ratios) - UNION_STDEV_COEFF * deviation, average(ratios) + UNION_STDEV_COEFF * deviation
96+
9097
if min_ < lower:
9198
retVal = minItem[0]
9299

0 commit comments

Comments
 (0)