Skip to content
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

Update BatchCsvOut.cs #86

Merged
merged 2 commits into from
Jan 15, 2025
Merged

Conversation

cyberman1
Copy link
Contributor

Proposed we modify the BatchCsvOut class to output the LastWriteTimestamp in the format yyyy-MM-dd HH:mm:ss.fffffff.

  • Create a method GetFormattedTimestamp that formats the LastWriteTimestamp property.

  • Use the GetFormattedTimestamp method when writing the CSV file.

Description

Please include a summary of the change and (if applicable) which issue is fixed.

Checklist:

Please replace every instance of [ ] with [X] OR click on the checkboxes after you submit your PR

  • I have generated a unique GUID for my Batch file(s)
  • I have tested and validated the new Batch file(s) against test data and achieved the desired output
  • I have placed the Batch file(s) within the .\RECmd\BatchExamples directory
  • I have set or updated the version of my Batch file(s)
  • I have made an attempt to document the artifacts within the Batch file(s)
  • I have consulted the Guide/Template to ensure my Map(s) follow the same format

Thank you for your submission and for contributing to the DFIR community!

Proposed we modify the BatchCsvOut class to output the LastWriteTimestamp in the format yyyy-MM-dd HH:mm:ss.fffffff. 

- Create a method GetFormattedTimestamp that formats the LastWriteTimestamp property.

- Use the GetFormattedTimestamp method when writing the CSV file.
@EricZimmerman
Copy link
Owner

I would just hard code it to the format used above and don't even bother with a new method

@EricZimmerman EricZimmerman marked this pull request as ready for review January 15, 2025 16:34
@cyberman1
Copy link
Contributor Author

Ok, so do you think this will work? I removed the GetFormattedTimestamp method, the timestamp formatting is now done directly within the WriteCsv method.

// Method to write the CSV
public static void WriteCsv(string filePath, List data)
{
string dateTimeFormat = "yyyy-MM-dd HH:mm:ss.fffffff";
using (StreamWriter writer = new StreamWriter(filePath))`
}

 WriteCsv method now uses GetFormattedTimestamp to format the LastWriteTimestamp when writing the CSV file.
@EricZimmerman
Copy link
Owner

This seems fine by me. that is the defacto timestamp IMO, at least without the subsecond precision

@EricZimmerman EricZimmerman merged commit 103c406 into EricZimmerman:master Jan 15, 2025
1 check passed
@cyberman1
Copy link
Contributor Author

Thank you for your help

@cyberman1 cyberman1 deleted the patch-1 branch January 15, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants