Skip to content

Commit 1f41f85

Browse files
committed
Replacing code integrity with code checksum mechanism
1 parent 171ebf2 commit 1f41f85

File tree

4 files changed

+17
-43
lines changed

4 files changed

+17
-43
lines changed

lib/core/common.py

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,33 +3848,6 @@ def decodeIntToUnicode(value):
38483848

38493849
return retVal
38503850

3851-
def checkIntegrity():
3852-
"""
3853-
Checks integrity of code files during the unhandled exceptions
3854-
"""
3855-
3856-
if not paths:
3857-
return
3858-
3859-
logger.debug("running code integrity check")
3860-
3861-
retVal = True
3862-
3863-
baseTime = os.path.getmtime(paths.SQLMAP_SETTINGS_PATH) + 3600 # First hour free parking :)
3864-
for root, _, filenames in os.walk(paths.SQLMAP_ROOT_PATH):
3865-
for filename in filenames:
3866-
if re.search(r"(\.py|\.xml|_)\Z", filename):
3867-
filepath = os.path.join(root, filename)
3868-
if os.path.getmtime(filepath) > baseTime:
3869-
logger.error("wrong modification time of '%s'" % filepath)
3870-
retVal = False
3871-
3872-
suffix = extractRegexResult(r"#(?P<result>\w+)", VERSION_STRING)
3873-
if suffix and suffix not in {"dev", "stable"}:
3874-
retVal = False
3875-
3876-
return retVal
3877-
38783851
def getDaysFromLastUpdate():
38793852
"""
38803853
Get total number of days from last update
@@ -5600,14 +5573,15 @@ def checkSums():
56005573

56015574
retVal = True
56025575

5603-
for entry in getFileItems(paths.DIGEST_FILE):
5604-
match = re.search(r"([0-9a-f]+)\s+([^\s]+)", entry)
5605-
if match:
5606-
expected, filename = match.groups()
5607-
filepath = os.path.join(paths.SQLMAP_ROOT_PATH, filename)
5608-
checkFile(filepath)
5609-
if not hashlib.sha256(open(filepath, "rb").read()).hexdigest() == expected:
5610-
retVal &= False
5611-
break
5576+
if paths.get("DIGEST_FILE"):
5577+
for entry in getFileItems(paths.DIGEST_FILE):
5578+
match = re.search(r"([0-9a-f]+)\s+([^\s]+)", entry)
5579+
if match:
5580+
expected, filename = match.groups()
5581+
filepath = os.path.join(paths.SQLMAP_ROOT_PATH, filename)
5582+
checkFile(filepath)
5583+
if not hashlib.sha256(open(filepath, "rb").read()).hexdigest() == expected:
5584+
retVal &= False
5585+
break
56125586

56135587
return retVal

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.8.3.3"
23+
VERSION = "1.8.3.4"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

sha256sums.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ f9c96cd3fe99578bed9d49a8bdf8d76836d320a7c48c56eb0469f48b36775c35 lib/controller
173173
99d0e94dd5fe60137abf48bfa051129fb251f5c40f0f7a270c89fbcb07323730 lib/controller/__init__.py
174174
826c33f1105be4c0985e1bbe1d75bdb009c17815ad6552fc8d9bf39090d3c40f lib/core/agent.py
175175
b2d69c99632da5c2acd0c0934e70d55862f1380a3f602cbe7456d617fb9c1fc9 lib/core/bigarray.py
176-
484c6a755451b20a45a2694b168fb279c000fec16ba53489614c90b726d42f98 lib/core/common.py
176+
9cf9eaca62cce2e9018b85b0359c825131b86c090d083c7e8bd0711cb1f007cd lib/core/common.py
177177
5c26b0f308266bc3a9679ef837439e38d1dc7a69eac6bd3422280f49aaf114d2 lib/core/compat.py
178178
b60c96780cad4a257f91a0611b08cfcc52f242908c5d5ab2bf9034ef07869602 lib/core/convert.py
179179
5e381515873e71c395c77df00bf1dd8c4592afc6210a2f75cbc20daf384e539f lib/core/data.py
@@ -195,7 +195,7 @@ bf77f9fc4296f239687297aee1fd6113b34f855965a6f690b52e26bd348cb353 lib/core/profi
195195
4eff81c639a72b261c8ba1c876a01246e718e6626e8e77ae9cc6298b20a39355 lib/core/replication.py
196196
bbd1dcda835934728efc6d68686e9b0da72b09b3ee38f3c0ab78e8c18b0ba726 lib/core/revision.py
197197
eed6b0a21b3e69c5583133346b0639dc89937bd588887968ee85f8389d7c3c96 lib/core/session.py
198-
dbf74242ba1b3bf6698e0e844dd1bf272d9786a6ca37cba6fa9ec5d5fbac700a lib/core/settings.py
198+
425d77598dda67fbe52e7ab5077791dda0038173845cc2d28dddc3e9cef66a4f lib/core/settings.py
199199
2bec97d8a950f7b884e31dfe9410467f00d24f21b35672b95f8d68ed59685fd4 lib/core/shell.py
200200
e90a359b37a55c446c60e70ccd533f87276714d0b09e34f69b0740fd729ddbf8 lib/core/subprocessng.py
201201
54f7c70b4c7a9931f7ff3c1c12030180bde38e35a306d5e343ad6052919974cd lib/core/target.py
@@ -485,7 +485,7 @@ e1745b85de63c04be89705f919830a0584464fd15d7dc61a0df0a7e9459d24c5 README.md
485485
6cfaaf6534688cecda09433246d0a8518f98ce5cf6d6a8159f24d70502cfc14f sqlmapapi.py
486486
168309215af7dd5b0b71070e1770e72f1cbb29a3d8025143fb8aa0b88cd56b62 sqlmapapi.yaml
487487
5e172e315524845fe091aa0b7b29303c92ac8f67594c6d50f026d627e415b7ed sqlmap.conf
488-
871cc04bf081b915b64e56934ddfdb0f3bd621d0fb0abe47460a7a5219db649e sqlmap.py
488+
7800faa964d1fc06bbca856ca35bf21d68f5e044ae0bd5d7dea16d625d585adb sqlmap.py
489489
adda508966db26c30b11390d6483c1fa25b092942a29730e739e1e50c403a21f tamper/0eunion.py
490490
d38fe5ab97b401810612eae049325aa990c55143504b25cc9924810917511dee tamper/apostrophemask.py
491491
8de713d1534d8cda171db4ceeb9f4324bcc030bbef21ffeaf60396c6bece31e4 tamper/apostrophenullencode.py

sqlmap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
from lib.core.data import logger
5151

5252
from lib.core.common import banner
53-
from lib.core.common import checkIntegrity
5453
from lib.core.common import checkPipedInput
54+
from lib.core.common import checkSums
5555
from lib.core.common import createGithubIssue
5656
from lib.core.common import dataToStdout
5757
from lib.core.common import extractRegexResult
@@ -268,7 +268,7 @@ def main():
268268
print()
269269
errMsg = unhandledExceptionMessage()
270270
excMsg = traceback.format_exc()
271-
valid = checkIntegrity()
271+
valid = checkSums()
272272

273273
os._exitcode = 255
274274

@@ -448,7 +448,7 @@ def main():
448448
raise SystemExit
449449

450450
elif valid is False:
451-
errMsg = "code integrity check failed (turning off automatic issue creation). "
451+
errMsg = "code checksum failed (turning off automatic issue creation). "
452452
errMsg += "You should retrieve the latest development version from official GitHub "
453453
errMsg += "repository at '%s'" % GIT_PAGE
454454
logger.critical(errMsg)

0 commit comments

Comments
 (0)