From 31daefc7c909f9b754006c22177abed78ac68abf Mon Sep 17 00:00:00 2001 From: Miroslav Stampar <miroslav.stampar@gmail.com> Date: Tue, 5 Feb 2013 13:51:35 +0100 Subject: [PATCH 1/2] Minor fix (skipping one uneccesary request in single-threaded --first/--last mode) --- lib/techniques/blind/inference.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 4fd99bbb3..c0151c342 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -529,7 +529,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None else: val = getChar(index, asciiTbl) - if val is None or (lastChar > 0 and index > lastChar): + if val is None: finalValue = partialValue break @@ -548,6 +548,10 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None finalValue = partialValue[:-INFERENCE_BLANK_BREAK] break + if (lastChar > 0 and index >= lastChar): + finalValue = partialValue + break + except KeyboardInterrupt: abortedFlag = True finally: From 01219219fc1e31a72dafa03f1e84e4f1e068bb71 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar <miroslav.stampar@gmail.com> Date: Tue, 5 Feb 2013 15:03:55 +0100 Subject: [PATCH 2/2] Minor bug fix (for --first/--last through problematic DBMSes) --- lib/techniques/blind/inference.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index c0151c342..4291f4c7c 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -496,7 +496,6 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None dataToStdout(filterControlChars(commonValue[index - 1:])) finalValue = commonValue - break # If there is a common pattern starting with partialValue, @@ -549,7 +548,9 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None break if (lastChar > 0 and index >= lastChar): - finalValue = partialValue + finalValue = "" if length == 0 else partialValue + finalValue = finalValue.rstrip() if len(finalValue) > 1 else finalValue + partialValue = None break except KeyboardInterrupt: