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.



193
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
# 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

Instance Attribute Details

#base_addressObject (readonly)

The preferred base address at which the module will load.



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

def base_address
  @base_address
end

#exportsObject (readonly)

An array of Export instances.



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

def exports
  @exports
end

#image_sizeObject (readonly)

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



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

def image_size
  @image_size
end

#importsObject (readonly)

An array of Import instances.



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

def imports
  @imports
end

#localeObject (readonly)

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



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

def locale
  @locale
end

#maj_maj_verObject (readonly)

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



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

def maj_maj_ver
  @maj_maj_ver
end

#maj_min_verObject (readonly)

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



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

def maj_min_ver
  @maj_min_ver
end

#min_maj_verObject (readonly)

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



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

def min_maj_ver
  @min_maj_ver
end

#min_min_verObject (readonly)

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



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

def min_min_ver
  @min_min_ver
end

#platformsObject (readonly)

An array of OsVersion instances.



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

def platforms
  @platforms
end

#segmentsObject (readonly)

An array of Segment instances.



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

def segments
  @segments
end

#timestampObject (readonly)

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



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

def timestamp
  @timestamp
end

#vendorObject (readonly)

The vendor that created the module.



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

def vendor
  @vendor
end

Class Method Details

.hash_key(hash) ⇒ Object

:nodoc:



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

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