Previously, we were registering a new 'session' with the 'manager' before completing the setup: '__init__'. Any exception raised after we registered the 'session' didn't remove the registered session. This will allow the reuse of same 'session_id' because we have already registered the 'session' with this 'session_id', which may possibly be an invalid session because an exception is raised. And 'session_id' variable in 'manager' will not be updated because of this exception. Thus, I have shifted down the session registering part so that it occurs after the completion of session creation.
I have added warning messages so that the attacker can use 'C-c' to cancel the session when used from command line (not from local prompt). And added the message for already handled same exception. I have also changed two warning message color from 'red' to 'yellow', because 'yellow' is being used everywhere in the code.
Exception handling in the output thread was cleaned up and had Windows
platform raise the RawModeExit exception to trigger an exit when
interactive end marker was observed.
- Removed `C-d` loop in `LinuxWriter.close`
- Added double `C-d` routine based on last character written to `LinuxWriter.close`
- Changed upload success message to match size calculations from `rich.progress`.
- Added better file IO test cases (small text, large text, small binary, large binary)
There is a missing argument to the ChannelError constructor - ch (channel). Because of this, many explicitly passed error messages are simply rejected. There is a minor typo correction as well, 'writiers' -> 'writers'.
Socket-based channels now raise ChannelClosed if no connection is active
and a recv/send method is called. Also, the close method no longer
raises an exception if the channel is not active. It is silently ignored
as a NOOP.
Also fixed a tangential problem which arose regarding the group
enumerations which caused a recursive call the enumerate groups
from within the group enumeration.
The recv method did not used to handle an empty result properly. It now
raises a ChannelClosed exception properly. Also, odly, the
`Manager.find_session_by_channel` method had never been implemented.
It appears that you need to send every C-d twice, but I can't figure out
why. All manual testing only requires a single C-d, but double each
seems to correctly behave with file IO.
### Changed
- Changed session tracking so session IDs aren't reused
- Changed zsh prompt to match CWD of other shell prompts
### Fixed
- Fixed syntax for f-strings in escalation command
I will release a patch version once a couple other bugs
are fixed. Namely, the dockerhub building problems and
exception issues. In the meantime, the changes are listed
under "Unreleased".