Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
new method introduced by iOS14
  • Loading branch information
ChiChou authored Jan 26, 2021
1 parent 4fe6300 commit 71999ef
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions agent/pkd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ export function jetsam(pid: number) {

export function skipPkdValidationFor(pid: number) {
if ('PKDPlugIn' in ObjC.classes) {
const method = ObjC.classes.PKDPlugIn['- allowForClient:'];
const original = method.implementation;
method.implementation = ObjC.implement(method, function(self, sel, conn) {
// race condition huh? we don't care
return pid === new ObjC.Object(conn).pid() ?
NULL : original(self, sel, conn);
})
const { PKDPlugIn } = ObjC.classes;
const canidates = ['- allowForClient:discoveryInstanceUUID:', '- allowForClient:'];
for (const name of canidates) {
const method = PKDPlugIn[name];
if (method) {
const original = method.implementation;
method.implementation = ObjC.implement(method, function(self, sel, conn) {
// race condition huh? we don't care
return pid === new ObjC.Object(conn).pid() ?
NULL : original(self, sel, conn);
})
break;
}
}
}
}

0 comments on commit 71999ef

Please sign in to comment.