Skip to content

Instantly share code, notes, and snippets.

@aemmitt-ns
Created May 19, 2023 14:06
Show Gist options
  • Save aemmitt-ns/833ba6aeec540a19d66cb8827237f731 to your computer and use it in GitHub Desktop.
Save aemmitt-ns/833ba6aeec540a19d66cb8827237f731 to your computer and use it in GitHub Desktop.
program to dump out forbidden classes and selectors in NSPredicates
// dump classes and selectors forbidden in NSPredicates
// `cc -framework Foundation -o restricted restricted.m`
#import <Foundation/Foundation.h>
#import <dlfcn.h>
int main() {
void *cf = dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", 0);
NSDictionary* (*RestrictedClasses)() = dlsym(cf, "_CFPredicatePolicyRestrictedClasses");
NSDictionary* (*RestrictedSelectors)() = dlsym(cf, "_CFPredicatePolicyRestrictedSelectors");
NSLog(@"Restricted Selectors: %@", RestrictedSelectors());
NSLog(@"Restricted Classes: %@", RestrictedClasses());
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment