From 7dc1bf0324e7692d9058e869f46e0df0b4024452 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 23 May 2010 21:32:51 +0000 Subject: [PATCH] quick (probably not final) fix for unicode inference (not yet tested) --- lib/techniques/blind/inference.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 94b42e804..844f36b40 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -147,8 +147,8 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None if result: return result - maxValue = asciiTbl[len(asciiTbl)-1] - minValue = 0 + maxChar = maxValue = asciiTbl[-1] + minValue = asciiTbl[0] while len(asciiTbl) != 1: queriesCount[0] += 1 @@ -179,8 +179,16 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None if len(asciiTbl) == 1: if maxValue == 1: return None + elif minValue == maxChar: + asciiTbl = range( maxChar + 1, (maxChar + 1) * 8 ) + maxChar = maxValue = asciiTbl[-1] + minValue = asciiTbl[0] else: - return chr(minValue + 1) + retVal = minValue + 1 + if retVal < 256: + return chr(retVal) + else: + return unichr(retVal) def etaProgressUpdate(charTime, index): if len(progressTime) <= ( (length * 3) / 100 ):