minor fixes

This commit is contained in:
Miroslav Stampar 2011-12-12 09:45:40 +00:00
parent 8fe72d87a8
commit 25cde9e2c7

View File

@ -674,7 +674,7 @@ def paramToDict(place, parameters=None):
if condition: if condition:
testableParameters[parameter] = "=".join(elem[1:]) testableParameters[parameter] = "=".join(elem[1:])
if testableParameters[parameter].strip(DUMMY_SQL_INJECTION_CHARS) != testableParameters[parameter]\ 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 = "you have provided tainted parameter values "
errMsg += "(%s) with most probably leftover " % element errMsg += "(%s) with most probably leftover " % element
errMsg += "chars from manual sql injection " errMsg += "chars from manual sql injection "
@ -1630,21 +1630,28 @@ def showStaticWords(firstPage, secondPage):
firstPage = getFilteredPageContent(firstPage) firstPage = getFilteredPageContent(firstPage)
secondPage = getFilteredPageContent(secondPage) 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: " 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: if commonWords:
commonWords = list(commonWords) commonWords = list(commonWords)
commonWords.sort(lambda a, b: cmp(a.lower(), b.lower())) commonWords.sort(lambda a, b: cmp(a.lower(), b.lower()))
for word in commonWords: for word in commonWords:
if len(word) > 2: if len(word) > 2:
infoMsg += "'%s', " % word infoMsg += "'%s', " % word
infoMsg = infoMsg.rstrip(", ")
else:
infoMsg += "None"
infoMsg = infoMsg.rstrip(", ")
logger.info(infoMsg) logger.info(infoMsg)
def decloakToNamedTemporaryFile(filepath, name=None): def decloakToNamedTemporaryFile(filepath, name=None):