Skip to content

Instantly share code, notes, and snippets.

@jstanley0
Created February 20, 2014 04:01
Show Gist options
  • Save jstanley0/9106896 to your computer and use it in GitHub Desktop.
Save jstanley0/9106896 to your computer and use it in GitHub Desktop.
Convert microcorruption memory dump to binary
buffer = "".force_encoding("BINARY")
ARGF.each_line do |line|
addr, data = line.split(':', 2)
next unless data
addr = addr.to_i(16)
data = data[/(?:\h\h\h\h )+/]
next unless data
data = [data.gsub(' ', '')].pack("H*")
buffer << ("\0" * (addr - buffer.size))
buffer << data
end
STDOUT.write buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment