How To Update this.currentAddress During Script Execution
See original GitHub issueI have an instruction address trace and I’d like to visualize it with Ghidra. I’m able to update the address via this.currentAddress = this.currentAddress.getAddress(address);
(which feels like the improper way to update the cursor location), but when I update the address multiple times within a script the cursor is only ever updated to the final address at the end of the script execution. This makes it where I’m unable to watch the instruction trace at all.
Here is my script.
public class TraceGoTo extends GhidraScript {
@Override
public void run() throws Exception {
String addresses[] = new String[] {"0x10a094", "0x10a098", "0x10a09c"};
System.out.println("TraceGoTo!");
for (String address : addresses) {
setAddress(address);
TimeUnit.SECONDS.sleep(1);
}
}
public void setAddress(String address) throws AddressFormatException
{
System.out.println("Setting address to " + address);
this.currentAddress = this.currentAddress.getAddress(address);
}
}
- What is the proper way to set
this.currentAddress
? - How can I get ghidra to render the updated address during the script execution (change the current cursor location)
- Better yet, how could I make a dialogue of sorts, where I could just click a button for “Next Address” and then update
this.currentAddress
? This would actually suit my needs and seems like the ideal approach anyways.
Issue Analytics
- State:
- Created a year ago
- Comments:12
Top Results From Across the Web
Script: Customer Address Update - AudienceView
The script will update the address with this ID for the customer. If the Address ID value is not provided by the source...
Read more >How can I update the current script before running it?
Yes, you can update the script you're running, then execute it again. (Just make sure to exit the first script after updating.) ...
Read more >How do I change data using a script to update a user field.
Here you go. Please run this from background script. Try this on your dev instance first. var gr = new GlideRecord('sys_user');.
Read more >Run custom actions during a feature update | Microsoft Learn
Custom actions folder structure ; %windir%\System32\update\runonce, Scripts in this folder will only run in one upgrade and won't be migrated for ...
Read more >Verified script execution for private locations
To change your passphrase or disable verified script execution, follow the same basic process to go to your minion's IP address and update...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
re: addresses, use
toAddr(String)
ortoAddr(long)
re: dialog. I haven’t played with the table convenience methods much, but using a dialog with a table does sound like a more user-friendly way to go.
Creating TableModels for tables is just one of the those things you have to get comfortable with when you venture outside the easy, predefined helper methods published in GhidraScript / FlatProgramAPI.
You have the full might and power of java and the internal classes defined in Ghidra to create anything you want. It just takes a bit of work.