Skip to content

Instantly share code, notes, and snippets.

View n00neimp0rtant's full-sized avatar

Scott Marnik n00neimp0rtant

View GitHub Profile
@n00neimp0rtant
n00neimp0rtant / gist:2170717
Created March 23, 2012 13:43
detect a cracked app
-(BOOL)appIsCracked
{
BOOL cracked = NO;
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSString* resourcePath = [[NSBundle mainBundle] resourcePath];
NSFileManager* fileManager = [NSFileManager defaultManager];
NSDictionary* iTunesMetadata = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/iTunesMetadata.plist", bundlePath]];
if([(NSString*)[iTunesMetadata objectForKey:@"appleId"] isEqualToString:@"steve@rim.jobs"])
@n00neimp0rtant
n00neimp0rtant / gist:2278942
Created April 1, 2012 21:35
user installed app directories
static NSString* pathForUserApplicationWithIdentifier(NSString* bundleIdentifier)
{
NSFileManager* manager = [[[NSFileManager alloc] init] autorelease];
NSArray* paths = [manager subpathsOfDirectoryAtPath:@"/var/mobile/Applications" error:nil];
for(NSString* path in paths)
{
NSDictionary* metadata = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/iTunesMetadata.plist]];
NSString* candidateID = [metadata objectForKey:@"softareVersionBundleId"];
if([candidateID isEqualToString:bundleIdentifier])
return path;
static NSString *test;
%hook SpringBoard
-(id)init {
id obj = %orig;
test = @"i'm from springboard";
return obj;
}
%end
@n00neimp0rtant
n00neimp0rtant / gist:8546721
Last active January 4, 2016 01:09
this is untested and might not even compile. if that's the case tell me whats wrong with it and i'll fix
// declaring the function pointer
int *(*cool_function_pointer)(int, char, float);
// ^ ^ ^ ^
// function's retval function parameters
// getting a pointer to the function
*(void **)(&cool_function_pointer) = dlsym(RTLD_DEFAULT, "cool_function_name");
// ^ ^ ^
// always void means "get func from hooked process" name of function in the binary (should appear as string in dasm)
@n00neimp0rtant
n00neimp0rtant / gist:27829d87118d984232a4
Last active May 24, 2019 15:10
UIVisualEffectView blur radius manipulation (new for iOS 9)
// iOS 9 allows you to animate between visual effects, which gives you the
// ability to manipulate the blur radius. this can be useful for animating
// a backdrop for a custom modal, and with a few tricks, can even be set
// indirectly, allowing you to "scrub" between them back and forth with
// a gesture, just like when you pull down Spotlight.
// these are the two effects you want to transition between
UIVisualEffect *startEffect = nil; // "nil" means no blur/tint/vibrancy (plain, fully-transparent view)
UIVisualEffect *endEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
@n00neimp0rtant
n00neimp0rtant / gist:9515611
Last active March 14, 2024 06:30
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname