Skip to content

Fix always-empty timestamp in performing-malware-ioc-extraction agent.py report - #113

Open
farhan6667 wants to merge 1 commit into
mukul975:mainfrom
farhan6667:fix/ioc-extraction-agent-report-timestamp
Open

Fix always-empty timestamp in performing-malware-ioc-extraction agent.py report#113
farhan6667 wants to merge 1 commit into
mukul975:mainfrom
farhan6667:fix/ioc-extraction-agent-report-timestamp

Conversation

@farhan6667

Copy link
Copy Markdown

What changed and why

skills/performing-malware-ioc-extraction/scripts/agent.py's generate_ioc_report() sets the "generated" field with:

"generated": 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. Every generated report has "generated": "" instead of a real timestamp.

Fix

Imported datetime/timezone at the top and call datetime.now(timezone.utc).isoformat() directly (the non-deprecated replacement for utcnow(), since Python 3.12 deprecates datetime.utcnow()).

How to test

python3 -m py_compile skills/performing-malware-ioc-extraction/scripts/agent.py
python3 skills/performing-malware-ioc-extraction/scripts/agent.py --help

echo "test file" > /tmp/sample.bin
python3 skills/performing-malware-ioc-extraction/scripts/agent.py report --file /tmp/sample.bin
# "generated" field is now a real ISO 8601 UTC timestamp, e.g.
# "2026-07-17T14:46:03.178652+00:00", instead of ""

Breaking changes

None -- "generated" was already a string field; it now just contains a real value instead of always being empty.

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.
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.

1 participant