fortra / impacket

Impacket is a collection of Python classes for working with network protocols.
https://www.coresecurity.com
Other
12.99k stars 3.5k forks source link

Fixed warnings with Python 3.12 #1695

Open exploide opened 5 months ago

exploide commented 5 months ago
  1. Python 3.12 is a bit more strict when it comes to backslashes in strings. If it isn't an actual escape sequence like \n then it should be either a raw string or the backslash should be escaped. Fixed a bunch of SyntaxWarning: invalid escape sequence in reg.py.

  2. The function datetime.datetime.utcnow() has been deprecated, because timezone aware datetime objects should better be used instead. Replaced a lot of occurences of datetime.datetime.utcnow() in the codebase since this was spitting DeprecationWarning: datetime.datetime.utcnow() is deprecated everywhere.

anadrianmanrique commented 5 months ago

Thanks for the PR with changes. Although we are not currently supporting officially 3.12, we will do it in the short term. This PR will be taken into account by then.

exploide commented 5 months ago

Great. Pushed another commit, because datetime.datetime.utcfromtimestamp() is deprecated likewise.