2006-04-15 20:26:41 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'rex/peparsey/pebase'
|
|
|
|
require 'rex/peparsey/exceptions'
|
|
|
|
|
|
|
|
require 'rex/peparsey/image_source'
|
|
|
|
require 'rex/peparsey/section'
|
|
|
|
|
|
|
|
require 'rex/struct2'
|
|
|
|
|
|
|
|
#
|
|
|
|
# This class is for use with memdump.exe generated dump images. It basically
|
|
|
|
# just lies, gets the ImageBase from the file name, and generates 1 big
|
|
|
|
# header_section with all of the data in it...
|
|
|
|
#
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module PeParsey
|
|
|
|
class PeMemDump < PeBase
|
|
|
|
|
|
|
|
def self.new_from_string(data)
|
|
|
|
raise NotImplementError
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.new_from_file(filename, disk_backed = false)
|
|
|
|
if filename[-4, 4] != '.rng'
|
2007-03-27 01:56:19 +00:00
|
|
|
raise "Not a .rng file: #{filename}"
|
2006-04-15 20:26:41 +00:00
|
|
|
end
|
|
|
|
|
2007-04-03 02:42:30 +00:00
|
|
|
file = File.open(filename, 'rb')
|
2006-04-15 20:26:41 +00:00
|
|
|
|
|
|
|
if disk_backed
|
|
|
|
obj = ImageSource::Disk.new(file)
|
|
|
|
else
|
|
|
|
obj = ImageSource::Memory.new(file.read)
|
|
|
|
obj.close
|
|
|
|
end
|
|
|
|
|
|
|
|
return self.new(obj, filename[0, 8].hex)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(isource, base)
|
|
|
|
|
|
|
|
self._isource = isource
|
2007-03-27 01:56:19 +00:00
|
|
|
self.header_section = Section.new(isource, base, nil)
|
2006-04-15 20:26:41 +00:00
|
|
|
self.sections = [ ]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end end end
|
|
|
|
|