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.



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

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.



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

def file_offset
  @file_offset
end

#rawdataObject

Returns the value of attribute rawdata.



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

def rawdata
  @rawdata
end

#sizeObject

Returns the value of attribute size.



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

def size
  @size
end

Instance Method Details

#closeObject



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

def close
end

#index(*args) ⇒ Object



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

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

#read(offset, len) ⇒ Object



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

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

#subsource(offset, len) ⇒ Object



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

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