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 -*-
base = File.open("base.exe", "rb").read
# text->Misc.VirtualSize = 6;
base[0x180, 4] = [6].pack("I")
# 取り出すときは base[0x180, 4].unpack("I")
# image[0x200] = 0xb8;
# *(DWORD*)&image[0x201] = 123;
# image[0x205] = 0xc3;
base[0x200, 6] = [0xb8, 123, 0xc3].pack("CIC")
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