3 # Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 3
7 # as published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 if len(sys.argv) != 3 and len(sys.argv) != 2:
23 print "Usage: %s INPUT_FILE [OUTPUT_FILE]" % sys.argv[0]
28 if len(sys.argv) == 3:
33 asm = Disassembler(file(infile).read(), "").getAsm()
34 p = TextPatcher(asm, "c053515533b60977d212fbcfa4fc2546") # TODO adjust the MD5SUM
37 # Use p.addText() and p.delLine() for modifying the code
40 bin = Assembler(p.getText(), "--psize").getBinary()
41 file(outfile, "w").write(bin)
43 sys.stdout.write(p.getText())
46 print "Could not patch. Do you use the correct input file?"