Class: Rex::Exploitation::OpcodeDb::ImageModule

Inherits:
Object
  • Object
show all
Extended by:
Cachable
Includes:
DbEntry
Defined in:
lib/rex/exploitation/opcodedb.rb

Overview

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

Defined Under Namespace

Classes: Export, Import, Segment

Instance Attribute Summary collapse

Attributes included from DbEntry

#id, #name

Attributes included from OpcodeResult

#hash

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Cachable

create, flush_cache, hash_key

Methods included from DbEntry

#filter_hash

Constructor Details

#initialize(hash) ⇒ ImageModule

Returns a new instance of ImageModule.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/rex/exploitation/opcodedb.rb', line 194

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

Instance Attribute Details

#base_addressObject (readonly)

The preferred base address at which the module will load.



257
258
259
# File 'lib/rex/exploitation/opcodedb.rb', line 257

def base_address
  @base_address
end

#exportsObject (readonly)

An array of Export instances.



273
274
275
# File 'lib/rex/exploitation/opcodedb.rb', line 273

def exports
  @exports
end

#image_sizeObject (readonly)

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



261
262
263
# File 'lib/rex/exploitation/opcodedb.rb', line 261

def image_size
  @image_size
end

#importsObject (readonly)

An array of Import instances.



269
270
271
# File 'lib/rex/exploitation/opcodedb.rb', line 269

def imports
  @imports
end

#localeObject (readonly)

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



229
230
231
# File 'lib/rex/exploitation/opcodedb.rb', line 229

def locale
  @locale
end

#maj_maj_verObject (readonly)

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



233
234
235
# File 'lib/rex/exploitation/opcodedb.rb', line 233

def maj_maj_ver
  @maj_maj_ver
end

#maj_min_verObject (readonly)

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



237
238
239
# File 'lib/rex/exploitation/opcodedb.rb', line 237

def maj_min_ver
  @maj_min_ver
end

#min_maj_verObject (readonly)

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



241
242
243
# File 'lib/rex/exploitation/opcodedb.rb', line 241

def min_maj_ver
  @min_maj_ver
end

#min_min_verObject (readonly)

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



245
246
247
# File 'lib/rex/exploitation/opcodedb.rb', line 245

def min_min_ver
  @min_min_ver
end

#platformsObject (readonly)

An array of OsVersion instances.



277
278
279
# File 'lib/rex/exploitation/opcodedb.rb', line 277

def platforms
  @platforms
end

#segmentsObject (readonly)

An array of Segment instances.



265
266
267
# File 'lib/rex/exploitation/opcodedb.rb', line 265

def segments
  @segments
end

#timestampObject (readonly)

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



249
250
251
# File 'lib/rex/exploitation/opcodedb.rb', line 249

def timestamp
  @timestamp
end

#vendorObject (readonly)

The vendor that created the module.



253
254
255
# File 'lib/rex/exploitation/opcodedb.rb', line 253

def vendor
  @vendor
end

Class Method Details

.hash_key(hash) ⇒ Object

:nodoc:



186
187
188
189
190
191
# File 'lib/rex/exploitation/opcodedb.rb', line 186

def hash_key(hash) # :nodoc:
  (hash['id'] || '') +
  (hash['segments'] || '').to_s +
  (hash['exports'] || '').to_s +
  (hash['imports'] || '').to_s
end