Skip to content

Utc time #2355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 15, 2021
Merged

Utc time #2355

merged 8 commits into from
Nov 15, 2021

Conversation

uruwhy
Copy link
Contributor

@uruwhy uruwhy commented Nov 10, 2021

Description

Converting timestamps in CALDERA to be UTC-based rather than based on the timezone of the server. This change will allow timestamps to be normalized regardless of whether or not users are accessing the C2 server from browsers in different timezones. Timestamps outputted in the GUI and operation reports will also be in UTC in 2021-11-10T13:14:15Z format.

Will require the sandcat agent to update how it sends timestamps back to the C2 server upon completing actions - right now, the agent reports local times, which can vary depending on the timezones of the targeted hosts. There will also be associated gocat/sandcat PRs to handle this.

Associated gocat PR: mitre/gocat#70

For plugins that use timestamps, such as training and debrief, subsequent PRs for those specific plugins will be needed.

Documentation will need to be updated to specify UTC timestamps and to replace timestamps in examples with UTC.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Updated pytest unit tests accordingly.

Also ran several operations, both scheduled and unscheduled. All operations were performed with one agent in the same timezone as the C2 server and with another agent in a timezone two hours ahead. Agent/operation data was checked via operation report JSON and API data dumps to verify the outputted timestamps. Operations were generated both via the GUI and API, both from the same timezone and from a timezone 2 hours ahead (e.g. C2 server was running at UTC-5, and the operations were started from a VM in UTC-3).

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

…1 format in the GUI. Also increasing dead/alive threshold by 500ms

Convert agent timestamps back to local timezone when doing comparisons for op start time

Converting timestamps to UTC
@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #2355 (d576fdb) into master (78d66ce) will decrease coverage by 0.00%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2355      +/-   ##
==========================================
- Coverage   72.60%   72.59%   -0.01%     
==========================================
  Files         110      110              
  Lines        7946     7947       +1     
==========================================
  Hits         5769     5769              
- Misses       2177     2178       +1     
Impacted Files Coverage Δ
app/service/app_svc.py 50.57% <20.00%> (-0.30%) ⬇️
app/service/contact_svc.py 69.46% <50.00%> (ø)
app/objects/c_agent.py 90.31% <100.00%> (ø)
app/objects/c_operation.py 73.53% <100.00%> (ø)
app/objects/secondclass/c_fact.py 98.70% <100.00%> (ø)
app/objects/secondclass/c_link.py 86.09% <100.00%> (ø)
app/objects/secondclass/c_result.py 84.00% <100.00%> (ø)
app/service/event_svc.py 67.27% <100.00%> (ø)
app/utility/base_world.py 77.95% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78d66ce...d576fdb. Read the comment docs.

@uruwhy uruwhy marked this pull request as ready for review November 10, 2021 21:10
@uruwhy uruwhy mentioned this pull request Nov 12, 2021
elegantmoose
elegantmoose previously approved these changes Nov 12, 2021
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
16.3% 16.3% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants