- UID
- 2
注册时间2004-12-1
阅读权限255
最后登录1970-1-1
总坛主
TA的每日心情 | 开心 2024-12-1 11:04 |
---|
签到天数: 12 天 [LV.3]偶尔看看II
|
//
// AppDelegate.m
// Loader For MacOSX
// Code By PiaoYun/P.Y.G
//
// Created by System Administrator on 10/24/14.
// Copyright (c) 2014 P.Y.G All rights reserved.
// https://www.chinapyg.com
// http://www.dllhook.com
#import "AppDelegate.h"
///////////////////////////////////////////////////////////////////////////////
// 动态库名称
#define DYLIB_NAME @"HookLib"
// 动态库类型
#define DYLIB_TYPE @"dylib"
// 待破解文件路径
#define FILE_PATH @"/private/var/root/Desktop/Reveal.app/Contents/MacOS/Reveal"
// BundleIdentifier
#define BUNDLE_IDENTIFIER @"com.ittybittyapps.Reveal"
///////////////////////////////////////////////////////////////////////////////
@implementation AppDelegate
-(void)bringToFrontApplicationWithBundleIdentifier:(NSString*)inBundleIdentifier
{
// 目标程序置前
NSArray* appsArray = [NSRunningApplication runningApplicationsWithBundleIdentifier:inBundleIdentifier];
if([appsArray count] > 0)
{
[[appsArray objectAtIndex:0] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
}
// 自杀
[[NSApplication sharedApplication] terminate:self];
}
-(void)launchApplicationWithPath:(NSString*)inPath andBundleIdentifier:(NSString*)inBundleIdentifier
{
if(inPath != nil)
{
NSString *dyldLibrary = [[NSBundle bundleForClass:[self class]] pathForResource:DYLIB_NAME ofType:DYLIB_TYPE];
NSString *launcherString = [NSString stringWithFormat:@"DYLD_INSERT_LIBRARIES=\"%@\" \"%@\" &", dyldLibrary, inPath];
system([launcherString UTF8String]);
// Bring it to front after a delay
[self performSelector:@selector(bringToFrontApplicationWithBundleIdentifier:) withObject:inBundleIdentifier afterDelay:1.0];
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSString *calculatorPath = FILE_PATH;
if([[NSFileManager defaultManager] fileExistsAtPath:calculatorPath])
[self launchApplicationWithPath:calculatorPath andBundleIdentifier:BUNDLE_IDENTIFIER];
}
@end
|
|