mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Merge remote-tracking branch 'origin/GP-5504_ghidraffe_GhidraGoCliImprovements--SQUASHED'
This commit is contained in:
commit
c98abe17b4
1 changed files with 14 additions and 10 deletions
|
@ -16,6 +16,7 @@
|
||||||
package ghidra;
|
package ghidra;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import docking.framework.DockingApplicationConfiguration;
|
import docking.framework.DockingApplicationConfiguration;
|
||||||
|
@ -58,6 +59,8 @@ public class GhidraGo implements GhidraLaunchable {
|
||||||
if (args != null && args.length > 0) {
|
if (args != null && args.length > 0) {
|
||||||
ghidra.framework.protocol.ghidra.Handler.registerHandler();
|
ghidra.framework.protocol.ghidra.Handler.registerHandler();
|
||||||
sender = new GhidraGoSender();
|
sender = new GhidraGoSender();
|
||||||
|
// check if ghidra url is valid
|
||||||
|
GhidraURL.getProjectURL(new URL(args[0]));
|
||||||
|
|
||||||
startGhidraIfNeeded(layout);
|
startGhidraIfNeeded(layout);
|
||||||
|
|
||||||
|
@ -70,25 +73,26 @@ public class GhidraGo implements GhidraLaunchable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException();
|
||||||
"A valid GhidraURL locating a program, program name, or path to a program name " +
|
|
||||||
"must be specified as the first command line argument.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (IllegalArgumentException e) {
|
||||||
|
System.err.println("\n" + "USAGE: ghidraGo <ghidraURL>\n\n" +
|
||||||
|
"Ghidra URL Forms (ghidraURL):\n" +
|
||||||
|
" ghidra://<hostname>[:<port>]/<repo-name>[/<folder-path>[/<program-name>]]\n" +
|
||||||
|
" ghidra:/[<local-dirpath>/]<project-name>[?/<folder-path>[/<program-name>]]\n");
|
||||||
|
}
|
||||||
catch (FailedToStartGhidraException e) {
|
catch (FailedToStartGhidraException e) {
|
||||||
logOrShowError("GhidraGo Start Ghidra Exception",
|
logOrShowError("GhidraGo Start Ghidra Exception",
|
||||||
"Failed to start Ghidra from GhidraGo", e);
|
"Failed to start Ghidra from GhidraGo", e);
|
||||||
System.exit(-1);
|
|
||||||
}
|
}
|
||||||
catch (StopWaitingException e) {
|
catch (StopWaitingException e) {
|
||||||
System.exit(-1);
|
// do nothing
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logOrShowError("GhidraGo Exception", "An unexpected exception occurred in GhidraGo", e);
|
logOrShowError("GhidraGo Exception", "An unexpected exception occurred in GhidraGo", e);
|
||||||
// calling System.exit explicitly is necessary, otherwise the Loading... screen
|
|
||||||
// persists instead of closing when complete.
|
|
||||||
System.exit(-1);
|
|
||||||
}
|
}
|
||||||
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logOrShowError(String errorTitle, String errorMessage, Exception e) {
|
private void logOrShowError(String errorTitle, String errorMessage, Exception e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue