Skip to content

Commit e0f6c06

Browse files
committed
fix for python >= 3.12
1 parent 37f04d4 commit e0f6c06

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and simply didn't have the time to go back and retroactively create one.
99

1010
## [Unreleased]
1111
### Fixed
12+
- Fixed running on python >= 12
1213
- Fixed `shlex.join` use with non-str type objects (e.g. `RemotePath`)
1314
- Fixed `set` command use with incorrect keys (e.g. `set invalid value`)
1415

pwncat/commands/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ def __init__(self, manager: "pwncat.manager.Manager"):
433433
if module_name == "base":
434434
continue
435435
self.commands.append(
436-
loader.find_module(module_name)
437-
.load_module(module_name)
436+
loader.find_spec(module_name)
437+
.loader.load_module(module_name)
438438
.Command(manager)
439439
)
440440

@@ -788,7 +788,8 @@ def restore_term(self, new_line=True):
788788

789789
class CommandLexer(RegexLexer):
790790
"""Implements a Regular Expression based pygments lexer for dynamically highlighting
791-
the pwncat prompt during typing. The tokens are generated from command definitions."""
791+
the pwncat prompt during typing. The tokens are generated from command definitions.
792+
"""
792793

793794
tokens = {}
794795

pwncat/manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ def _open_socket(self) -> socket.socket:
388388

389389
def _ssl_wrap(self, server: socket.socket) -> ssl.SSLSocket:
390390
"""Wrap the given server socket in an SSL context and return the new socket.
391-
If the ``ssl`` option is not set, this method simply returns the original socket."""
391+
If the ``ssl`` option is not set, this method simply returns the original socket.
392+
"""
392393

393394
if not self.ssl:
394395
return server
@@ -934,7 +935,7 @@ def load_modules(self, *paths):
934935

935936
# Why is this check *not* part of pkgutil??????? D:<
936937
if module_name not in sys.modules:
937-
module = loader.find_module(module_name).load_module(module_name)
938+
module = loader.find_spec(module_name).loader.load_module(module_name)
938939
else:
939940
module = sys.modules[module_name]
940941

pwncat/platform/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class RemotePath(base_path, Path):
520520
_stat = None
521521

522522
def __init__(self, *args):
523-
base_path.__init__(*args)
523+
super().__init__(*args)
524524

525525
self.Path = RemotePath
526526
""" A concrete Path object for this platform conforming to pathlib.Path """

0 commit comments

Comments
 (0)