Skip to content

Instantly share code, notes, and snippets.

@pa4373
Created March 9, 2014 20:19
Show Gist options
  • Save pa4373/9453987 to your computer and use it in GitHub Desktop.
Save pa4373/9453987 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
'''
This program simply flip cryptid to \x00, given offset.
WARNING: this will modify binary directly and without checking structure,
backup, and using with caution!
'''
import sys, os
def parse_arg(argv):
if len(argv) != 3:
print 'Usage: %s <Mach-O File> <cryptid offset>' % argv[0]
elif not 'Mach-O' in [i.rstrip() for i in os.popen('file %s' % argv[1])][0]:
print 'The first argument must be Mach-O binary file.'
else:
try:
offset = int(argv[2])
return open(argv[1], 'rb+'), offset
except ValueError:
print 'Invaild offset'
exit()
if __name__ == '__main__':
f, offset = parse_arg(sys.argv)
f.seek(offset)
f.write('\x00\x00\x00\x00')
f.close()
print "Flip cryptid located in %08X (%s) for %s" % (offset, offset, f.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment