From 25cde9e2c731cf00d4c8e617282ebfe55cdbef24 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 12 Dec 2011 09:45:40 +0000 Subject: [PATCH] minor fixes --- lib/core/common.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index e0802c537..c025a1f8e 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -674,7 +674,7 @@ def paramToDict(place, parameters=None): if condition: testableParameters[parameter] = "=".join(elem[1:]) if testableParameters[parameter].strip(DUMMY_SQL_INJECTION_CHARS) != testableParameters[parameter]\ - or re.search(r'(\A-[1-9])|(\A9{3,})', testableParameters[parameter]): + or re.search(r'\A9{3,}', testableParameters[parameter]): errMsg = "you have provided tainted parameter values " errMsg += "(%s) with most probably leftover " % element errMsg += "chars from manual sql injection " @@ -1630,21 +1630,28 @@ def showStaticWords(firstPage, secondPage): firstPage = getFilteredPageContent(firstPage) secondPage = getFilteredPageContent(secondPage) - match = SequenceMatcher(None, firstPage, secondPage).find_longest_match(0, len(firstPage), 0, len(secondPage)) - commonText = firstPage[match[0]:match[0]+match[2]] - commonWords = getPageWordSet(commonText) infoMsg = "static words: " + if firstPage and secondPage: + match = SequenceMatcher(None, firstPage, secondPage).find_longest_match(0, len(firstPage), 0, len(secondPage)) + commonText = firstPage[match[0]:match[0]+match[2]] + commonWords = getPageWordSet(commonText) + else: + commonWords = None + if commonWords: commonWords = list(commonWords) commonWords.sort(lambda a, b: cmp(a.lower(), b.lower())) - for word in commonWords: - if len(word) > 2: - infoMsg += "'%s', " % word + for word in commonWords: + if len(word) > 2: + infoMsg += "'%s', " % word + + infoMsg = infoMsg.rstrip(", ") + else: + infoMsg += "None" - infoMsg = infoMsg.rstrip(", ") logger.info(infoMsg) def decloakToNamedTemporaryFile(filepath, name=None):