From e3134cc96514ad4647cdb9a2e9f5091bb2d69199 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 5 Jan 2019 23:14:28 +0100 Subject: [PATCH] Final preparation for 1.3 --- lib/core/settings.py | 2 +- lib/core/testing.py | 64 +++++++++++++++++++++++--------------------- txt/checksum.md5 | 4 +-- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index a25b3b6a7..505c72a8f 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -675,7 +675,7 @@ VALID_TIME_CHARS_RUN_THRESHOLD = 100 CHECK_ZERO_COLUMNS_THRESHOLD = 10 # Boldify all logger messages containing these "patterns" -BOLD_PATTERNS = ("' injectable", "provided empty", "leftover chars", "might be injectable", "' is vulnerable", "is not injectable", "does not seem to be", "test failed", "test passed", "live test final result", "test shows that", "the back-end DBMS is", "created Github", "blocked by the target server", "protection is involved", "CAPTCHA", "specific response", "NULL connection is supported") +BOLD_PATTERNS = ("' injectable", "provided empty", "leftover chars", "might be injectable", "' is vulnerable", "is not injectable", "does not seem to be", "test failed", "test passed", "live test final result", "test shows that", "the back-end DBMS is", "created Github", "blocked by the target server", "protection is involved", "CAPTCHA", "specific response", "NULL connection is supported", "PASSED", "FAILED") # Generic www root directory names GENERIC_DOC_ROOT_DIRECTORY_NAMES = ("htdocs", "httpdocs", "public", "wwwroot", "www") diff --git a/lib/core/testing.py b/lib/core/testing.py index 2b121bf68..6f8a92a67 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -17,6 +17,7 @@ import traceback from extra.beep.beep import beep from lib.controller.controller import start +from lib.core.common import checkIntegrity from lib.core.common import clearConsoleLine from lib.core.common import dataToStdout from lib.core.common import getUnicode @@ -51,41 +52,44 @@ def smokeTest(): retVal = True count, length = 0, 0 - for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): - if any(_ in root for _ in ("thirdparty", "extra")): - continue + if not checkIntegrity(): + retVal = False + else: + for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): + if any(_ in root for _ in ("thirdparty", "extra")): + continue - for filename in files: - if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": - length += 1 + for filename in files: + if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": + length += 1 - for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): - if any(_ in root for _ in ("thirdparty", "extra")): - continue + for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): + if any(_ in root for _ in ("thirdparty", "extra")): + continue - for filename in files: - if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": - path = os.path.join(root, os.path.splitext(filename)[0]) - path = path.replace(paths.SQLMAP_ROOT_PATH, '.') - path = path.replace(os.sep, '.').lstrip('.') - try: - __import__(path) - module = sys.modules[path] - except Exception, msg: - retVal = False - dataToStdout("\r") - errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, filename), msg) - logger.error(errMsg) - else: - # Run doc tests - # Reference: http://docs.python.org/library/doctest.html - (failure_count, test_count) = doctest.testmod(module) - if failure_count > 0: + for filename in files: + if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": + path = os.path.join(root, os.path.splitext(filename)[0]) + path = path.replace(paths.SQLMAP_ROOT_PATH, '.') + path = path.replace(os.sep, '.').lstrip('.') + try: + __import__(path) + module = sys.modules[path] + except Exception, msg: retVal = False + dataToStdout("\r") + errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, filename), msg) + logger.error(errMsg) + else: + # Run doc tests + # Reference: http://docs.python.org/library/doctest.html + (failure_count, test_count) = doctest.testmod(module) + if failure_count > 0: + retVal = False - count += 1 - status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length)) - dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) + count += 1 + status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length)) + dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) clearConsoleLine() if retVal: diff --git a/txt/checksum.md5 b/txt/checksum.md5 index c27c12775..47d6c96cc 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -49,11 +49,11 @@ fe370021c6bc99daf44b2bfc0d1effb3 lib/core/patch.py 9a7d68d5fa01561500423791f15cc676 lib/core/replication.py 3179d34f371e0295dd4604568fb30bcd lib/core/revision.py d6269c55789f78cf707e09a0f5b45443 lib/core/session.py -43ee2f1b9e898fa8e9788b921f278609 lib/core/settings.py +c799d8dee38e2da35b8aff0638f21129 lib/core/settings.py a8a7501d1e6b21669b858a62e921d191 lib/core/shell.py 5dc606fdf0afefd4b305169c21ab2612 lib/core/subprocessng.py eec3080ba5baca44c6de4595f1c92a0d lib/core/target.py -a057a8ae12fd21f6c409feee1266e7ad lib/core/testing.py +2f87870562ac9a79a5105a0e20fdbf9a lib/core/testing.py 5ebd996b2a77449df90320847e30a073 lib/core/threads.py 2c263c8610667fdc593c50a35ab20f57 lib/core/unescaper.py 5bd7cd6553a4a1c85cbaaddc268108e4 lib/core/update.py