mitre/stockpile

Incorrect date time format in ragdoll.py

Closed this issue · 1 comments

Describe the bug
The data time format used to send the agent_reported_time does not match with the time used in the Caldera server.

This causes it to crash when processing the response before showing the results

Traceback (most recent call last):
  File "/home/ubuntu/caldera/app/service/contact_svc.py", line 123, in _save
    link.agent_reported_time = self.get_timestamp_from_string(result.agent_reported_time)
  File "/home/ubuntu/caldera/app/utility/base_world.py", line 87, in get_timestamp_from_string
    return datetime.strptime(datetime_str, date_format)
  File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.10/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-02-03 15:47:46' does not match format '%Y-%m-%dT%H:%M:%SZ'

To Reproduce
Steps to reproduce the behavior:

  1. Run the most recent version of Caldera
  2. Start a ragdoll.py agent
  3. Run any command expecting an output
  4. See that the output is not shown and a error message is shown in the Caldera console

Expected behavior
The commands output to be seen on Caldera and no error message in the console

Fix
Change line 66 of ragdoll.py to:

execution_timestamp = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser: Chrome
  • Version: Caldera 4.2.0

Thank you very much for this fix, @LwsChlds!