Class GhidraScriptProvider

    • Constructor Detail

      • GhidraScriptProvider

        public GhidraScriptProvider()
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • deleteScript

        public boolean deleteScript​(ResourceFile scriptSource)
        Deletes the script file and unloads the script from the script manager.
        Parameters:
        scriptSource - the script source file
        Returns:
        true if the script was completely deleted and cleaned up
      • getDescription

        public abstract java.lang.String getDescription()
        Returns a description for this type of script.
        Returns:
        a description for this type of script
      • getExtension

        public abstract java.lang.String getExtension()
        Returns the file extension for this type of script. For example, ".java" or ".py".
        Returns:
        the file extension for this type of script
      • getScriptInstance

        public abstract GhidraScript getScriptInstance​(ResourceFile sourceFile,
                                                       java.io.PrintWriter writer)
                                                throws java.lang.ClassNotFoundException,
                                                       java.lang.InstantiationException,
                                                       java.lang.IllegalAccessException
        Returns a GhidraScript instance for the specified source file.
        Parameters:
        sourceFile - the source file
        writer - the print writer to write warning/error messages
        Returns:
        a GhidraScript instance for the specified source file
        Throws:
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
      • createNewScript

        public abstract void createNewScript​(ResourceFile newScript,
                                             java.lang.String category)
                                      throws java.io.IOException
        Creates a new script using the specified file.
        Parameters:
        newScript - the new script file
        category - the script category
        Throws:
        java.io.IOException - if an error occurs writing the file
      • getCommentCharacter

        public abstract java.lang.String getCommentCharacter()
        Returns the comment character. For example, "//" or "#".
        Returns:
        the comment character
      • writeHeader

        protected void writeHeader​(java.io.PrintWriter writer,
                                   java.lang.String category)
        Writes the script header. Include a place holder for each meta-data item.
        Parameters:
        writer - the print writer
        category - the default category
      • writeBody

        protected void writeBody​(java.io.PrintWriter writer)
        Writes the script body template.
        Parameters:
        writer - the print writer