From 9810102e726904ab9a3d0bb2a55f637f9dfe80bd Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:23:02 -0400 Subject: [PATCH] GP-1710: Fix error popup when user rejects SSH HostKey --- .../main/java/agent/gdb/pty/ssh/GhidraSshPtyFactory.java | 8 +++++++- .../debug/gui/copying/DebuggerCopyIntoProgramDialog.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/GhidraSshPtyFactory.java b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/GhidraSshPtyFactory.java index 21688cabfe..b833af2c0e 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/GhidraSshPtyFactory.java +++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/GhidraSshPtyFactory.java @@ -211,10 +211,16 @@ public class GhidraSshPtyFactory implements PtyFactory { return session; } catch (JSchException e) { - if (e.getMessage().equals("Auth cancel")) { + String message = e.getMessage(); + if (message.equals("Auth cancel")) { Msg.error(this, "SSH connection canceled"); throw new CancellationException("SSH connection canceled"); } + else if (message.startsWith("reject HostKey")) { + String cancelMessage = "SSH " + message; + Msg.error(this, cancelMessage); + throw new CancellationException(cancelMessage); + } Msg.error(this, "SSH connection error"); throw new IOException("SSH connection error", e); } diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java index 17c02ef96a..c353155b98 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java @@ -810,7 +810,7 @@ public class DebuggerCopyIntoProgramDialog extends ReusableDialogComponentProvid protected void executeCapture(AddressRange range, TraceRecorder recorder, TaskMonitor monitor) throws Exception { synchronized (this) { - monitor.checkCanceled(); + monitor.checkCancelled(); CompletableFuture recCapture = recorder.readMemoryBlocks(new AddressSet(range), monitor); this.captureTask = recCapture.thenCompose(__ -> {