Class: Relyze::Library

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

Defined Under Namespace

Classes: Archive

Instance Method Summary collapse

Constructor Details

#initializeLibrary

Returns a new instance of Library.



169
170
# File 'C:/Program Files/Relyze/lib/relyze/core/application.rb', line 169

def initialize
end

Instance Method Details

#archives {|archive| ... } ⇒ Array<Relyze::Library::Archive>

Get every archive in the library

Examples:

Yield every archive in the library and print its name, path and saved date to the console.

@relyze.library.archives do | archive |
    print_message( "%s - %s - %s" % [ archive.name, archive.path, archive.saved ] )
end

Yields:

  • (archive)

    yields an archive to the block.

Yield Parameters:

Returns:



237
238
239
# File 'C:/Program Files/Relyze/lib/relyze/core/application.rb', line 237

def archives
    return nil
end

#load(archive_path, options = { :password => nil }) ⇒ Relyze::FileModel?

Load a previously saved archive. The loaded archive will not be available in the GUI. If you want to load an archive into the GUI, use analyze_file_dialog instead.

Examples:

Load an archive from the library

model = @relyze.library.archives do | archive |
    if( archive.tag?( 'Client1' ) )
        break @relyze.library.load( archive.path )
    end
end
if( not model.nil? )
    model.functions do | f |
        print_message( f )
    end
end

Parameters:

  • archive_path (String)

    The file path to the saved archive.

  • options (Hash) (defaults to: { :password => nil })

    The options to load the archive with.

Options Hash (options):

  • :password (String)

    A password for the loaded archive.

Returns:



223
224
225
# File 'C:/Program Files/Relyze/lib/relyze/core/application.rb', line 223

def load( archive_path, options={ :password => nil } )
    return nil
end

#save(model, options = { :tags => [''], :description => nil, :password => nil }) ⇒ true, false

Save a model to the library as an archive.

Examples:

Analyze a byte buffer and save to to the library.

model = @relyze.analyze_buffer(
    "\x90\x90\x90\xCC\x90\x90\x90",
    {
        :file_path      => 'file.bin',
        :analyze_code   => true,
        :arch           => :x86,
        :base_address   => 0x410000,
        :entrypoint_rva => 0
    }
)

@relyze.library.save(
    model,
    {
        :tags        => [ 'flat', 'foo' ],
        :description => 'This is a blob of code'
    }
)

Parameters:

  • model (Relyze::FileModel)
  • options (Hash) (defaults to: { :tags => [''], :description => nil, :password => nil })

    The options to save the archive with.

Options Hash (options):

  • :tags (Array)

    An array of tag names for the saved archive.

  • :description (String, nil)

    A description for the saved archive.

  • :password (String, nil)

    A password for the saved archive.

Returns:

  • (true, false)

    Returns true if the model was saved to the library or false if it was not.



200
201
202
# File 'C:/Program Files/Relyze/lib/relyze/core/application.rb', line 200

def save( model, options={ :tags => [''], :description => nil, :password => nil } )
    return nil
end