diff --git a/pwncat/__main__.py b/pwncat/__main__.py index 53590ec..e81c84d 100644 --- a/pwncat/__main__.py +++ b/pwncat/__main__.py @@ -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() diff --git a/pwncat/commands/__init__.py b/pwncat/commands/__init__.py index 8e91add..8dbf0e9 100644 --- a/pwncat/commands/__init__.py +++ b/pwncat/commands/__init__.py @@ -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: diff --git a/pwncat/commands/connect.py b/pwncat/commands/connect.py index aa7d3f1..f5648a0 100644 --- a/pwncat/commands/connect.py +++ b/pwncat/commands/connect.py @@ -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")