Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1710: Fix error popup when user rejects SSH HostKey

Dan9810102e7269
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<Void> recCapture =
recorder.readMemoryBlocks(new AddressSet(range), monitor);
this.captureTask = recCapture.thenCompose(__ -> {