diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-05-24 16:48:22 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-05-25 21:57:14 +0200 |
commit | 31c69b6ca1b91e7fd9fd8e14082fd2584c5f538c (patch) | |
tree | 16e789c7d68608831b498f41f54d9482b82a711a /batch/nullDataDirs.py |
first public release
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'batch/nullDataDirs.py')
-rwxr-xr-x | batch/nullDataDirs.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/batch/nullDataDirs.py b/batch/nullDataDirs.py new file mode 100755 index 0000000..02e8576 --- /dev/null +++ b/batch/nullDataDirs.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python2.7 + +import sys +import struct +import os + +def main(argv): + buf = bytearray() + with open(argv[0], "rb") as fin: + for line in fin: + buf += line + buf[0xF8:0x100] = '\x00' * (0x100-0xF8) # export table + buf[0x100:0x108] = '\x00' * (0x108-0x100) # import table + with open(argv[0], "wb") as fout: + fout.write(str(buf)) + +if __name__ == "__main__": + if len(sys.argv) < 2: + print os.path.basename(sys.argv[0]) + ' usage: ' + sys.argv[0] + ' [PE-FILE]' + sys.exit(1) + print os.path.basename(sys.argv[0]) + ': NULL\'ing Import/Export Data Directory Entries ..' + main(sys.argv[1:]) + sys.exit(0) |