node/lib/metasm/samples/peldr.rb
def reprotect_sections
		@pe.sections.each { |s|
			p = ''
			p << 'r' if s.characteristics.include? 'MEM_READ'
			p << 'w' if s.characteristics.include? 'MEM_WRITE'
			p << 'x' if s.characteristics.include? 'MEM_EXECUTE'
			DL.memory_perm(@load_address + s.virtaddr, s.virtsize, p)
		}
	end
# reset original expected memory protections for the sections
# the IAT may reside in a readonly section, so call this only after all hook_imports
reset original expected memory protections for the sections
the IAT may reside in a readonly section, so call this only after all hook_imports
reset original expected memory protections for the sections the IAT may reside in a readonly section so call this only after all hook_imports
def reprotect_sections
		@pe.sections.each { |s|
			p = ''
			p << 'r' if s.characteristics.include? 'MEM_READ'
			p << 'w' if s.characteristics.include? 'MEM_WRITE'
			p << 'x' if s.characteristics.include? 'MEM_EXECUTE'
			DL.memory_perm(@load_address + s.virtaddr, s.virtsize, p)
		}
	end
def reprotect_sections @pe . sections . each { | s | p = '' p << 'r' if s . characteristics . include? 'MEM_READ' p << 'w' if s . characteristics . include? 'MEM_WRITE' p << 'x' if s . characteristics . include? 'MEM_EXECUTE' DL . memory_perm ( @load_address + s . virtaddr , s . virtsize , p ) } end
reset original expected memory protections for the sections
the IAT may reside in a readonly section, so call this only after all hook_imports
reset original expected memory protections for the sections the IAT may reside in a readonly section so call this only after all hook_imports