From 0340ecd38a0ba5c27ffb0873b8435f70e821aac4 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 18 Apr 2017 16:49:58 +0200 Subject: [PATCH] Minor patch related to the #2487 --- lib/core/common.py | 17 ++++++++++++++++- lib/core/settings.py | 2 +- txt/checksum.md5 | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index a057698ca..8ade3b2d6 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -3187,6 +3187,21 @@ def decodeIntToUnicode(value): return retVal +def md5File(filename): + """ + Calculates MD5 digest of a file + Reference: http://stackoverflow.com/a/3431838 + """ + + checkFile(filename) + + digest = hashlib.md5() + with open(filename, "rb") as f: + for chunk in iter(lambda: f.read(4096), ""): + digest.update(chunk) + + return digest.hexdigest() + def checkIntegrity(): """ Checks integrity of code files during the unhandled exceptions @@ -3203,7 +3218,7 @@ def checkIntegrity(): if not os.path.isfile(path): logger.error("missing file detected '%s'" % path) retVal = False - elif hashlib.md5(open(path, 'rb').read()).hexdigest() != checksum: + elif md5File(path) != checksum: logger.error("wrong checksum of file '%s' detected" % path) retVal = False return retVal diff --git a/lib/core/settings.py b/lib/core/settings.py index 64b374400..c0f012911 100755 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.1.4.33" +VERSION = "1.1.4.34" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 9307002d3..ccbe0bc93 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -27,7 +27,7 @@ fc89abe14a48b8232feba692bde992be lib/controller/controller.py 310efc965c862cfbd7b0da5150a5ad36 lib/controller/__init__.py d3b4e1139bf117fe4cf6451d43d8253c lib/core/agent.py 6cc95a117fbd34ef31b9aa25520f0e31 lib/core/bigarray.py -6d4efa61cbef2ff62ed457bc5c4708c3 lib/core/common.py +1ec36b759f46d8ccb1f4e1434d86b115 lib/core/common.py 5065a4242a8cccf72f91e22e1007ae63 lib/core/convert.py a8143dab9d3a27490f7d49b6b29ea530 lib/core/data.py 7936d78b1a7f1f008ff92bf2f88574ba lib/core/datatype.py @@ -46,7 +46,7 @@ ede9841e7cbbe841f41588f149e85789 lib/core/option.py d8e9250f3775119df07e9070eddccd16 lib/core/replication.py 785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py 40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py -a6219d0ee81bc23614150f81ccb6d8a0 lib/core/settings.py +95062a1d8876adc28b63bb987f6c0c57 lib/core/settings.py d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py 2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py 92e35ddfdf0e9676dd51565bcf4fa5cf lib/core/target.py