You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
impacket version:
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
Python version:
Python 3.12.6
Target OS:
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2024.3
Codename: kali-rolling
Issue
impacket-GetNPUsers uses datetime.datetime.utcnow() in GetNPUsers.py in line 165.
Any usage of datetime.datetime.utcnow() throws the following deprecation warning in Python 3.12
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Steps To Reproduce
Run impacket-GetNPUsers with Python 3.12
Solution
Replace line 165 in impacket-GetNPUsers now = datetime.datetime.utcnow() + datetime.timedelta(days=1)
with now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) + datetime.timedelta(days=1)
The text was updated successfully, but these errors were encountered:
Configuration
impacket version:
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
Python version:
Python 3.12.6
Target OS:
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2024.3
Codename: kali-rolling
Issue
impacket-GetNPUsers uses datetime.datetime.utcnow() in GetNPUsers.py in line 165.
Any usage of datetime.datetime.utcnow() throws the following deprecation warning in Python 3.12
related: dbt-labs/dbt-core#9791
Expected Behavior
This shouldn't happen
Steps To Reproduce
Run impacket-GetNPUsers with Python 3.12
Solution
Replace line 165 in impacket-GetNPUsers
now = datetime.datetime.utcnow() + datetime.timedelta(days=1)
with
now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) + datetime.timedelta(days=1)
The text was updated successfully, but these errors were encountered: