Fix always-empty timestamp in performing-malware-ioc-extraction agent.py report - #113
Open
farhan6667 wants to merge 1 commit into
Open
Conversation
generate_ioc_report()'s "generated" field used:
datetime.utcnow().isoformat() if "datetime" in dir() else ""
"datetime" is never imported anywhere in this file, and dir() with
no arguments only inspects local scope names -- so this guard is
always False, and every generated report had "generated": "" instead
of a real timestamp.
Fixed by importing datetime/timezone at the top and calling
datetime.now(timezone.utc).isoformat() directly (the non-deprecated
replacement for utcnow(), since Python 3.12 deprecates utcnow()).
Tested: python3 -m py_compile, --help works, and:
python3 agent.py report --file <any file>
now produces a real ISO 8601 UTC timestamp
(e.g. "2026-07-17T14:46:03.178652+00:00") instead of an empty string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
skills/performing-malware-ioc-extraction/scripts/agent.py'sgenerate_ioc_report()sets the"generated"field with:datetimeis never imported anywhere in this file, anddir()with no arguments only inspects local scope names -- so this guard is alwaysFalse. Every generated report has"generated": ""instead of a real timestamp.Fix
Imported
datetime/timezoneat the top and calldatetime.now(timezone.utc).isoformat()directly (the non-deprecated replacement forutcnow(), since Python 3.12 deprecatesdatetime.utcnow()).How to test
Breaking changes
None --
"generated"was already a string field; it now just contains a real value instead of always being empty.