Skip to content

Fix deprecated datetime.utcnow() calls#84

Open
MichaelMVS wants to merge 2 commits intoxaitax:mainfrom
MichaelMVS:fix-datetime-utcnow-deprecation
Open

Fix deprecated datetime.utcnow() calls#84
MichaelMVS wants to merge 2 commits intoxaitax:mainfrom
MichaelMVS:fix-datetime-utcnow-deprecation

Conversation

@MichaelMVS
Copy link
Copy Markdown

Summary

Fixed deprecated datetime.datetime.utcnow() calls which are deprecated in Python 3.12+ and will be removed in a future version.

Changes

  1. sploitscan/utils.py - Replaced datetime.datetime.utcnow() with timezone-aware datetime.datetime.now(datetime.timezone.utc) in generate_filename().

  2. sploitscan/importers/init.py - Added missing import datetime and import pathlib. The pathlib.Path() was used without importing pathlib, and the encoding= keyword argument was incorrectly passed as a positional argument instead of using Path(dir_path) correctly.

- Replace datetime.datetime.utcnow() with timezone-aware
  datetime.datetime.now(datetime.timezone.utc) in utils.py
- Fix missing import datetime and import pathlib in importers/__init__.py
  (pathlib.Path was used without import, encoding= was wrong positional arg)
Copilot AI review requested due to automatic review settings April 12, 2026 09:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates SploitScan’s timestamp and directory-import logic to avoid deprecated/incorrect APIs (notably datetime.datetime.utcnow() in newer Python versions and an invalid pathlib.Path(...) usage).

Changes:

  • Replaced datetime.datetime.utcnow() with a timezone-aware datetime.datetime.now(datetime.timezone.utc) in filename generation.
  • Fixed directory import globbing by switching to Path(dir_path).glob("**/*") and adding required imports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sploitscan/utils.py Uses a timezone-aware UTC timestamp to avoid deprecated utcnow() while keeping the same ...Z filename format.
sploitscan/importers/__init__.py Fixes invalid pathlib.Path(..., encoding=...) usage by using Path(dir_path) and adds necessary imports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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