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.



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

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.



10
11
12
# File 'lib/rex/image_source/memory.rb', line 10

def file_offset
  @file_offset
end

#rawdataObject

Returns the value of attribute rawdata.



10
11
12
# File 'lib/rex/image_source/memory.rb', line 10

def rawdata
  @rawdata
end

#sizeObject

Returns the value of attribute size.



10
11
12
# File 'lib/rex/image_source/memory.rb', line 10

def size
  @size
end

Instance Method Details

#closeObject



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

def close
end

#index(*args) ⇒ Object



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

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

#read(offset, len) ⇒ Object



18
19
20
# File 'lib/rex/image_source/memory.rb', line 18

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

#subsource(offset, len) ⇒ Object



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

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