Skip to content

Instantly share code, notes, and snippets.

@hexploitable
Last active October 18, 2022 08:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hexploitable/5a2318f89fb696da772430bfbb864cd9 to your computer and use it in GitHub Desktop.
Save hexploitable/5a2318f89fb696da772430bfbb864cd9 to your computer and use it in GitHub Desktop.
const dontTerminate =
[
'r2con.2020.CrackMe'
];
const FBSProcessTerminationRequest = ObjC.classes.FBSProcessTerminationRequest;
const terminateReq = FBSProcessTerminationRequest['+ requestForProcess:withLabel:']
var oldImpl = terminateReq.implementation;
terminateReq.implementation = ObjC.implement(terminateReq, function (handle, selector, process, label) {
const lbl = new ObjC.Object(label);
console.log('Reason: ' + lbl);
if (lbl == 'watchdog provision violated')
{
const proc = new ObjC.Object(process);
const bid = proc.$ivars._bundleIdentifier.toString()
var didMatch = false;
for (var i =0; i<dontTerminate.length;i++)
{
if (bid == dontTerminate[i])
{
didMatch = true;
}
}
if (didMatch)
{
console.log('They\'re trying to terminate us: ' + bid)
}
else {
return oldImpl(handle, selector, process, label);
}
}
else {
return oldImpl(handle, selector, process, label);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment