mirror of https://github.com/MISP/MISP
fix: [stix2 export] Making sure timestamps are always converted into the format STIX likes
parent
3653e62fd8
commit
32849b1087
|
@ -1822,7 +1822,7 @@ class StixBuilder():
|
|||
@staticmethod
|
||||
def handle_time_fields(attribute, timestamp, stix_type):
|
||||
to_return = {'created': timestamp, 'modified': timestamp}
|
||||
iso_timestamp = timestamp.isoformat(timespec='milliseconds')
|
||||
iso_timestamp = f"{timestamp.isoformat(timespec='milliseconds')}Z"
|
||||
for misp_field, stix_field in zip(('first_seen', 'last_seen'), _time_fields[stix_type]):
|
||||
to_return[stix_field] = datetime.strptime(attribute[misp_field].split('+')[0], '%Y-%m-%dT%H:%M:%S.%f') if attribute.get(misp_field) else iso_timestamp
|
||||
return to_return
|
||||
|
|
Loading…
Reference in New Issue