Skip to content

Instantly share code, notes, and snippets.

@ericcastro
Last active January 22, 2019 15:41
Show Gist options
  • Save ericcastro/fb38e33bef98deb86272 to your computer and use it in GitHub Desktop.
Save ericcastro/fb38e33bef98deb86272 to your computer and use it in GitHub Desktop.
handy script for injecting one-line cycript code in a process on your target device and exiting after execution.
#!/bin/sh
# Usage: ./cyexec <process> <code>
#
# Example #1 (Locks device):
#
# ./cyexec SpringBoard '[[SBUserAgent sharedUserAgent] lockAndDimDevice]'
#
# Example #2 (Shows an alert message):
#
# ./cyexec SpringBoard '[[[[UIAlertView alloc] initWithTitle:@"OH HAI" message:@"This is a test message!" delegate:nil cancelButtonTitle:@"Got it" otherButtonTitles:nil] autorelease] show]'
#
# Useful to automate arbitrary code execution in your theos Makefile (before-install, after-install, etc)
#
process=$1
shift
echo $* > /tmp/die && cycript -p $process /tmp/die; rm /tmp/die
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment