class Rex::Exploitation::OpcodeDb::ImageModule

This class represents a particular image module including its name, segments, imports, exports, base address, and so on.

Attributes

base_address[R]

The preferred base address at which the module will load.

exports[R]

An array of Export instances.

image_size[R]

The size of the image mapping associated with the module in bytes.

imports[R]

An array of Import instances.

locale[R]

An instance of a Locale class that is associated with this module.

maj_maj_ver[R]

The module's major major version number (X.x.x.x).

maj_min_ver[R]

The module's major minor version number (x.X.x.x).

min_maj_ver[R]

The module's minor major version number (x.x.X.x).

min_min_ver[R]

The module's minor minor version number (x.x.x.X).

platforms[R]

An array of OsVersion instances.

segments[R]

An array of Segment instances.

timestamp[R]

The timestamp that the image was compiled (as a Time instance).

vendor[R]

The vendor that created the module.

Public Class Methods

new(hash) click to toggle source
# File lib/rex/exploitation/opcodedb.rb, line 193
def initialize(hash)
  super

  @locale       = Locale.create(hash['locale'])
  @maj_maj_ver  = hash['maj_maj_ver'].to_i
  @maj_min_ver  = hash['maj_min_ver'].to_i
  @min_maj_ver  = hash['min_maj_ver'].to_i
  @min_min_ver  = hash['min_min_ver'].to_i
  @timestamp    = Time.at(hash['timestamp'].to_i)
  @vendor       = hash['vendor']
  @base_address = hash['base_address'].to_i
  @image_size   = hash['image_size'].to_i

  @segments     = hash['segments'].map { |ent|
    Segment.new(ent)
  } if (hash['segments'])
  @imports     = hash['imports'].map { |ent|
    Import.new(ent)
  } if (hash['imports'])
  @exports     = hash['exports'].map { |ent|
    Export.new(ent)
  } if (hash['exports'])
  @platforms   = hash['platforms'].map { |ent|
    OsVersion.create(ent)
  } if (hash['platforms'])

  @segments  = [] unless(@segments)
  @imports   = [] unless(@imports)
  @exports   = [] unless(@exports)
  @platforms = [] unless(@platforms)
end