Package ghidra.app.script
Class AbstractPythonScriptProvider
java.lang.Object
ghidra.app.script.GhidraScriptProvider
ghidra.app.script.AbstractPythonScriptProvider
- All Implemented Interfaces:
ExtensionPoint,Comparable<GhidraScriptProvider>
- Direct Known Subclasses:
JythonScriptProvider,PyGhidraScriptProvider
An abstract
GhidraScriptProvider used to provide common functionality to different
types of Python script implementations-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateNewScript(ResourceFile newScript, String category) Creates a new script using the specified file.Returns a Pattern that matches block comment closings.Returns a Pattern that matches block comment openings.protected StringReturn the prefix for each certification header body line if this file is subject to certification.protected StringReturn the end of certification header line if this file type is subject to certification.protected StringReturn the start of certification header line if this file type is subject to certification.Returns the comment character.abstract StringReturns a description for this type of script.Returns the file extension for this type of script.abstract StringReturns an optional runtime environment name of aGhidraScriptProviderthat scripts can specify they require to run under.abstract GhidraScriptgetScriptInstance(ResourceFile sourceFile, PrintWriter writer) Returns a GhidraScript instance for the specified source file.Methods inherited from class ghidra.app.script.GhidraScriptProvider
compareTo, deleteScript, equals, fixupName, hashCode, toString, writeBody, writeHeader
-
Constructor Details
-
AbstractPythonScriptProvider
public AbstractPythonScriptProvider()
-
-
Method Details
-
getDescription
Description copied from class:GhidraScriptProviderReturns a description for this type of script.- Specified by:
getDescriptionin classGhidraScriptProvider- Returns:
- a description for this type of script
-
getRuntimeEnvironmentName
Description copied from class:GhidraScriptProviderReturns an optional runtime environment name of aGhidraScriptProviderthat scripts can specify they require to run under. Useful for when more than oneGhidraScriptProvideruses the same file extension.- Overrides:
getRuntimeEnvironmentNamein classGhidraScriptProvider- Returns:
- an optional runtime environment name of a
GhidraScriptProviderthat scripts can specify they require to run under (could be null if there is no requirement) - See Also:
-
getScriptInstance
public abstract GhidraScript getScriptInstance(ResourceFile sourceFile, PrintWriter writer) throws GhidraScriptLoadException Description copied from class:GhidraScriptProviderReturns a GhidraScript instance for the specified source file.- Specified by:
getScriptInstancein classGhidraScriptProvider- Parameters:
sourceFile- the source filewriter- the print writer to write warning/error messages. If the error prevents success, throw an exception instead. The caller will print the error.- Returns:
- a GhidraScript instance for the specified source file
- Throws:
GhidraScriptLoadException- when the script instance cannot be created
-
createNewScript
Description copied from class:GhidraScriptProviderCreates a new script using the specified file.- Specified by:
createNewScriptin classGhidraScriptProvider- Parameters:
newScript- the new script filecategory- the script category- Throws:
IOException- if an error occurs writing the file
-
getBlockCommentStart
Returns a Pattern that matches block comment openings.If block comments are not supported by this provider, then this returns null.
In Python this is a triple single quote sequence, "'''".
- Overrides:
getBlockCommentStartin classGhidraScriptProvider- Returns:
- the Pattern for Python block comment openings
-
getBlockCommentEnd
Returns a Pattern that matches block comment closings.If block comments are not supported by this provider, then this returns null.
In Python this is a triple single quote sequence, "'''".
- Overrides:
getBlockCommentEndin classGhidraScriptProvider- Returns:
- the Pattern for Python block comment openings
-
getCommentCharacter
Description copied from class:GhidraScriptProviderReturns the comment character.For example, "//" or "#".
- Specified by:
getCommentCharacterin classGhidraScriptProvider- Returns:
- the comment character
-
getCertifyHeaderStart
Description copied from class:GhidraScriptProviderReturn the start of certification header line if this file type is subject to certification.- Overrides:
getCertifyHeaderStartin classGhidraScriptProvider- Returns:
- start of certification header or null if not supported
-
getCertificationBodyPrefix
Description copied from class:GhidraScriptProviderReturn the prefix for each certification header body line if this file is subject to certification.- Overrides:
getCertificationBodyPrefixin classGhidraScriptProvider- Returns:
- certification header body prefix or null if not supported
-
getCertifyHeaderEnd
Description copied from class:GhidraScriptProviderReturn the end of certification header line if this file type is subject to certification.- Overrides:
getCertifyHeaderEndin classGhidraScriptProvider- Returns:
- end of certification header or null if not supported
-
getExtension
Description copied from class:GhidraScriptProviderReturns the file extension for this type of script.For example, ".java" or ".py".
- Specified by:
getExtensionin classGhidraScriptProvider- Returns:
- the file extension for this type of script
-