Skip to content

Commit

Permalink
fix for python >= 12
Browse files Browse the repository at this point in the history
  • Loading branch information
SafaSafari committed Aug 9, 2024
1 parent 37f04d4 commit 5113f79
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and simply didn't have the time to go back and retroactively create one.

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

Expand Down
7 changes: 4 additions & 3 deletions pwncat/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ def __init__(self, manager: "pwncat.manager.Manager"):
if module_name == "base":
continue
self.commands.append(
loader.find_module(module_name)
.load_module(module_name)
loader.find_spec(module_name)
.loader.load_module(module_name)
.Command(manager)
)

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

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

tokens = {}

Expand Down
5 changes: 3 additions & 2 deletions pwncat/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ def _open_socket(self) -> socket.socket:

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

if not self.ssl:
return server
Expand Down Expand Up @@ -934,7 +935,7 @@ def load_modules(self, *paths):

# Why is this check *not* part of pkgutil??????? D:<
if module_name not in sys.modules:
module = loader.find_module(module_name).load_module(module_name)
module = loader.find_spec(module_name).loader.load_module(module_name)
else:
module = sys.modules[module_name]

Expand Down
2 changes: 1 addition & 1 deletion pwncat/platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class RemotePath(base_path, Path):
_stat = None

def __init__(self, *args):
base_path.__init__(*args)
super().__init__(*args)

self.Path = RemotePath
""" A concrete Path object for this platform conforming to pathlib.Path """
Expand Down

0 comments on commit 5113f79

Please sign in to comment.