mirror of https://github.com/MISP/PyMISP
commit
85b4f1d051
|
@ -67,7 +67,7 @@ def _make_datetime(value) -> datetime:
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# faster
|
# faster
|
||||||
if '+' in value or '-' in value:
|
if '+' in value or value.find('-', 10) > -1: # date contains `-` char
|
||||||
value = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%f%z")
|
value = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%f%z")
|
||||||
elif '.' in value:
|
elif '.' in value:
|
||||||
value = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%f")
|
value = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%f")
|
||||||
|
|
|
@ -2082,7 +2082,7 @@ class TestComprehensive(unittest.TestCase):
|
||||||
local_tz = datetime.now(timezone.utc).astimezone().tzinfo
|
local_tz = datetime.now(timezone.utc).astimezone().tzinfo
|
||||||
event = MISPEvent()
|
event = MISPEvent()
|
||||||
event.info = 'Test First Last seen'
|
event.info = 'Test First Last seen'
|
||||||
event.add_attribute('ip-dst', '8.8.8.8', first_seen='2020-01-04', last_seen='2020-01-04T12:30:34.323242+8:00')
|
event.add_attribute('ip-dst', '8.8.8.8', first_seen='2020-01-04', last_seen='2020-01-04T12:30:34.323242+0800')
|
||||||
obj = event.add_object(name='file', first_seen=1580147259.268763, last_seen=1580147300)
|
obj = event.add_object(name='file', first_seen=1580147259.268763, last_seen=1580147300)
|
||||||
attr = obj.add_attribute('filename', 'blah.exe')
|
attr = obj.add_attribute('filename', 'blah.exe')
|
||||||
attr.first_seen = '2022-01-30'
|
attr.first_seen = '2022-01-30'
|
||||||
|
|
Loading…
Reference in New Issue