Class: Relyze::Plugin::Loader

Inherits:
Base
  • Object
show all
Defined in:
C:/Program Files/Relyze/lib/relyze/core/plugin.rb

Instance Attribute Summary

Attributes inherited from Base

#autorun_model, #information, #relyze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#abort_analysis, #authors, #can_run?, #current_model, #description, #get_persistent_value, #guid, #license, #name, #options, #origin, #print_error, #print_exception, #print_message, #print_warning, #references, #remove_task, #require_files, #restart_analysis, #set_persistent_value, #task_status, #version, #version_major, #version_minor

Constructor Details

#initialize(_information) ⇒ Loader

Returns a new instance of Loader



679
680
681
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 679

def initialize( _information )
    super( _information )
end

Class Method Details

.query(buffer) ⇒ Hash, NilClass

A class method to query if this plugin can load the data in the buffer.

Examples:

Query loading an MCLF binary.

def self.query( buffer )

    magic, version_minor, version_major = buffer.unpack( 'Vvv' )

    return nil if magic != 0x464C434D

    return nil if version_major != 2

    return {
        # required key-value pairs...
        :title        => 'MobiCore Load Format (MCLF)',
        :type         => :mclf,
        :arch         => :arm,
        :endian       => :little,
        # optional key-value pairs...
        :arch_mode    => :auto,   
        :platform     => :unknown,
        :base_address => 0
    }
end

Parameters:

  • buffer (String)

    The input buffer to query for loading.

Returns:

  • (Hash, NilClass)

    A hash representing the to be loaded model. Values for the :title, :type, :arch and :endian keys must be set.



714
715
716
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 714

def self.query( buffer )
    return nil
end

Instance Method Details

#loadTrueClass, FalseClass

Perform the actual loading of a binary.

Returns:



721
722
723
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 721

def load
    return false
end

#mainTrueClass, ...

The loader plugins main method, automatically called by the application.



728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 728

def main
    result = nil
    if( self.can_run? )
        begin
            result = self.load()
        rescue Relyze::AbortException
            print_warning( "Plugin '#{self.name}' aborting." )
            result = nil
        rescue Relyze::RestartException
            print_warning( "Plugin '#{self.name}' forcing restart." )
            result = nil
        rescue ::Exception => e
            print_exception( e )
            result = nil
        end
    end
    self.remove_task
    return result
end

#typeObject

Get this plugin type.



684
685
686
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 684

def type
    return :loader
end
6.5).