Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for python >= 3.12 #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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