mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Merge remote-tracking branch
'origin/GP-990-dragonmacher-script-header-parsing--SQUASHED' into Ghidra_10.0
This commit is contained in:
commit
a94630a330
4 changed files with 37 additions and 17 deletions
|
@ -81,6 +81,9 @@ public abstract class GhidraScriptProvider
|
||||||
* @param sourceFile the source file
|
* @param sourceFile the source file
|
||||||
* @param writer the print writer to write warning/error messages
|
* @param writer the print writer to write warning/error messages
|
||||||
* @return a GhidraScript instance for the specified source file
|
* @return a GhidraScript instance for the specified source file
|
||||||
|
* @throws ClassNotFoundException if the script class cannot be found
|
||||||
|
* @throws InstantiationException if the construction of the script fails for some reason
|
||||||
|
* @throws IllegalAccessException if the class constructor is not accessible
|
||||||
*/
|
*/
|
||||||
public abstract GhidraScript getScriptInstance(ResourceFile sourceFile, PrintWriter writer)
|
public abstract GhidraScript getScriptInstance(ResourceFile sourceFile, PrintWriter writer)
|
||||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException;
|
throws ClassNotFoundException, InstantiationException, IllegalAccessException;
|
||||||
|
@ -168,8 +171,7 @@ public abstract class GhidraScriptProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the start of certification header line if this file type is
|
* Return the start of certification header line if this file type is subject to certification.
|
||||||
* subject to certification.
|
|
||||||
* @return start of certification header or null if not supported
|
* @return start of certification header or null if not supported
|
||||||
*/
|
*/
|
||||||
protected String getCertifyHeaderStart() {
|
protected String getCertifyHeaderStart() {
|
||||||
|
@ -177,21 +179,19 @@ public abstract class GhidraScriptProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the prefix for each certification header bofy line if
|
* Return the prefix for each certification header body line if this file is subject to
|
||||||
* this file is subject to certification
|
* certification.
|
||||||
* @return certification heaber body prefix or null if not supported
|
* @return certification header body prefix or null if not supported
|
||||||
*/
|
*/
|
||||||
protected String getCertificationBodyPrefix() {
|
protected String getCertificationBodyPrefix() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the end of certification header line if this file type is
|
* Return the end of certification header line if this file type is subject to certification.
|
||||||
* subject to certification.
|
|
||||||
* @return end of certification header or null if not supported
|
* @return end of certification header or null if not supported
|
||||||
*/
|
*/
|
||||||
protected String getCertifyHeaderEnd() {
|
protected String getCertifyHeaderEnd() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,11 @@ public class JavaScriptProvider extends GhidraScriptProvider {
|
||||||
return "*/";
|
return "*/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getCertificationBodyPrefix() {
|
||||||
|
return "*";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Fix script name for search in script directories, such as Java package parts in the name and inner class names.
|
* Fix script name for search in script directories, such as Java package parts in the name and inner class names.
|
||||||
|
|
|
@ -61,6 +61,21 @@ public class PythonScriptProvider extends GhidraScriptProvider {
|
||||||
return "#";
|
return "#";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getCertifyHeaderStart() {
|
||||||
|
return "## ###";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getCertificationBodyPrefix() {
|
||||||
|
return "#";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getCertifyHeaderEnd() {
|
||||||
|
return "##";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Python";
|
return "Python";
|
||||||
|
|
|
@ -137,15 +137,15 @@ public class PythonScriptInfoTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
try {
|
try {
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
scriptFile = createTempPyScriptFileWithLines(
|
scriptFile = createTempPyScriptFileWithLines(
|
||||||
"## ###" +
|
"## ###",
|
||||||
"# IP: GHIDRA" +
|
"# IP: GHIDRA",
|
||||||
"# " +
|
"# ",
|
||||||
"# Some license text..." +
|
"# Some license text...",
|
||||||
"# you may not use this file except in compliance with the License." +
|
"# you may not use this file except in compliance with the License.",
|
||||||
"# " +
|
"# ",
|
||||||
"# blah blah blah" +
|
"# blah blah blah",
|
||||||
"##" +
|
"##",
|
||||||
"" +
|
"",
|
||||||
"'''",
|
"'''",
|
||||||
"This is a test block comment. It will be ignored.",
|
"This is a test block comment. It will be ignored.",
|
||||||
"@category NotTheRealCategory",
|
"@category NotTheRealCategory",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue