diff --git a/lib/libprocInfo.a b/lib/libprocInfo.a index bec9634..1fb38c5 100644 Binary files a/lib/libprocInfo.a and b/lib/libprocInfo.a differ diff --git a/procInfo.xcodeproj/project.pbxproj b/procInfo.xcodeproj/project.pbxproj index 8317484..fc045a8 100644 --- a/procInfo.xcodeproj/project.pbxproj +++ b/procInfo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 7D6E87771F3BD0FA00D6BD7C /* libprocInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D6E87761F3BD0FA00D6BD7C /* libprocInfo.a */; }; 7DD0A92D1F35A04B000EA15D /* ProcessMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD0A91F1F35A04B000EA15D /* ProcessMonitor.m */; }; 7DD0A92F1F35A04B000EA15D /* Binary.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD0A9211F35A04B000EA15D /* Binary.m */; }; 7DD0A9301F35A04B000EA15D /* Process.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD0A9221F35A04B000EA15D /* Process.m */; }; @@ -21,7 +22,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 7D6E876B1F392B3B00D6BD7C /* libprocInfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libprocInfo.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 7D6E87761F3BD0FA00D6BD7C /* libprocInfo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libprocInfo.a; path = lib/libprocInfo.a; sourceTree = SOURCE_ROOT; }; 7DD0A91F1F35A04B000EA15D /* ProcessMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProcessMonitor.m; path = procInfo/ProcessMonitor.m; sourceTree = SOURCE_ROOT; }; 7DD0A9211F35A04B000EA15D /* Binary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Binary.m; path = procInfo/Binary.m; sourceTree = SOURCE_ROOT; }; 7DD0A9221F35A04B000EA15D /* Process.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Process.m; path = procInfo/Process.m; sourceTree = SOURCE_ROOT; }; @@ -40,6 +41,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 7D6E87771F3BD0FA00D6BD7C /* libprocInfo.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -54,12 +56,21 @@ name = include; sourceTree = ""; }; + 7D6E87751F3BD0C200D6BD7C /* lib */ = { + isa = PBXGroup; + children = ( + 7D6E87761F3BD0FA00D6BD7C /* libprocInfo.a */, + ); + name = lib; + path = processMonitor; + sourceTree = ""; + }; 7D83A9DB1EB6465D001506F0 = { isa = PBXGroup; children = ( - 7D6E875D1F381BC600D6BD7C /* include */, 7D83A9E61EB6465D001506F0 /* src */, - 7D6E876B1F392B3B00D6BD7C /* libprocInfo.a */, + 7D6E875D1F381BC600D6BD7C /* include */, + 7D6E87751F3BD0C200D6BD7C /* lib */, ); sourceTree = ""; }; @@ -114,7 +125,7 @@ ); name = procInfo; productName = processMonitor; - productReference = 7D6E876B1F392B3B00D6BD7C /* libprocInfo.a */; + productReference = 7D6E87781F3BD0FA00D6BD7C /* libprocInfo.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ @@ -162,7 +173,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#copy library into top-level lib folder\ncp $CODESIGNING_FOLDER_PATH $SRCROOT/lib/"; + shellScript = "#move library into top-level lib folder\nmv $CODESIGNING_FOLDER_PATH $SRCROOT/lib/"; }; /* End PBXShellScriptBuildPhase section */ @@ -276,6 +287,10 @@ CODE_SIGN_IDENTITY = ""; DEVELOPMENT_TEAM = VBG97UB4TA; EXECUTABLE_PREFIX = lib; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/lib", + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -286,6 +301,10 @@ CODE_SIGN_IDENTITY = ""; DEVELOPMENT_TEAM = VBG97UB4TA; EXECUTABLE_PREFIX = lib; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/lib", + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/procInfo/Binary.m b/procInfo/Binary.m index f5464be..a12ce80 100644 --- a/procInfo/Binary.m +++ b/procInfo/Binary.m @@ -60,7 +60,7 @@ { //find app bundle from binary // ->likely not an application if this fails - appBundle = findAppBundle(path); + appBundle = PI_findAppBundle(path); } //found app bundle? diff --git a/procInfo/ProcessMonitor.m b/procInfo/ProcessMonitor.m index 06554e5..bbba3f4 100644 --- a/procInfo/ProcessMonitor.m +++ b/procInfo/ProcessMonitor.m @@ -51,10 +51,10 @@ { //make sure OS is supported // ->for now, OS X 10.8+ though could be earlier? - if(YES != isSupportedOS()) + if(YES != PI_isSupportedOS()) { //err msg - NSLog(@"ERROR: %@ is not a supported OS", getOSVersion()); + NSLog(@"ERROR: %@ is not a supported OS", PI_getOSVersion()); //unset self = nil; @@ -80,7 +80,7 @@ bail: self.processCallback = callback; //get OS version info - osVersionInfo = getOSVersion(); + osVersionInfo = PI_getOSVersion(); //for full monitoring, gotta be root and macOS 10.12.4 ('safe', as fixed kernel crash) if( (0 == geteuid()) && @@ -707,7 +707,7 @@ bail: //iterate over all pids // ->init process object w/ pid/path, etc - for(NSNumber* pid in enumerateProcesses()) + for(NSNumber* pid in PI_enumerateProcesses()) { //skip 'blank' pids if(0 == pid.unsignedShortValue) diff --git a/procInfo/Signing.m b/procInfo/Signing.m index f9f7bfa..2713db7 100644 --- a/procInfo/Signing.m +++ b/procInfo/Signing.m @@ -504,7 +504,7 @@ BOOL fromAppStore(NSString* path) { //find app bundle from binary // ->likely not an application if this fails - appBundle = findAppBundle(path); + appBundle = PI_findAppBundle(path); if(nil == appBundle) { //bail diff --git a/procInfo/Utilities.h b/procInfo/Utilities.h index 2a29d5d..e1dd696 100644 --- a/procInfo/Utilities.h +++ b/procInfo/Utilities.h @@ -14,23 +14,23 @@ //given a path to binary // parse it back up to find app's bundle -NSBundle* findAppBundle(NSString* binaryPath); +NSBundle* PI_findAppBundle(NSString* binaryPath); //check if current OS version is supported // ->for now, just...? -BOOL isSupportedOS(); +BOOL PI_isSupportedOS(); //get OS version -NSDictionary* getOSVersion(); +NSDictionary* PI_getOSVersion(); //enumerate all running processes -NSMutableArray* enumerateProcesses(); +NSMutableArray* PI_enumerateProcesses(); //given a bundle // ->find its executable -NSString* findAppBinary(NSString* appPath); +NSString* PI_findAppBinary(NSString* appPath); //sha256 a file -NSString* hashFile(NSString* filePath); +NSString* PI_hashFile(NSString* filePath); #endif diff --git a/procInfo/Utilities.m b/procInfo/Utilities.m index fb5e4cb..907d22b 100644 --- a/procInfo/Utilities.m +++ b/procInfo/Utilities.m @@ -19,7 +19,7 @@ #pragma clang diagnostic ignored "-Wdeprecated-declarations" //get OS version -NSDictionary* getOSVersion() +NSDictionary* PI_getOSVersion() { //os version info NSMutableDictionary* osVersionInfo = nil; @@ -82,7 +82,7 @@ bail: //is current OS version supported? // ->for now, just OS X 10.8+ -BOOL isSupportedOS() +BOOL PI_isSupportedOS() { //support flag BOOL isSupported = NO; @@ -91,7 +91,7 @@ BOOL isSupportedOS() NSDictionary* osVersionInfo = nil; //get OS version info - osVersionInfo = getOSVersion(); + osVersionInfo = PI_getOSVersion(); if(nil == osVersionInfo) { //bail @@ -121,7 +121,7 @@ bail: } //enumerate all running processes -NSMutableArray* enumerateProcesses() +NSMutableArray* PI_enumerateProcesses() { //status int status = -1; @@ -186,7 +186,7 @@ bail: //given a path to binary // ->parse it back up to find app's bundle -NSBundle* findAppBundle(NSString* binaryPath) +NSBundle* PI_findAppBundle(NSString* binaryPath) { //app's bundle NSBundle* appBundle = nil; @@ -230,7 +230,7 @@ NSBundle* findAppBundle(NSString* binaryPath) } //sha256 a file -NSString* hashFile(NSString* filePath) +NSString* PI_hashFile(NSString* filePath) { //file's contents NSData* fileContents = nil;