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

Skip to content

Commit ecbeecd

Browse files
committed
minor refactoring
1 parent eb9b84d commit ecbeecd

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

lib/techniques/inband/union/test.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,21 @@ def __findUnionCharCount(comment, place, parameter, value, prefix, suffix, where
8181
maxItem = item
8282

8383
if all(map(lambda x: x == min_ and x != max_, ratios)):
84-
return maxItem[0]
84+
retVal = maxItem[0]
8585

8686
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
87+
retVal = minItem[0]
9488

95-
lower, upper = average(ratios) - UNION_STDEV_COEFF * deviation, average(ratios) + UNION_STDEV_COEFF * deviation
89+
elif abs(max_ - min_) >= MIN_STATISTICAL_RANGE:
90+
deviation = stdev(ratios)
91+
lower, upper = average(ratios) - UNION_STDEV_COEFF * deviation, average(ratios) + UNION_STDEV_COEFF * deviation
9692

97-
if min_ < lower:
98-
retVal = minItem[0]
93+
if min_ < lower:
94+
retVal = minItem[0]
9995

100-
if max_ > upper:
101-
if retVal is None or abs(max_ - upper) > abs(min_ - lower):
102-
retVal = maxItem[0]
96+
if max_ > upper:
97+
if retVal is None or abs(max_ - upper) > abs(min_ - lower):
98+
retVal = maxItem[0]
10399

104100
kb.errorIsNone = popValue()
105101

0 commit comments

Comments
 (0)