We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some work has been done by Shellphish members at DEFCON:
import ghidra.app.script.GhidraScript; import ghidra.program.model.data.*; public class binsync_structs extends GhidraScript { public void run() throws Exception { add_named_struct("my_struct"); add_member_to_struct("my_struct", "my_field"); expand_struct("my_struct", 0x4); retype_struct_member("my_struct", "my_field", IntegerDataType.dataType); } private Structure get_struct(String name){ return (Structure)currentProgram.getDataTypeManager().getDataType("/"+name); } public void add_named_struct(String name) throws Exception{ StructureDataType struct = new StructureDataType(name, 0); currentProgram.getDataTypeManager().addDataType(struct, DataTypeConflictHandler.DEFAULT_HANDLER); } public void add_member_to_struct(String struct_name, String member){ Structure struct = get_struct(struct_name); struct.add(ByteDataType.dataType, 1, member, ""); } public void retype_struct_member(String struct_name, String member, DataType type){ Structure struct = get_struct(struct_name); int offset = 0; for (DataTypeComponent dtc : struct.getComponents()) { if (dtc.getFieldName().equals(member)){ offset = dtc.getOffset(); for(int i=offset; i<offset+type.getLength(); i++){ struct.clearAtOffset(i); } struct.replaceAtOffset(offset, type, 4, member,""); break; } } } public void expand_struct(String struct_name, int new_size){ Structure struct = get_struct(struct_name); struct.growStructure(new_size-struct.getLength()); } }
No response
The text was updated successfully, but these errors were encountered:
This is also some great reference code for when the lister is implemented: mahaloz/decomp2dbg#75
Sorry, something went wrong.
No branches or pull requests
Description
Some work has been done by Shellphish members at DEFCON:
Alternatives
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: