Class: Rex::ImageSource::Memory

Inherits:
Rex::ImageSource show all
Defined in:
lib/rex/image_source/memory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_rawdata, _file_offset = 0) ⇒ Memory

Returns a new instance of Memory.



15
16
17
18
19
# File 'lib/rex/image_source/memory.rb', line 15

def initialize(_rawdata, _file_offset = 0)
	self.rawdata     = _rawdata
	self.size        = _rawdata.length
	self.file_offset = _file_offset
end

Instance Attribute Details

#file_offsetObject

Returns the value of attribute file_offset.



13
14
15
# File 'lib/rex/image_source/memory.rb', line 13

def file_offset
  @file_offset
end

#rawdataObject

Returns the value of attribute rawdata.



13
14
15
# File 'lib/rex/image_source/memory.rb', line 13

def rawdata
  @rawdata
end

#sizeObject

Returns the value of attribute size.



13
14
15
# File 'lib/rex/image_source/memory.rb', line 13

def size
  @size
end

Instance Method Details

#closeObject



29
30
# File 'lib/rex/image_source/memory.rb', line 29

def close
end

#index(*args) ⇒ Object



32
33
34
# File 'lib/rex/image_source/memory.rb', line 32

def index(*args)
	rawdata.index(*args)
end

#read(offset, len) ⇒ Object



21
22
23
# File 'lib/rex/image_source/memory.rb', line 21

def read(offset, len)
	rawdata[offset, len]
end

#subsource(offset, len) ⇒ Object



25
26
27
# File 'lib/rex/image_source/memory.rb', line 25

def subsource(offset, len)
	self.class.new(rawdata[offset, len], offset + file_offset)
end