Sha256: 480c3ec34d90bcd67227be22d44d90ce69e8dc83400e771d4b5b202b8400d922

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: binary -*-

# $Id: memory.rb 15548 2012-06-29 06:08:20Z rapid7 $

require 'rex/image_source/image_source'
require 'rex/struct2'

module Rex
module ImageSource
class Memory < ImageSource

	attr_accessor :rawdata, :size, :file_offset

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

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

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

	def close
	end

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

end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/image_source/memory.rb
librex-0.0.66 lib/rex/image_source/memory.rb