Skip to content

Instantly share code, notes, and snippets.

@miau
Created June 19, 2011 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miau/1033982 to your computer and use it in GitHub Desktop.
Save miau/1033982 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
class String
# offset 文字目から val の長さぶん val で置き換える
def write(offset, val)
self[offset, val.length] = val
end
end
base = File.open("base.exe", "rb").read
text = [0xb8, 123, 0xc3].pack("CIC")
base.write(0x180, [text.length].pack("I"))
base.write(0x200, text)
File.open("output.exe", "wb").write(base)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment