From be5ce760b64c4b8d319f75ed11cd5b1c1426da6d Mon Sep 17 00:00:00 2001 From: stamparm Date: Tue, 9 Jul 2013 10:24:48 +0200 Subject: [PATCH] Fix for an Issue #485 (failing back to single-thread mode if over some bisection length) --- lib/core/settings.py | 3 +++ lib/techniques/blind/inference.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/core/settings.py b/lib/core/settings.py index f06022a50a..67d4dc1531 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -481,6 +481,9 @@ # Maximum response total page size (trimmed if larger) MAX_CONNECTION_TOTAL_SIZE = 100 * 1024 * 1024 +# Maximum (multi-threaded) length of entry in bisection algorithm +MAX_BISECTION_LENGTH = 50 * 1024 * 1024 + # Mark used for trimming unnecessary content in large chunks LARGE_CHUNK_TRIM_MARKER = "__TRIMMED_CONTENT__" diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index e576366f86..d933ffbc54 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -40,6 +40,7 @@ from lib.core.settings import INFERENCE_GREATER_CHAR from lib.core.settings import INFERENCE_EQUALS_CHAR from lib.core.settings import INFERENCE_NOT_EQUALS_CHAR +from lib.core.settings import MAX_BISECTION_LENGTH from lib.core.settings import MAX_TIME_REVALIDATION_STEPS from lib.core.settings import PARTIAL_HEX_VALUE_MARKER from lib.core.settings import PARTIAL_VALUE_MARKER @@ -135,6 +136,9 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None if length and (lastChar > 0 or firstChar > 0): length = min(length, lastChar or length) - firstChar + if length and length > MAX_BISECTION_LENGTH: + length = None + showEta = conf.eta and isinstance(length, int) numThreads = min(conf.threads, length)