2006-04-15 20:26:41 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2008-02-09 04:35:21 +00:00
|
|
|
# $Id$
|
|
|
|
|
2008-02-13 02:43:56 +00:00
|
|
|
require 'rex/image_source'
|
2006-04-15 20:26:41 +00:00
|
|
|
require 'rex/peparsey/exceptions'
|
2008-02-13 02:43:56 +00:00
|
|
|
require 'rex/peparsey/pebase'
|
2006-04-15 20:26:41 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2008-10-19 21:03:39 +00:00
|
|
|
end end end
|