diff --git a/extra/keepalive/keepalive.py b/extra/keepalive/keepalive.py index 867f7f0c1..6d35597e0 100644 --- a/extra/keepalive/keepalive.py +++ b/extra/keepalive/keepalive.py @@ -324,7 +324,7 @@ class HTTPConnection(httplib.HTTPConnection): else: raise CannotSendHeader() - for header in ['Host', 'Accept-Encoding']: + for header in ('Host', 'Accept-Encoding'): if header in self._headers: str = '%s: %s' % (header, self._headers[header]) self._output(str) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 59d03ce0e..90d215fd5 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -138,8 +138,8 @@ def checkSqlInjection(place, parameter, value): # Skip tests if title is not included by the given filter if conf.tstF: - if not any(re.search(conf.tstF, str(item), re.I) for item in [test.title, test.vector,\ - test.details.dbms if "details" in test and "dbms" in test.details else ""]): + if not any(re.search(conf.tstF, str(item), re.I) for item in (test.title, test.vector,\ + test.details.dbms if "details" in test and "dbms" in test.details else "")): debugMsg = "skipping test '%s' because " % title debugMsg += "its name/vector/dbms is not included by the given filter" logger.debug(debugMsg) diff --git a/lib/core/common.py b/lib/core/common.py index cd71a676b..7d10017df 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -2273,12 +2273,7 @@ def getTechniqueData(technique=None): Returns injection data for technique specified """ - retVal = None - - if technique and technique in kb.injection.data: - retVal = kb.injection.data[technique] - - return retVal + return kb.injection.data.get(technique) def isTechniqueAvailable(technique): """ @@ -2645,10 +2640,7 @@ def normalizeUnicode(value): Reference: http://www.peterbe.com/plog/unicode-to-ascii """ - retVal = value - if isinstance(value, unicode): - retVal = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') - return retVal + return unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') if isinstance(value, unicode) else value def safeSQLIdentificatorNaming(name, isTable=False): """ @@ -2911,6 +2903,7 @@ def asciifyUrl(url, forceQuote=False): if password: netloc = ':' + password + netloc netloc = username + netloc + if parts.port: netloc += ':' + str(parts.port) @@ -2942,7 +2935,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False): try: forms = ParseResponse(response, backwards_compat=False) except ParseError: - warnMsg = "badly formed HTML at the given url ('%s'). Will try to filter it" % url + warnMsg = "badly formed HTML at the given url ('%s'). Going to filter it" % url logger.warning(warnMsg) response.seek(0) filtered = _("".join(re.findall(r"