mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-07 09:26:00 -10:00
Fixes #6170
This commit is contained in:
1 parent
8476cf4d09
commit
bf8b9956e0
3 files changed
+17
-1
No files matched your search
@@ -125,6 +125,9 @@ def _serializeEncode(value):
|
||||
if isinstance(value, decimal.Decimal):
|
||||
return {_SERIALIZE_TAG: "dec", "v": getUnicode(value)}
|
||||
|
||||
if isinstance(value, (datetime.datetime, datetime.time)) and value.tzinfo is not None:
|
||||
return getUnicode(value) # Note: time zone aware value (e.g. from '-d' connector) kept as displayed, as an arbitrary tzinfo can't be rebuilt
|
||||
|
||||
if isinstance(value, datetime.datetime):
|
||||
return {_SERIALIZE_TAG: "dt", "v": [value.year, value.month, value.day, value.hour, value.minute, value.second, value.microsecond]}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import OS
|
||||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.11.3"
|
||||
VERSION = "1.10.11.4"
|
||||
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)
|
||||
|
||||
@@ -259,6 +259,19 @@ class TestDbmsScalars(unittest.TestCase):
|
||||
self.assertEqual(restored, value)
|
||||
self.assertIs(type(restored), type(value))
|
||||
|
||||
def test_timezone_aware_kept_as_displayed(self):
|
||||
# Note: a resumed '-d' session used to drop the offset (e.g. '+05:30'), as only naive fields got stored
|
||||
class _Offset(datetime.tzinfo):
|
||||
def utcoffset(self, dt):
|
||||
return datetime.timedelta(hours=5, minutes=30)
|
||||
|
||||
def dst(self, dt):
|
||||
return datetime.timedelta(0)
|
||||
|
||||
for value in (datetime.datetime(2024, 1, 2, 3, 4, 0, tzinfo=_Offset()), datetime.time(3, 4, 0, tzinfo=_Offset())):
|
||||
self.assertEqual(rt(value), getUnicode(value))
|
||||
self.assertTrue(rt(value).endswith("+05:30"))
|
||||
|
||||
|
||||
class TestRealSessionObjects(unittest.TestCase):
|
||||
# the exact shapes written with serialize=True across the codebase
|
||||
|
||||
Reference in new issue
Block a user