Closed Mag1cByt3s closed 2 months ago
After trying to get another shell from a windows machine i encountered a similiar error:
┍┽ penelope ┾┑ Session [1] > sessions 2
[+] Attempting to upgrade shell to PTY...
[!] Upgrading Windows shell is not implemented yet.
[+] Interacting with session [2], Shell Type: Basic, Menu key: Ctrl-C
[+] Logging to /home/pascal/.penelope/localhost~127.0.0.1/localhost~127.0.0.1.log 📜
PS C:\Users\pascal> Exception in thread Core:
Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
File "/home/pascal/Git/penelope/./penelope.py", line 895, in loop
readables, writables, _ = select.select(self.rlist, self.wlist, [])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
Just had the same issue again after trying to switch the session
┍┽ penelope ┾┑ Session [1] > sessions 2
[+] Attempting to upgrade shell to PTY...
Exception in thread Menu:
Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.11/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/cmd.py", line 217, in onecmd
return func(arg)
^^^^^^^^^
File "/home/pascal/Git/penelope/./penelope.py", line 260, in do_sessions
if self.do_interact(line):
^^^^^^^^^^^^^^^^^^^^^^
File "/home/pascal/Git/penelope/./penelope.py", line 172, in newfunc
return func(self, ID)
^^^^^^^^^^^^^^
File "/home/pascal/Git/penelope/./penelope.py", line 295, in do_interact
return core.sessions[ID].attach()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pascal/Git/penelope/./penelope.py", line 2007, in attach
self.upgrade()
File "/home/pascal/Git/penelope/./penelope.py", line 1854, in upgrade
self.shell = self.bin['bash'] if self.bin['bash'] else self.bin['sh']
^^^^^^^^
File "/home/pascal/Git/penelope/./penelope.py", line 1431, in bin
response = self.exec(f'for i in {" ".join(binaries)}; do which $i 2>/dev/null || echo;done')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pascal/Git/penelope/./penelope.py", line 1714, in exec
readables, _, _ = select.select([self.subchannel.control, self.subchannel], [], [], timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
Exception in thread Core:
Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
File "/home/pascal/Git/penelope/./penelope.py", line 986, in loop
target.write(data)
File "/home/pascal/Git/penelope/./penelope.py", line 1222, in write
os.write(self._write, data)
BrokenPipeError: [Errno 32] Broken pipe
also detaching the session with F12 does not work on a windows target
So it seems like this happens once i have more than one session open and trying to switch between the sessions
it happnes with both linux and windows targets.
Can confirm similar behavior. Have attempted to switch to a new session on a linux client targeting a linux host and received the same error.
Thank you very much @Mag1cByt3s and @Zer0FluxGiv3n for reporting this! This issue had already been fixed in the dev
branch (commit 4d0c7f8) and now it is merged to main
.