mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-3295: Add askPassword to GhidraScript API.
This commit is contained in:
parent
92e77ff5cb
commit
899772973a
13 changed files with 127 additions and 57 deletions
|
@ -23,6 +23,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.framework.generic.auth.Password;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.framework.model.DomainFolder;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
@ -117,6 +118,10 @@ public class AskScript extends GhidraScript {
|
|||
boolean yesOrNo = askYesNo("yes or no", "is this a yes/no question?");
|
||||
println("Yes or No? " + yesOrNo);
|
||||
|
||||
try (Password password = askPassword("Password", null)) {
|
||||
println("Password has %d characters".formatted(password.getPasswordChars().length));
|
||||
// try-with-resources ensures buffer is zeroed out before garbage collected
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException iae) {
|
||||
Msg.warn(this, "Error during headless processing: " + iae.toString());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue