1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-30 12:24:14 +01:00

Merge branch 'master' into issue-183-fix-sudo-parsing

This commit is contained in:
Caleb Stewart 2021-08-16 11:54:25 -04:00 committed by GitHub
commit 856d4a8134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -13,6 +13,7 @@ and simply didn't have the time to go back and retroactively create one.
- Possible exception due to _pre-registering_ of `session` with `manager`
- Covered edge case in sudo rule parsing for wildcards ([#183](https://github.com/calebstewart/pwncat/issue/183))
- Added fallthrough cases for PTY methods in case of misbehaving binaries (looking at you: `screen`)
- Fixed handling of `socket.getpeername` when `Socket` channel uses IPv6 ([#159](https://github.com/calebstewart/pwncat/issues/159)).
### Added
- Added alternatives to `bash` to be used during _shell upgrade_ for a _better shell_
- Added a warning message when a `KeyboardInterrupt` is caught

View File

@ -50,7 +50,11 @@ class Socket(Channel):
if client is not None:
# Report host and port number to base channel
host, port = client.getpeername()
host, port, *_ = client.getpeername()
# Localhost is sometimes a IPv4 and sometimes IPv6 socket, just normalize the name
if host == "::1" or host == "127.0.0.1":
host = "localhost"
if "host" not in kwargs:
kwargs["host"] = host
@ -78,6 +82,10 @@ class Socket(Channel):
self.client = client
self.address = client.getpeername()
# Localhost is sometimes a IPv4 and sometimes IPv6 socket, just normalize the name
if self.address[0] == "::1" or self.address[0] == "127.0.0.1":
self.address = ("localhost", *self.address[1:])
self.client.setblocking(False)
fcntl.fcntl(self.client, fcntl.F_SETFL, os.O_NONBLOCK)