Skip to content

convert timestamp in human form to UTC #1367

@zelvann

Description

@zelvann

A single malformed timestamp in the NetUsage artifact such as values found in last connect, first usage,and last usage columns raises a ValueError during convertion timestamp to UTC. It stops parsing for all other valid rows as well

Reading netusage artifact had errors!
Error was year 0 is out of range
Exception Traceback: Traceback (most recent call last): File "E:\forensik\iLEAPP\ileapp.py", line 491, in crunch_artifacts plugin.method(files_found, category_folder, seeker, wrap_text, time_offset) File "E:\forensik\iLEAPP\scripts\artifacts\netusage.py", line 60, in get_netusage lastused = convert_utc_human_to_timezone(convert_ts_human_to_utc(row[2]),timezone_offset) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\forensik\iLEAPP\scripts\ilapfuncs.py", line 1118, in convert_ts_human_to_utc dt = datetime.strptime(ts, '%Y-%m-%d %H:%M:%S') #Make it a datetime object ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\_strptime.py", line 554, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\_strptime.py", line 520, in _strptime julian = datetime_date(year, month, day).toordinal() - \ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: year 0 is out of range

Additional note:
I’ve made PR about this #1368, Looking forward for a review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions