| # Script to remove EXEC flag from an ELF file |
| # Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net> |
| # This file may be distributed under the terms of the GNU GPLv3 license. |
| # Parse command-line arguments |
| usage = "%prog <input_file> <output_file>" |
| opts = optparse.OptionParser(usage) |
| options, args = opts.parse_args() |
| opts.error("Incorrect number of arguments") |
| infilename, outfilename = args |
| f = open(infilename, "rb") |
| outdata = bytearray(srcdata) |
| outdata[FLAG_OFFSET] = 0x01 # change ET_EXEC to ET_REL |
| f = open(outfilename, "wb") |
| if __name__ == '__main__': |