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.
### 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".
These changes do not affect the working of `pwncat`. You had an older version of `python-black`, and allowed me to apply the changes. As per the provided template, I have also ran `isort` and `flake8`, they reported no errors and/or modifications.
NOTE: This is for linux! This change will add ID management for the sessions, so that each session gets a unique ID (for a single `pwncat` process) and killing a session will not affect other session IDs. This is useful when we are pivoting using `pwncat`, and removes the confusion with ID management since the current implementation uses a List and works with list indices instead of session IDs
Older versions of `ip` do not support the `-c=never` argument (or colors
at all for that matter). Also, verified isort results, which made some
other modifications.
The `ChannelFile` implementation raised a BlockingIOError in certain
circumstances which is against the documented implementation for a
subclass of `RawIOBase`. This was causing odd behaviour like occasional
missing command output (e.g. empty environment variables)
- Added return statement to `sessions` in case of out-of-bounds session ID
- Replaced the `$fg[color]` syntax with the basic color interface as defined in `man 1 zshmisc`
The older variable value isn't working, I have modified it accordingly matching the original color scheme. However, I have used a different value to show current working directory so that the home directory appears as '~', you may want to use '$PWD' instead
The zsh shell uses a different syntax for colored prompts. As such, I've
divided the prompt setup into three different options based on the
basename of the active shell: `sh` (uncolored), `zsh` and `default`.
Other shells can be added to `Linux.PROMPTS` as needed in the future.
- Added rust requirements for cryptography.
- Removed installing requirements.txt as it's no longer needed.
- Added a call to `--download-plugins` to ensure plugins are bundled automatically.
For linux, we used to send one or two EOFs via C-d to the process to
signal exit, however this was inconsistent. Depending on the previous
input from the attacker, sometimes one was needed, sometimes two.
Sometimes, we even observed more than two being needed. Instead, we now
simply loop sending one at a time and checking for the end delimeter.
This will be slightly slower, but avoids hangups or accidentally closing
the shell.