metasm/exe_format/autoexe.rb in metasm-1.0.3 vs metasm/exe_format/autoexe.rb in metasm-1.0.4
- old
+ new
@@ -35,10 +35,11 @@
end
end
# register a new binary file signature
def self.register_signature(sig, exe=nil, &b)
+ sig.force_encoding('binary') if sig.respond_to?(:force_encoding)
(@signatures ||= []) << [sig, exe || b]
end
def self.init_signatures(sig=[])
@signatures = sig
@@ -57,9 +58,10 @@
register_signature("\xca\xfe\xba\xbe") { UniversalBinary }
register_signature("dex\n") { DEX }
register_signature("dey\n") { DEY }
register_signature("\xfa\x70\x0e\x1f") { FatELF }
register_signature("\x50\x4b\x03\x04") { ZIP }
+register_signature("\0asm") { WasmFile }
register_signature('Metasm.dasm') { Disassembler }
# replacement for AutoExe where #load defaults to a Shellcode of the specified CPU
def self.orshellcode(cpu=nil, &b)
# here we create an anonymous subclass of AutoExe whose #unknown_sig is patched to return a Shellcode instead of raise()ing