mirror of
https://github.com/objective-see/TaskExplorer.git
synced 2026-03-22 07:02:39 +00:00
Fixed crash, fixed dylib enumeration, and improved handling of dylibs now stored in dyld cache
This commit is contained in:
@@ -89,6 +89,8 @@
|
||||
//make app front
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
//TODO: remove
|
||||
/*
|
||||
//check that OS is supported
|
||||
if(YES != isSupportedOS())
|
||||
{
|
||||
@@ -98,6 +100,7 @@
|
||||
//exit
|
||||
exit(0);
|
||||
}
|
||||
*/
|
||||
|
||||
//check
|
||||
[self check4Update:nil];
|
||||
|
||||
@@ -52,6 +52,14 @@
|
||||
|
||||
//determine if its on disk
|
||||
self.notFound = ![[NSFileManager defaultManager] fileExistsAtPath:self.path];
|
||||
|
||||
//though maybe its in the dyld shared cache
|
||||
if( (YES == self.notFound) &&
|
||||
(isInSharedCache(self.path)) )
|
||||
{
|
||||
//unset
|
||||
self.notFound = NO;
|
||||
}
|
||||
|
||||
//get attributes
|
||||
self.attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.path error:nil];
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
}
|
||||
|
||||
//automatically invoked when window is loaded
|
||||
// ->set to white
|
||||
-(void)windowDidLoad
|
||||
{
|
||||
//super
|
||||
@@ -201,31 +200,18 @@
|
||||
// ->then hide window & kick off action
|
||||
{
|
||||
|
||||
//dispatch, then action
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.50 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
|
||||
//close window
|
||||
[self.window close];
|
||||
|
||||
//exec UI actions etc on main thread
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
//make sure app's key window is (still) front
|
||||
//dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.50 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
|
||||
[self.window close];
|
||||
|
||||
// Other UI updates
|
||||
[((AppDelegate*)[[NSApplication sharedApplication] delegate]).window makeKeyAndOrderFront:self];
|
||||
|
||||
//make sure app is (still) front
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
//call back into app delegate
|
||||
// ->kick off task enum, etc
|
||||
[((AppDelegate*)[[NSApplication sharedApplication] delegate]) go];
|
||||
|
||||
});
|
||||
});
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
//bail
|
||||
bail:
|
||||
|
||||
//free auth ref
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
CD1508DA21BA4B9D0081F1AF /* Update.m in Sources */ = {isa = PBXBuildFile; fileRef = CD1508D821BA4B9D0081F1AF /* Update.m */; };
|
||||
CD1508DC21BA4BAC0081F1AF /* UpdateWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD1508DB21BA4BAC0081F1AF /* UpdateWindow.xib */; };
|
||||
CD1508DF21BB13990081F1AF /* Signing.m in Sources */ = {isa = PBXBuildFile; fileRef = CD1508DD21BB13980081F1AF /* Signing.m */; };
|
||||
CD1D14EF21B7A67600FF7F4B /* Sentry.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = CD1D14EB21B7A5DB00FF7F4B /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
CD1D14F121B7A69300FF7F4B /* Sentry.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = CD1D14EB21B7A5DB00FF7F4B /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
CD1D14F321B8F2FC00FF7F4B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD1D14F221B8F2FC00FF7F4B /* Assets.xcassets */; };
|
||||
CD1D14F421B8F2FC00FF7F4B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD1D14F221B8F2FC00FF7F4B /* Assets.xcassets */; };
|
||||
CD3F4CE81AF5CF68002A2647 /* TaskEnumerator.m in Sources */ = {isa = PBXBuildFile; fileRef = CD3F4CE61AF5CF68002A2647 /* TaskEnumerator.m */; };
|
||||
@@ -150,7 +148,6 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
CD1D14EF21B7A67600FF7F4B /* Sentry.framework in Copy Frameworks */,
|
||||
);
|
||||
name = "Copy Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -161,7 +158,6 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
CD1D14F121B7A69300FF7F4B /* Sentry.framework in Copy Frameworks */,
|
||||
);
|
||||
name = "Copy Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -193,8 +189,8 @@
|
||||
7D73480C1BCB82C900CD7235 /* flaggedRed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = flaggedRed.png; path = images/flaggedRed.png; sourceTree = SOURCE_ROOT; };
|
||||
7D73480D1BCB82C900CD7235 /* flaggedRedBG.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = flaggedRedBG.png; path = images/flaggedRedBG.png; sourceTree = SOURCE_ROOT; };
|
||||
7D73480E1BCB82C900CD7235 /* flaggedRedOver.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = flaggedRedOver.png; path = images/flaggedRedOver.png; sourceTree = SOURCE_ROOT; };
|
||||
7DA5CA0D1C7AA8CB00627DD7 /* MachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MachO.h; path = ../MachO/MachOParser/MachO.h; sourceTree = "<group>"; };
|
||||
7DA5CA0E1C7AA8CB00627DD7 /* MachO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MachO.m; path = ../MachO/MachOParser/MachO.m; sourceTree = "<group>"; };
|
||||
7DA5CA0D1C7AA8CB00627DD7 /* MachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MachO.h; path = "../Mach-O/MachOParser/MachO.h"; sourceTree = "<group>"; };
|
||||
7DA5CA0E1C7AA8CB00627DD7 /* MachO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MachO.m; path = "../Mach-O/MachOParser/MachO.m"; sourceTree = "<group>"; };
|
||||
7DAA78071B903BF1004840B9 /* CustomTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomTextField.h; sourceTree = "<group>"; };
|
||||
7DAA78081B903BF1004840B9 /* CustomTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomTextField.m; sourceTree = "<group>"; };
|
||||
CD001B351AB903040089014A /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = images/logo.png; sourceTree = SOURCE_ROOT; };
|
||||
@@ -218,7 +214,6 @@
|
||||
CD1508DB21BA4BAC0081F1AF /* UpdateWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = UpdateWindow.xib; path = UI/UpdateWindow.xib; sourceTree = "<group>"; };
|
||||
CD1508DD21BB13980081F1AF /* Signing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Signing.m; sourceTree = SOURCE_ROOT; };
|
||||
CD1508DE21BB13980081F1AF /* Signing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Signing.h; sourceTree = SOURCE_ROOT; };
|
||||
CD1D14EB21B7A5DB00FF7F4B /* Sentry.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sentry.framework; path = Carthage/Build/Mac/Sentry.framework; sourceTree = "<group>"; };
|
||||
CD1D14F221B8F2FC00FF7F4B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = SOURCE_ROOT; };
|
||||
CD24FE7621C6FC3D00900B61 /* main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = main.h; sourceTree = SOURCE_ROOT; };
|
||||
CD3F4CE61AF5CF68002A2647 /* TaskEnumerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskEnumerator.m; sourceTree = SOURCE_ROOT; };
|
||||
@@ -417,7 +412,6 @@
|
||||
1D21BC4D172AF43D009D1CFD /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CD1D14EB21B7A5DB00FF7F4B /* Sentry.framework */,
|
||||
CD7FBF241B6EDAC000578C5D /* SystemConfiguration.framework */,
|
||||
CDF08CE91AC8D97B009B3423 /* Quartz.framework */,
|
||||
CD6095721A87067D00E091CD /* Security.framework */,
|
||||
@@ -731,6 +725,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = 1D21BC42172AF43D009D1CFD;
|
||||
@@ -1019,6 +1014,7 @@
|
||||
GCC_PREFIX_HEADER = "TaskExplorer-Prefix.pch";
|
||||
INFOPLIST_FILE = "TaskExplorer-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.5;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = TaskExplorer;
|
||||
PROVISIONING_PROFILE = "";
|
||||
@@ -1043,6 +1039,7 @@
|
||||
GCC_PREFIX_HEADER = "TaskExplorer-Prefix.pch";
|
||||
INFOPLIST_FILE = "TaskExplorer-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.5;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = TaskExplorer;
|
||||
PROVISIONING_PROFILE = "";
|
||||
|
||||
+9
-9
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23727" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23727"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -19,7 +19,7 @@
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="532" height="400"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1470" height="918"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="532" height="400"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
@@ -37,11 +37,11 @@
|
||||
<scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5if-J7-OZf">
|
||||
<rect key="frame" x="20" y="61" width="492" height="187"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="WiG-CC-JV3">
|
||||
<clipView key="contentView" drawsBackground="NO" id="WiG-CC-JV3">
|
||||
<rect key="frame" x="1" y="1" width="490" height="185"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textView ambiguous="YES" editable="NO" importsGraphics="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="j2X-Ub-niY">
|
||||
<textView editable="NO" importsGraphics="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="j2X-Ub-niY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="490" height="185"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -70,7 +70,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fZJ-sG-ZuJ">
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fZJ-sG-ZuJ">
|
||||
<rect key="frame" x="20" y="250" width="153" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Supporters/Patrons:" id="fJg-qw-wDf">
|
||||
@@ -79,7 +79,7 @@
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OSm-xS-Dmd">
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OSm-xS-Dmd">
|
||||
<rect key="frame" x="153" y="334" width="182" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Version:" id="bBK-v0-ypq">
|
||||
@@ -88,7 +88,7 @@
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" tag="101" translatesAutoresizingMaskIntoConstraints="NO" id="HZZ-Es-mpy">
|
||||
<button tag="101" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HZZ-Es-mpy">
|
||||
<rect key="frame" x="390" y="13" width="128" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="More Info" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="J9x-sM-h9S">
|
||||
@@ -99,7 +99,7 @@
|
||||
<action selector="buttonHandler:" target="-2" id="Cgx-f4-Thr"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" tag="100" translatesAutoresizingMaskIntoConstraints="NO" id="xnd-Gw-0o8">
|
||||
<button tag="100" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xnd-Gw-0o8">
|
||||
<rect key="frame" x="247" y="13" width="128" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Support Us!" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6g3-Pg-x3P">
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23727" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23727"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -20,7 +20,7 @@
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="422" height="123"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1470" height="918"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="422" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
@@ -35,7 +35,7 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="teText" id="Ws8-bD-j2R"/>
|
||||
</imageView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OSm-xS-Dmd">
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OSm-xS-Dmd">
|
||||
<rect key="frame" x="124" y="48" width="279" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="bBK-v0-ypq">
|
||||
|
||||
+8
-6
@@ -12,21 +12,19 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern bool _dyld_shared_cache_contains_path(const char* path);
|
||||
|
||||
|
||||
/* FUNCTIONS */
|
||||
|
||||
//disable std err
|
||||
void disableSTDERR(void);
|
||||
//TODO: remove unneeded items
|
||||
|
||||
//loads a framework
|
||||
// note: assumes it is in 'Framework' dir
|
||||
NSBundle* loadFramework(NSString* name);
|
||||
|
||||
//init crash reporting
|
||||
void initCrashReporting(void);
|
||||
|
||||
//check if OS is supported
|
||||
BOOL isSupportedOS(void);
|
||||
//BOOL isSupportedOS(void);
|
||||
|
||||
//get OS's major or minor version
|
||||
SInt32 getVersion(OSType selector);
|
||||
@@ -98,4 +96,8 @@ BOOL isDarkMode();
|
||||
//bring an app to foreground (to get an icon in the dock) or background
|
||||
void transformProcess(ProcessApplicationTransformState location);
|
||||
|
||||
//check if file is in shared cache
|
||||
// uses private _dyld_shared_cache_contains_path API
|
||||
BOOL isInSharedCache(NSString* path);
|
||||
|
||||
#endif
|
||||
|
||||
+19
-78
@@ -1,12 +1,11 @@
|
||||
//
|
||||
// Utilities.m
|
||||
// DHS
|
||||
// TaskExplorer
|
||||
//
|
||||
// Created by Patrick Wardle on 2/7/15.
|
||||
// Copyright (c) 2015 Objective-See. All rights reserved.
|
||||
//
|
||||
|
||||
@import Sentry;
|
||||
|
||||
#import "Consts.h"
|
||||
#import "Utilities.h"
|
||||
@@ -24,6 +23,8 @@
|
||||
#import <Collaboration/Collaboration.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
//TODO: remove
|
||||
/*
|
||||
//disable std err
|
||||
void disableSTDERR()
|
||||
{
|
||||
@@ -42,54 +43,6 @@ void disableSTDERR()
|
||||
return;
|
||||
}
|
||||
|
||||
//init crash reporting
|
||||
void initCrashReporting()
|
||||
{
|
||||
//sentry
|
||||
NSBundle *sentry = nil;
|
||||
|
||||
//error
|
||||
NSError* error = nil;
|
||||
|
||||
//class
|
||||
Class SentryClient = nil;
|
||||
|
||||
//load senty
|
||||
sentry = loadFramework(@"Sentry.framework");
|
||||
if(nil == sentry)
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//get client class
|
||||
SentryClient = NSClassFromString(@"SentryClient");
|
||||
if(nil == SentryClient)
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//set shared client
|
||||
[SentryClient setSharedClient:[[SentryClient alloc] initWithDsn:CRASH_REPORTING_URL didFailWithError:&error]];
|
||||
if(nil != error)
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//start crash handler
|
||||
[[SentryClient sharedClient] startCrashHandlerWithError:&error];
|
||||
if(nil != error)
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
bail:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//loads a framework
|
||||
// note: assumes it is in 'Framework' dir
|
||||
@@ -169,6 +122,8 @@ bail:
|
||||
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
//get OS's major or minor version
|
||||
SInt32 getVersion(OSType selector)
|
||||
@@ -1329,37 +1284,13 @@ NSMutableArray* expandPaths(const __strong NSString* const paths[], int count)
|
||||
return expandedPaths;
|
||||
}
|
||||
|
||||
//check if (full) dark mode
|
||||
// meaning, Mojave+ and dark mode enabled
|
||||
BOOL isDarkMode()
|
||||
//dark mode?
|
||||
BOOL isDarkMode(void)
|
||||
{
|
||||
//flag
|
||||
BOOL darkMode = NO;
|
||||
|
||||
//prior to mojave?
|
||||
// bail, since not true dark mode
|
||||
if( (YES != [NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)]) ||
|
||||
(YES != [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 14, 0}]) )
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//not dark mode?
|
||||
if(YES != [[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqualToString:@"Dark"])
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//ok, mojave dark mode it is!
|
||||
darkMode = YES;
|
||||
|
||||
bail:
|
||||
|
||||
return darkMode;
|
||||
return [NSApp.effectiveAppearance.name isEqualToString:NSAppearanceNameDarkAqua];
|
||||
}
|
||||
|
||||
|
||||
//bring an app to foreground (to get an icon in the dock) or background
|
||||
void transformProcess(ProcessApplicationTransformState location)
|
||||
{
|
||||
@@ -1379,3 +1310,13 @@ void transformProcess(ProcessApplicationTransformState location)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//check if file is in shared cache
|
||||
// uses private _dyld_shared_cache_contains_path API
|
||||
BOOL isInSharedCache(NSString* path)
|
||||
{
|
||||
if (@available(macOS 11.0, *)) {
|
||||
return _dyld_shared_cache_contains_path(path.UTF8String);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -15,13 +15,6 @@ int main(int argc, char *argv[])
|
||||
//return
|
||||
int status = -1;
|
||||
|
||||
//disable stderr
|
||||
// sentry dumps to this, and we want only JSON to output...
|
||||
disableSTDERR();
|
||||
|
||||
//init crash reporting
|
||||
initCrashReporting();
|
||||
|
||||
//untranslocated URL
|
||||
NSURL* untranslocatedURL = nil;
|
||||
|
||||
|
||||
@@ -125,10 +125,7 @@ int main(int argc, const char *argv[])
|
||||
|
||||
//listener
|
||||
NSXPCListener* listener = nil;
|
||||
|
||||
//init crash reporting
|
||||
initCrashReporting();
|
||||
|
||||
|
||||
//make really r00t
|
||||
// ->needed for exec'ing vmmap, etc
|
||||
if(0 != setuid(0))
|
||||
|
||||
@@ -226,46 +226,15 @@ bail:
|
||||
}
|
||||
|
||||
//enumerate dylibs for a specified task
|
||||
// ->dylibs returned in array arg
|
||||
-(void)enumerateDylibs:(NSNumber*)taskPID withReply:(void (^)(NSMutableArray *))reply
|
||||
{
|
||||
//dylibs
|
||||
NSMutableArray* dylibPaths = nil;
|
||||
|
||||
//minor OS X version
|
||||
SInt32 versionMinor = 0;
|
||||
|
||||
//get minor version
|
||||
versionMinor = getVersion(gestaltSystemVersionMinor);
|
||||
|
||||
//when OS version is older then el capitan
|
||||
// read memory directly to get list of loaded dylibs
|
||||
if(versionMinor < OS_MINOR_VERSION_EL_CAPITAN)
|
||||
//skip self
|
||||
// 'vmmap' suspends the process
|
||||
if(taskPID.intValue != getpid())
|
||||
{
|
||||
//enum dylibs
|
||||
dylibPaths = [self enumerateDylibsOld:(NSNumber*)taskPID];
|
||||
|
||||
reply([self enumerateDylibsNew:(NSNumber*)taskPID]);
|
||||
}
|
||||
//OS version is el capitan+
|
||||
// have to use vmmap, since we don't com.apple.system-task-ports entitlement
|
||||
else
|
||||
{
|
||||
//skip self
|
||||
// ...'vmmap' suspends the process
|
||||
if(taskPID.intValue == getpid())
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//enum dylibs
|
||||
dylibPaths = [self enumerateDylibsNew:(NSNumber*)taskPID];
|
||||
}
|
||||
|
||||
bail:
|
||||
|
||||
//invoke reply block
|
||||
reply(dylibPaths);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user