mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-24 09:35:39 +01:00
Merge pull request #211 from art3x/issue-208-fix-shell-detection
Issues 208 (stat output verification) and 210 (shell detection) fixes
This commit is contained in:
commit
9fabe64044
@ -21,6 +21,9 @@ and simply didn't have the time to go back and retroactively create one.
|
|||||||
- Forced `Stream.RAW` for all GTFOBins interaction ([#195](https://github.com/calebstewart/pwncat/issues/195)).
|
- Forced `Stream.RAW` for all GTFOBins interaction ([#195](https://github.com/calebstewart/pwncat/issues/195)).
|
||||||
- Added custom `which` implementation for linux when `which` is not available ([#193](https://github.com/calebstewart/pwncat/issues/193)).
|
- Added custom `which` implementation for linux when `which` is not available ([#193](https://github.com/calebstewart/pwncat/issues/193)).
|
||||||
- Correctly handle `--listen` argument ([#201](https://github.com/calebstewart/pwncat/issues/201))
|
- Correctly handle `--listen` argument ([#201](https://github.com/calebstewart/pwncat/issues/201))
|
||||||
|
- Added additional check for stat time of file birth field (#208)
|
||||||
|
- Removed shell compare with ["nologin", "false", "sync", "git-shell"] (#210)
|
||||||
|
- Added shell compare with not in ["bash", "zsh", "ksh", "fish"] (#210)
|
||||||
### Added
|
### Added
|
||||||
- Added alternatives to `bash` to be used during _shell upgrade_ for a _better shell_
|
- Added alternatives to `bash` to be used during _shell upgrade_ for a _better shell_
|
||||||
- Added a warning message when a `KeyboardInterrupt` is caught
|
- Added a warning message when a `KeyboardInterrupt` is caught
|
||||||
|
@ -616,19 +616,14 @@ class Linux(Platform):
|
|||||||
if self.shell == "" or self.shell is None:
|
if self.shell == "" or self.shell is None:
|
||||||
self.shell = "/bin/sh"
|
self.shell = "/bin/sh"
|
||||||
|
|
||||||
# This doesn't make sense, but happened for some people (see issue #116)
|
|
||||||
if os.path.basename(self.shell) in ["nologin", "false", "sync", "git-shell"]:
|
|
||||||
self.shell = "/bin/sh"
|
|
||||||
self.channel.sendline(b" export SHELL=/bin/sh")
|
|
||||||
|
|
||||||
if self._do_which("which") is None:
|
if self._do_which("which") is None:
|
||||||
self._do_which = self._do_custom_which
|
self._do_which = self._do_custom_which
|
||||||
|
|
||||||
if os.path.basename(self.shell) in ["sh", "dash"]:
|
better_shells = ["bash", "zsh", "ksh", "fish"]
|
||||||
|
if os.path.basename(self.shell) not in better_shells:
|
||||||
# Try to find a better shell
|
# Try to find a better shell
|
||||||
# a custom `pwncat shell prompt` may not be available for all shells
|
# a custom `pwncat shell prompt` may not be available for all shells
|
||||||
# see `self.PROMPTS`
|
# see `self.PROMPTS`
|
||||||
better_shells = ["bash", "zsh", "ksh", "fish"]
|
|
||||||
|
|
||||||
for better_shell in better_shells:
|
for better_shell in better_shells:
|
||||||
shell = self._do_which(better_shell)
|
shell = self._do_which(better_shell)
|
||||||
@ -1743,6 +1738,10 @@ class Linux(Platform):
|
|||||||
if fields[i] == "?":
|
if fields[i] == "?":
|
||||||
fields[i] = "0"
|
fields[i] = "0"
|
||||||
|
|
||||||
|
# Fix stat output issues in some enviroments
|
||||||
|
if fields[1] == "W":
|
||||||
|
fields[1] = "0"
|
||||||
|
|
||||||
stat = os.stat_result(
|
stat = os.stat_result(
|
||||||
tuple(
|
tuple(
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user