mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-24 01:25:37 +01:00
Added warning messages for 'KeyboardInterrupt'
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.
This commit is contained in:
parent
230b3995f5
commit
534002288c
@ -277,6 +277,8 @@ def main():
|
||||
)
|
||||
except (ChannelError, PlatformError) as exc:
|
||||
manager.log(f"connection failed: {exc}")
|
||||
except KeyboardInterrupt:
|
||||
manager.log("[yellow]warning[/yellow]: cancelled by user")
|
||||
|
||||
manager.interactive()
|
||||
|
||||
|
@ -523,7 +523,7 @@ class CommandParser:
|
||||
self.dispatch_line(command)
|
||||
except ChannelClosed as exc:
|
||||
# A channel was unexpectedly closed
|
||||
self.manager.log(f"[red]warning[/red]: {exc.channel}: channel closed")
|
||||
self.manager.log(f"[yellow]warning[/yellow]: {exc.channel}: channel closed")
|
||||
# Ensure any existing sessions are cleaned from the manager
|
||||
exc.cleanup(self.manager)
|
||||
except pwncat.manager.InteractiveExit:
|
||||
@ -593,7 +593,7 @@ class CommandParser:
|
||||
continue
|
||||
except ChannelClosed as exc:
|
||||
# A channel was unexpectedly closed
|
||||
self.manager.log(f"[red]warning[/red]: {exc.channel}: channel closed")
|
||||
self.manager.log(f"[yellow]warning[/yellow]: {exc.channel}: channel closed")
|
||||
# Ensure any existing sessions are cleaned from the manager
|
||||
exc.cleanup(self.manager)
|
||||
except pwncat.manager.InteractiveExit:
|
||||
|
@ -244,3 +244,5 @@ class Command(CommandDefinition):
|
||||
)
|
||||
except (ChannelError, PlatformError) as exc:
|
||||
manager.log(f"connection failed: {exc}")
|
||||
except KeyboardInterrupt:
|
||||
manager.log("[yellow]warning[/yellow]: cancelled by user")
|
||||
|
Loading…
Reference in New Issue
Block a user