From 7ce3af68fc5ddd4f10a11fac1e4696f869b1786f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 27 Oct 2011 17:31:34 +0000 Subject: [PATCH] fixing support for parsing BURP logs --- doc/THANKS | 3 +++ lib/core/option.py | 13 ++++++++----- lib/core/settings.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/THANKS b/doc/THANKS index 5e470126d..3b8d157d3 100644 --- a/doc/THANKS +++ b/doc/THANKS @@ -417,6 +417,9 @@ Andrea Rossi for reporting a minor bug for suggesting a feature +Mathew Rowley + for reporting a bug + Frederic Roy for reporting a couple of bugs diff --git a/lib/core/option.py b/lib/core/option.py index 066212f39..c263e6fe2 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -99,7 +99,7 @@ from lib.core.settings import FIREBIRD_ALIASES from lib.core.settings import MAXDB_ALIASES from lib.core.settings import SYBASE_ALIASES from lib.core.settings import DB2_ALIASES -from lib.core.settings import BURP_SPLITTER +from lib.core.settings import BURP_REQUEST_REGEX from lib.core.settings import LOCALHOST from lib.core.settings import MAX_NUMBER_OF_THREADS from lib.core.settings import PARAMETER_SPLITTING_REGEX @@ -211,20 +211,23 @@ def __feedTargetsDict(reqFile, addedTargetUrls): port = None scheme = None - reqResList = content.split(BURP_SPLITTER) + reqResList = re.findall(BURP_REQUEST_REGEX, content, re.I | re.S) + + if not reqResList: + reqResList = [content] for request in reqResList: if scheme is None: - schemePort = re.search("\d\d[\:|\.]\d\d[\:|\.]\d\d\s+(http[\w]*)\:\/\/.*?\:([\d]+)", request, re.I) + schemePort = re.search("(http[\w]*)\:\/\/.*?\:([\d]+).+?={10,}", request, re.I | re.S) if schemePort: scheme = schemePort.group(1) port = schemePort.group(2) - if not re.search ("^[\n]*(GET|POST).*?\sHTTP\/", request, re.I): + if not re.search ("^[\n]*(GET|POST).*?\sHTTP\/", request, re.I | re.M): continue - if re.search("^[\n]*(GET|POST).*?\.(gif|jpg|png)\sHTTP\/", request, re.I): + if re.search("^[\n]*(GET|POST).*?\.(gif|jpg|png)\sHTTP\/", request, re.I | re.M): continue getPostReq = False diff --git a/lib/core/settings.py b/lib/core/settings.py index 67d9ab428..2989c5d9e 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -267,7 +267,7 @@ COMMON_PASSWORD_SUFFIXES += ["!", ".", "*", "!!", "?", ";", "..", "!!!", ",", "@ WEBSCARAB_SPLITTER = "### Conversation" # Splitter used between requests in BURP log files -BURP_SPLITTER = "======================================================" +BURP_REQUEST_REGEX = r"={10,}\s+[^=]+={10,}\s+.+?={10,}" # Encoding used for Unicode data UNICODE_ENCODING = "utf8"