7 Commits
Author SHA1 Message Date
Patrick Wardle 237b19800f version 1.3.0 checkin 2018-09-26 14:40:10 +08:00
Patrick Wardle 0a7b73554a version # fix 2018-09-22 13:37:47 +08:00
Patrick Wardle 5201b4d2b7 XPC fixes, UI improvements 2018-09-22 13:37:35 +08:00
Patrick Wardle ffbd6139e0 project cleanup, ui tweaks 2018-09-09 12:23:44 -10:00
Patrick Wardle 4588cd5aee Friends of Objective-See 2018-09-03 19:07:01 -10:00
Patrick Wardle 651b61fef2 ui improvements (dark mode) 2018-09-02 17:16:13 -10:00
Patrick Wardle ff21b9867d mojave updates
-camera
 -permissions check/request
 -capture via login item

-birectional XPC

-project cleanup
2018-09-02 16:31:13 -10:00
77 changed files with 1870 additions and 2713 deletions
+2 -2
View File
@@ -1,2 +1,2 @@
github "DigitaSecurity/dnd" "master"
github "getsentry/sentry-cocoa" "3.12.0"
github "DigitaSecurity/dnd" "cameraUpdates"
github "getsentry/sentry-cocoa" "4.1.0"
+7 -7
View File
@@ -1,14 +1,14 @@
github "Alamofire/Alamofire" "4.7.2"
github "Alamofire/AlamofireImage" "3.3.1"
github "Alamofire/Alamofire" "4.7.3"
github "Alamofire/AlamofireImage" "75fadf98aab78c0829923dd496f369950aa32d6f"
github "DigitaSecurity/CocoaAsyncSocket" "79a11b7036d0a77ca95de42cc1c92b5a4c50f0c9"
github "DigitaSecurity/dnd" "02b4b2c6d495ebafda648e6ca6ebfbed7c20d0e7"
github "DigitaSecurity/dnd" "d9a93e985b83d537942e561f028e39b978cb56a5"
github "SnapKit/SnapKit" "4.0.0"
github "SwiftyJSON/SwiftyJSON" "4.1.0"
github "emaloney/CleanroomLogger" "5.1.0"
github "emqtt/CocoaMQTT" "4ef7bdcf3f0a754790dab8bff86dec67a695ee3c"
github "getsentry/sentry-cocoa" "3.12.0"
github "ninjaprox/NVActivityIndicatorView" "4.2.1"
github "emqtt/CocoaMQTT" "b851bdabc01dd98dda9781765ad510d818773819"
github "getsentry/sentry-cocoa" "4.1.0"
github "ninjaprox/NVActivityIndicatorView" "4.3.0"
github "radex/SwiftyTimer" "2.0.0"
github "realm/realm-cocoa" "v3.7.1"
github "realm/realm-cocoa" "11dd806fcaacd680d12d616b3a5e93d85bf942f9"
github "saoudrizwan/Disk" "0.3.3"
github "soffes/CommonCrypto" "v1.1.0"
+8 -3
View File
@@ -32,9 +32,14 @@
//super
[super windowDidLoad];
//make white
[self.window setBackgroundColor: NSColor.whiteColor];
//not in mojave dark mode?
// make window color white
if(YES != isDarkMode())
{
//make white
self.window.backgroundColor = NSColor.whiteColor;
}
//set version sting
self.versionLabel.stringValue = [NSString stringWithFormat:@"Version: %@", getAppVersion()];
+2 -2
View File
@@ -29,10 +29,10 @@ typedef void (^block)(NSNumber*);
@property(nonatomic) BOOL gotHelp;
//daemom comms object
@property(nonatomic, retain) HelperComms* xpcComms;
@property(nonatomic, retain)HelperComms* xpcComms;
//status msg
@property (nonatomic, weak) IBOutlet NSTextField *statusMsg;
@property (nonatomic, weak)IBOutlet NSTextField *statusMsg;
//about window controller
@property(nonatomic, retain)AboutWindowController* aboutWindowController;
+56 -1
View File
@@ -40,6 +40,17 @@
//start crash handler
[SentryClient.sharedClient startCrashHandlerWithError:nil];
//make sure system is supported (lid)
// if not, will inform user via alert
if(YES != [self isSupported])
{
//dbg msg
logMsg(LOG_ERR, @"device doesn't appear to have a lid (i.e. is unsupported)");
//exit
[NSApp terminate:self];
}
//alloc/init Config obj
configureObj = [[Configure alloc] init];
@@ -49,6 +60,51 @@
return;
}
//check if there's a lid
// if not, alert to tell user
-(BOOL)isSupported
{
//flag
BOOL supported = NO;
//alert
NSAlert* alert = nil;
//no lid
// can't support!
if(stateUnavailable == getLidState())
{
//init alert
alert = [[NSAlert alloc] init];
//set main text
alert.messageText = @"Unsupported Device";
//set informative text
alert.informativeText = [NSString stringWithFormat:@"'%@' does not appear to be a laptop", [[NSHost currentHost] localizedName]];
//add button
[alert addButtonWithTitle:@"Ok"];
//set style
alert.alertStyle = NSAlertStyleWarning;
//show it
[alert runModal];
//bail
goto bail;
}
//happy
supported = YES;
bail:
return supported;
}
//exit when last window is closed
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
@@ -86,7 +142,6 @@
return;
}
//menu handler for 'about'
-(IBAction)displayAboutWindow:(id)sender
{
@@ -15,12 +15,27 @@
}
/* PROPERTIES */
@property (weak, nonatomic) IBOutlet NSTextField *statusMsg;
@property (weak, nonatomic) IBOutlet NSButton *installButton;
@property (weak, nonatomic) IBOutlet NSButton *moreInfoButton;
@property (weak, nonatomic) IBOutlet NSButton *uninstallButton;
@property (weak, nonatomic) IBOutlet NSProgressIndicator *activityIndicator;
//config (main) view
@property (weak) IBOutlet NSView *configView;
//"friends of objective-see"
@property (strong, nonatomic) IBOutlet NSView *friendsView;
//status msg
@property (weak, nonatomic) IBOutlet NSTextField *statusMsg;
//install button
@property (weak, nonatomic) IBOutlet NSButton *installButton;
//more info button
@property (weak, nonatomic) IBOutlet NSButton *moreInfoButton;
//uninstall button
@property (weak, nonatomic) IBOutlet NSButton *uninstallButton;
//activity indicator (spinner)
@property (weak, nonatomic) IBOutlet NSProgressIndicator *activityIndicator;
/* METHODS */
+103 -44
View File
@@ -18,6 +18,7 @@
@synthesize statusMsg;
@synthesize moreInfoButton;
@synthesize friendsView;
//automatically called when nib is loaded
// just center window
@@ -54,7 +55,7 @@
self.window.title = [NSString stringWithFormat:@"Do Not Disturb (v. %@)", getAppVersion()];
//init status msg
[self.statusMsg setStringValue:@"evil maids: stay out! 🙅‍♀️🚪"];
self.statusMsg.stringValue = @"evil maids: stay out! 🙅‍♀️🚪";
//app already installed?
// enable 'uninstall' button
@@ -95,9 +96,14 @@
//make window front
[NSApp activateIgnoringOtherApps:YES];
//make white
[self.window setBackgroundColor: NSColor.whiteColor];
//not in mojave dark mode?
// make window color white
if(YES != isDarkMode())
{
//make white
self.window.backgroundColor = NSColor.whiteColor;
}
return;
}
@@ -105,42 +111,101 @@
//button handler for uninstall/install
-(IBAction)buttonHandler:(id)sender
{
//frame
NSRect frame = {0};
//action
NSInteger action = 0;
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"handling action click: %@", ((NSButton*)sender).title]);
//grab tag
//grab action
action = ((NSButton*)sender).tag;
//close?
// close window to trigger exit logic
if(action == ACTION_CLOSE_FLAG)
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"handling action click: %@ (tag: %ld)", ((NSButton*)sender).title, (long)action]);
//handle various actions
switch(action)
{
//close
[self.window close];
}
//disable 'x' button
// don't want user killing app during install/upgrade
[[self.window standardWindowButton:NSWindowCloseButton] setEnabled:NO];
//clear status msg
[self.statusMsg setStringValue:@""];
//force redraw of status msg
// sometime doesn't refresh (e.g. slow VM)
[self.statusMsg setNeedsDisplay:YES];
//invoke logic to install/uninstall
// do in background so UI doesn't block
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
case ACTION_CLOSE_FLAG:
[self.window close];
break;
//install/uninstall
[self lifeCycleEvent:action];
});
case ACTION_INSTALL_FLAG:
case ACTION_UNINSTALL_FLAG:
{
//disable 'x' button
// don't want user killing app during install/upgrade
[[self.window standardWindowButton:NSWindowCloseButton] setEnabled:NO];
//clear status msg
[self.statusMsg setStringValue:@""];
//force redraw of status msg
// sometime doesn't refresh (e.g. slow VM)
[self.statusMsg setNeedsDisplay:YES];
//invoke logic to install/uninstall
// do in background so UI doesn't block
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
//install/uninstall
[self lifeCycleEvent:action];
});
break;
}
//next
// show 'friends' view
case ACTION_NEXT_FLAG:
{
//unset window title
self.window.title = @"";
//get main window's frame
frame = self.window.contentView.frame;
//set origin to 0/0
frame.origin = CGPointZero;
//increase y offset
frame.origin.y += 5;
//reduce height
frame.size.height -= 5;
//pre-req
[self.friendsView setWantsLayer:YES];
//update overlay to take up entire window
self.friendsView.frame = frame;
//not in mojave dark mode?
// make window color white
if(YES != isDarkMode())
{
//set white
self.friendsView.layer.backgroundColor = [NSColor whiteColor].CGColor;
}
//update config view
self.window.contentView = self.friendsView;
//show
self.friendsView.hidden = NO;
//draw
self.friendsView.needsDisplay = YES;
}
default:
break;
}
return;
}
@@ -293,18 +358,13 @@
{
//set result msg
resultMsg = [NSMutableString stringWithFormat:@"Do Not Disturb %@ed!", action];
//set font to black
resultMsgColor = [NSColor blackColor];
}
//failure
else
{
//set result msg
resultMsg = [NSMutableString stringWithFormat:@"error: %@ failed", action];
//set font to red
resultMsgColor = [NSColor redColor];
resultMsg = [NSMutableString stringWithFormat:@"Error: %@ failed", action];
//show 'get more info' button
self.moreInfoButton.hidden = NO;
@@ -334,12 +394,11 @@
//set status msg
[self.statusMsg setStringValue:resultMsg];
//set button to close
self.installButton.title = ACTION_CLOSE;
//set button to 'next'
self.installButton.title = ACTION_NEXT;
//update it's tag
// will allow button handler method to detect the close
self.installButton.tag = -1;
//set tag to next
self.installButton.tag = ACTION_NEXT_FLAG;
//enable
self.installButton.enabled = YES;
+40 -36
View File
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConfigureWindowController">
<connections>
<outlet property="activityIndicator" destination="b1w-5W-ayX" id="P5e-PO-Ozi"/>
<outlet property="configView" destination="se5-gp-TjO" id="F8t-Xo-OlH"/>
<outlet property="friendsView" destination="PmP-2C-4wF" id="INT-Fp-t78"/>
<outlet property="installButton" destination="553-2y-kvm" id="nxf-wO-EI3"/>
<outlet property="moreInfoButton" destination="QWu-qZ-Za2" id="8kC-Ga-5oJ"/>
<outlet property="statusMsg" destination="SpB-Xc-WlB" id="jlm-ke-XfM"/>
@@ -18,11 +20,11 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="460" height="176"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="460" height="176"/>
<autoresizingMask key="autoresizingMask"/>
@@ -90,44 +92,45 @@
</connections>
<point key="canvasLocation" x="185" y="-256"/>
</window>
<customView id="PmP-2C-4wF" userLabel="Support">
<customView id="PmP-2C-4wF" userLabel="Friends">
<rect key="frame" x="0.0" y="0.0" width="460" height="176"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f0f-aN-ikB">
<rect key="frame" x="0.0" y="73" width="460" height="95"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MGz-6K-qG8">
<rect key="frame" x="18" y="142" width="424" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Mahalo to the &quot;Friends of Objective-See&quot;" id="7Bp-jO-RQc">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tSv-y3-y5e">
<rect key="frame" x="80" y="27" width="138" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Digita Security" id="Jb9-oJ-xk4">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eld-oV-6lG">
<rect key="frame" x="117" y="54" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="objectiveSee" id="8Lr-Ox-eyh"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="digita" id="wJq-yW-MBL"/>
</imageView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Euc-W6-dQ1" userLabel="No">
<rect key="frame" x="216" y="13" width="115" height="32"/>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MBu-V2-MAX">
<rect key="frame" x="286" y="54" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="No" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8ir-Qw-y4G">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="malwarebytes" id="DiU-Xn-tkq"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SDE-Qu-lcq">
<rect key="frame" x="249" y="27" width="138" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Malwarebytes" id="p1n-KZ-bj5">
<font key="font" size="13" name="Menlo-Regular"/>
</buttonCell>
<connections>
<action selector="buttonHandler:" target="-2" id="uik-ZX-MTQ"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9Sm-sm-Qzm" userLabel="Yes">
<rect key="frame" x="331" y="13" width="115" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Yes!" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ezp-te-R3O">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="Menlo-Regular"/>
</buttonCell>
<connections>
<action selector="buttonHandler:" target="-2" id="Yea-Bv-dgb"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xaj-ED-vIC">
<rect key="frame" x="144" y="60" width="306" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="support our free tools?" id="KSy-eB-CzB">
<font key="font" size="17" name="Menlo-Bold"/>
<color key="textColor" white="0.25" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
@@ -135,8 +138,9 @@
</customView>
</objects>
<resources>
<image name="digita" width="334" height="338"/>
<image name="dndIcon" width="256" height="256"/>
<image name="dndText" width="164.57142639160156" height="21.188571929931641"/>
<image name="objectiveSee" width="943" height="236"/>
<image name="malwarebytes" width="300" height="267"/>
</resources>
</document>
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+2 -2
View File
@@ -13,11 +13,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2018 Objective-See</string>
<key>NSMainNibFile</key>
+1 -1
View File
@@ -9,7 +9,7 @@
<key>CFBundleName</key>
<string>helper</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2018 Objective-See</string>
<key>SMAuthorizedClients</key>
+34 -5
View File
@@ -38,6 +38,8 @@
CDAAC24B20226DFB0032F2E6 /* objectiveSee.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC24720226DFB0032F2E6 /* objectiveSee.png */; };
CDAAC24C20226DFB0032F2E6 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC24820226DFB0032F2E6 /* logo.png */; };
CDAAC24D20226DFB0032F2E6 /* dndIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC24920226DFB0032F2E6 /* dndIcon.png */; };
CDFA08CF213E3C280089758C /* malwarebytes.png in Resources */ = {isa = PBXBuildFile; fileRef = CDFA08CD213E3C280089758C /* malwarebytes.png */; };
CDFA08D1213E3DD50089758C /* digita.png in Resources */ = {isa = PBXBuildFile; fileRef = CDFA08D0213E3DD50089758C /* digita.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -73,6 +75,16 @@
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
CDD3ADF42135285B004F805F /* Copy Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -117,6 +129,8 @@
CDAAC24820226DFB0032F2E6 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = ../../shared/images/logo.png; sourceTree = "<group>"; };
CDAAC24920226DFB0032F2E6 /* dndIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dndIcon.png; path = ../../shared/images/dndIcon.png; sourceTree = "<group>"; };
CDAAC24A20226DFB0032F2E6 /* dndText.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dndText.png; path = ../../shared/images/dndText.png; sourceTree = "<group>"; };
CDFA08CD213E3C280089758C /* malwarebytes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = malwarebytes.png; path = Images/malwarebytes.png; sourceTree = "<group>"; };
CDFA08D0213E3DD50089758C /* digita.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = digita.png; path = Images/digita.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -178,6 +192,7 @@
4BE4904710445D49006BE471 /* Configure */ = {
isa = PBXGroup;
children = (
CDFA08CB213E3C170089758C /* Images */,
CD3307AD203567D400F10D71 /* Assets.xcassets */,
CD17D54420104EE700F798D7 /* AboutWindow.xib */,
CD17D54220104EE600F798D7 /* AboutWindowController.h */,
@@ -254,6 +269,15 @@
name = Images;
sourceTree = "<group>";
};
CDFA08CB213E3C170089758C /* Images */ = {
isa = PBXGroup;
children = (
CDFA08D0213E3DD50089758C /* digita.png */,
CDFA08CD213E3C280089758C /* malwarebytes.png */,
);
name = Images;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -263,6 +287,7 @@
buildPhases = (
4BE4905A10445E0A006BE471 /* Sources */,
4BE4905B10445E0A006BE471 /* Frameworks */,
CDD3ADF42135285B004F805F /* Copy Frameworks */,
);
buildRules = (
);
@@ -301,7 +326,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1000;
TargetAttributes = {
4BE4905C10445E0A006BE471 = {
DevelopmentTeam = VBG97UB4TA;
@@ -345,6 +370,8 @@
CD17D54E20104EE700F798D7 /* AboutWindow.xib in Resources */,
CD3307AE203567D500F10D71 /* Assets.xcassets in Resources */,
CD17D55120104EE700F798D7 /* ConfigureWindowController.xib in Resources */,
CDFA08CF213E3C280089758C /* malwarebytes.png in Resources */,
CDFA08D1213E3DD50089758C /* digita.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -412,9 +439,10 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = VBG97UB4TA;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO;
INFOPLIST_FILE = Helper/Info.plist;
OTHER_LDFLAGS = (
@@ -440,9 +468,10 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = VBG97UB4TA;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO;
INFOPLIST_FILE = Helper/Info.plist;
OTHER_LDFLAGS = (
@@ -530,7 +559,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: Objective-See, LLC (VBG97UB4TA)";
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -582,7 +611,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: Objective-See, LLC (VBG97UB4TA)";
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
@@ -84,7 +84,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
+2 -4
View File
@@ -15,15 +15,13 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Objective-See. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
<key>NSCameraUsageDescription</key>
<string></string>
<key>LSUIElement</key>
<true/>
</dict>
@@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
209E459F203DF5D500900B89 /* Do Not Disturb in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7D7755D01F02DF9500D0017D /* Do Not Disturb */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
209E45B0203DF64E00900B89 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A2203DF64E00900B89 /* Realm.framework */; };
209E45B1203DF64E00900B89 /* AlamofireImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A3203DF64E00900B89 /* AlamofireImage.framework */; };
209E45B2203DF64E00900B89 /* CleanroomLogger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A4203DF64E00900B89 /* CleanroomLogger.framework */; };
@@ -19,33 +18,31 @@
209E45B9203DF64E00900B89 /* CocoaMQTT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AB203DF64E00900B89 /* CocoaMQTT.framework */; };
209E45BB203DF64E00900B89 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AD203DF64E00900B89 /* RealmSwift.framework */; };
209E45BC203DF64E00900B89 /* dnd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AE203DF64E00900B89 /* dnd.framework */; };
20C87249204609A900F1275D /* Alamofire.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A7203DF64E00900B89 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724A204609A900F1275D /* AlamofireImage.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A3203DF64E00900B89 /* AlamofireImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724C204609A900F1275D /* CleanroomLogger.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A4203DF64E00900B89 /* CleanroomLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724D204609A900F1275D /* CocoaAsyncSocket.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A5203DF64E00900B89 /* CocoaAsyncSocket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724E204609A900F1275D /* CocoaMQTT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45AB203DF64E00900B89 /* CocoaMQTT.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724F204609A900F1275D /* CommonCrypto.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A6203DF64E00900B89 /* CommonCrypto.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87250204609A900F1275D /* dnd.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45AE203DF64E00900B89 /* dnd.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87252204609A900F1275D /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A2203DF64E00900B89 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87253204609A900F1275D /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45AD203DF64E00900B89 /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87255204609A900F1275D /* SwiftyJSON.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45AA203DF64E00900B89 /* SwiftyJSON.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87256204609A900F1275D /* SwiftyTimer.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 209E45A8203DF64E00900B89 /* SwiftyTimer.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8725B20460A7E00F1275D /* deviceCSRRequest.p12 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 20C8725820460A7D00F1275D /* deviceCSRRequest.p12 */; };
20C8725C20460A7E00F1275D /* rootCA.pem in CopyFiles */ = {isa = PBXBuildFile; fileRef = 20C8725920460A7E00F1275D /* rootCA.pem */; };
20C8725D20460A7E00F1275D /* awsRootCA.pem in CopyFiles */ = {isa = PBXBuildFile; fileRef = 20C8725A20460A7E00F1275D /* awsRootCA.pem */; };
7D46FEFF1F5E41F000FEB0F8 /* UserCommsListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D46FEFD1F5E41F000FEB0F8 /* UserCommsListener.m */; };
20C87249204609A900F1275D /* Alamofire.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A7203DF64E00900B89 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724A204609A900F1275D /* AlamofireImage.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A3203DF64E00900B89 /* AlamofireImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724C204609A900F1275D /* CleanroomLogger.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A4203DF64E00900B89 /* CleanroomLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724D204609A900F1275D /* CocoaAsyncSocket.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A5203DF64E00900B89 /* CocoaAsyncSocket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724E204609A900F1275D /* CocoaMQTT.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AB203DF64E00900B89 /* CocoaMQTT.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8724F204609A900F1275D /* CommonCrypto.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A6203DF64E00900B89 /* CommonCrypto.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87250204609A900F1275D /* dnd.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AE203DF64E00900B89 /* dnd.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87252204609A900F1275D /* Realm.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A2203DF64E00900B89 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87253204609A900F1275D /* RealmSwift.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AD203DF64E00900B89 /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87255204609A900F1275D /* SwiftyJSON.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45AA203DF64E00900B89 /* SwiftyJSON.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C87256204609A900F1275D /* SwiftyTimer.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 209E45A8203DF64E00900B89 /* SwiftyTimer.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
20C8725B20460A7E00F1275D /* deviceCSRRequest.p12 in Copy Certs */ = {isa = PBXBuildFile; fileRef = 20C8725820460A7D00F1275D /* deviceCSRRequest.p12 */; };
20C8725C20460A7E00F1275D /* rootCA.pem in Copy Certs */ = {isa = PBXBuildFile; fileRef = 20C8725920460A7E00F1275D /* rootCA.pem */; };
20C8725D20460A7E00F1275D /* awsRootCA.pem in Copy Certs */ = {isa = PBXBuildFile; fileRef = 20C8725A20460A7E00F1275D /* awsRootCA.pem */; };
7D46FEFF1F5E41F000FEB0F8 /* XPCListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D46FEFD1F5E41F000FEB0F8 /* XPCListener.m */; };
7D4FF8C41F0E1402001A4A68 /* libbsm.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D4FF8C31F0E1402001A4A68 /* libbsm.tbd */; };
7D4FF8CD1F0EF2F9001A4A68 /* UserComms.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4FF8CC1F0EF2F9001A4A68 /* UserComms.m */; };
7D4FF8CD1F0EF2F9001A4A68 /* XPCDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4FF8CC1F0EF2F9001A4A68 /* XPCDaemon.m */; };
7D6E87701F3AE6FA00D6BD7C /* libprocInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D6E876F1F3AE6FA00D6BD7C /* libprocInfo.a */; };
7D7755D41F02DF9500D0017D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7755D31F02DF9500D0017D /* main.m */; };
7D7755FC1F02EBBE00D0017D /* Logging.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7755FA1F02EBBE00D0017D /* Logging.m */; };
7DD2BF681F1DC42700B33214 /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2BF671F1DC42700B33214 /* Utilities.m */; };
7DD2BF761F1E9CE700B33214 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2BF731F1E9CE700B33214 /* NSMutableArray+QueueAdditions.m */; };
7DD2BF771F1E9CE700B33214 /* Queue.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2BF751F1E9CE700B33214 /* Queue.m */; };
CD20869B208E8F0200BA1D0A /* VolumeMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = CD208698208E8B1200BA1D0A /* VolumeMonitor.m */; };
CD20A0CA205793040044BCC5 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD20A0C9205793040044BCC5 /* Sentry.framework */; };
CD20A0CB205793100044BCC5 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD20A0C9205793040044BCC5 /* Sentry.framework */; };
CD20A0CC205793680044BCC5 /* Sentry.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CD20A0C9205793040044BCC5 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CD20A0CC205793680044BCC5 /* Sentry.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = CD20A0C9205793040044BCC5 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CD22786620463F0700C72C76 /* dnd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD22786420463EB000C72C76 /* dnd.framework */; };
CD22786C20464A6E00C72C76 /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = CD22786A204648E000C72C76 /* Preferences.m */; };
CD256E022050DE9B00768457 /* ProcListener.m in Sources */ = {isa = PBXBuildFile; fileRef = CD256E002050DE6600768457 /* ProcListener.m */; };
@@ -55,11 +52,9 @@
CD256E062050DE9B00768457 /* ThunderboltMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = CD256DF32050DE4C00768457 /* ThunderboltMonitor.m */; };
CD256E072050DE9B00768457 /* USBMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = CD256DF52050DE4C00768457 /* USBMonitor.m */; };
CD256E082050DE9B00768457 /* UserAuthMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = CD256DED2050DE4B00768457 /* UserAuthMonitor.m */; };
CD2C85F42119D9D5007CF784 /* LidTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = CD27BC6321139AD70017AEFD /* LidTrigger.m */; };
CD2C85F82119FC02007CF784 /* DeviceTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = CD2C85F52119FB2A007CF784 /* DeviceTrigger.m */; };
CD2C85FC211A0084007CF784 /* PowerTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = CD2C85FA211A006F007CF784 /* PowerTrigger.m */; };
CDA993A62048905D00C1E9CD /* FrameworkInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = CDA993A42048905D00C1E9CD /* FrameworkInterface.m */; };
CE60F9C91FC9BBE500EFFDDA /* Triggers.m in Sources */ = {isa = PBXBuildFile; fileRef = CE60F9C81FC9BBE500EFFDDA /* Triggers.m */; };
CDD3ADF3213527F1004F805F /* Do Not Disturb in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7D7755D01F02DF9500D0017D /* Do Not Disturb */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
CE60F9C91FC9BBE500EFFDDA /* Lid.m in Sources */ = {isa = PBXBuildFile; fileRef = CE60F9C81FC9BBE500EFFDDA /* Lid.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -73,57 +68,50 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
209E459E203DF5B200900B89 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 6;
files = (
209E459F203DF5D500900B89 /* Do Not Disturb in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
20C8722C2046079F00F1275D /* CopyFiles */ = {
20C8722C2046079F00F1275D /* Copy Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
CD20A0CC205793680044BCC5 /* Sentry.framework in CopyFiles */,
20C87249204609A900F1275D /* Alamofire.framework in CopyFiles */,
20C8724A204609A900F1275D /* AlamofireImage.framework in CopyFiles */,
20C8724C204609A900F1275D /* CleanroomLogger.framework in CopyFiles */,
20C8724D204609A900F1275D /* CocoaAsyncSocket.framework in CopyFiles */,
20C8724E204609A900F1275D /* CocoaMQTT.framework in CopyFiles */,
20C8724F204609A900F1275D /* CommonCrypto.framework in CopyFiles */,
20C87250204609A900F1275D /* dnd.framework in CopyFiles */,
20C87252204609A900F1275D /* Realm.framework in CopyFiles */,
20C87253204609A900F1275D /* RealmSwift.framework in CopyFiles */,
20C87255204609A900F1275D /* SwiftyJSON.framework in CopyFiles */,
20C87256204609A900F1275D /* SwiftyTimer.framework in CopyFiles */,
CD20A0CC205793680044BCC5 /* Sentry.framework in Copy Frameworks */,
20C87249204609A900F1275D /* Alamofire.framework in Copy Frameworks */,
20C8724A204609A900F1275D /* AlamofireImage.framework in Copy Frameworks */,
20C8724C204609A900F1275D /* CleanroomLogger.framework in Copy Frameworks */,
20C8724D204609A900F1275D /* CocoaAsyncSocket.framework in Copy Frameworks */,
20C8724E204609A900F1275D /* CocoaMQTT.framework in Copy Frameworks */,
20C8724F204609A900F1275D /* CommonCrypto.framework in Copy Frameworks */,
20C87250204609A900F1275D /* dnd.framework in Copy Frameworks */,
20C87252204609A900F1275D /* Realm.framework in Copy Frameworks */,
20C87253204609A900F1275D /* RealmSwift.framework in Copy Frameworks */,
20C87255204609A900F1275D /* SwiftyJSON.framework in Copy Frameworks */,
20C87256204609A900F1275D /* SwiftyTimer.framework in Copy Frameworks */,
);
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
20C8725720460A2300F1275D /* CopyFiles */ = {
20C8725720460A2300F1275D /* Copy Certs */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 7;
files = (
20C8725B20460A7E00F1275D /* deviceCSRRequest.p12 in CopyFiles */,
20C8725C20460A7E00F1275D /* rootCA.pem in CopyFiles */,
20C8725D20460A7E00F1275D /* awsRootCA.pem in CopyFiles */,
20C8725B20460A7E00F1275D /* deviceCSRRequest.p12 in Copy Certs */,
20C8725C20460A7E00F1275D /* rootCA.pem in Copy Certs */,
20C8725D20460A7E00F1275D /* awsRootCA.pem in Copy Certs */,
);
name = "Copy Certs";
runOnlyForDeploymentPostprocessing = 0;
};
7D7755CE1F02DF9500D0017D /* CopyFiles */ = {
CDD3ADF2213527E0004F805F /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 6;
files = (
CDD3ADF3213527F1004F805F /* Do Not Disturb in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
@@ -144,12 +132,11 @@
20C8725920460A7E00F1275D /* rootCA.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = rootCA.pem; sourceTree = "<group>"; };
20C8725A20460A7E00F1275D /* awsRootCA.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = awsRootCA.pem; sourceTree = "<group>"; };
7D2582591F1A872400D28B95 /* com.objective-see.dnd.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "com.objective-see.dnd.plist"; path = "launchDaemon/com.objective-see.dnd.plist"; sourceTree = "<group>"; };
7D46FEFD1F5E41F000FEB0F8 /* UserCommsListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserCommsListener.m; sourceTree = "<group>"; };
7D46FEFE1F5E41F000FEB0F8 /* UserCommsListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserCommsListener.h; sourceTree = "<group>"; };
7D46FEFD1F5E41F000FEB0F8 /* XPCListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCListener.m; sourceTree = "<group>"; };
7D46FEFE1F5E41F000FEB0F8 /* XPCListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCListener.h; sourceTree = "<group>"; };
7D4FF8C31F0E1402001A4A68 /* libbsm.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbsm.tbd; path = usr/lib/libbsm.tbd; sourceTree = SDKROOT; };
7D4FF8CB1F0EF2F9001A4A68 /* UserComms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserComms.h; sourceTree = "<group>"; };
7D4FF8CC1F0EF2F9001A4A68 /* UserComms.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserComms.m; sourceTree = "<group>"; };
7D4FF8CE1F0EF360001A4A68 /* UserCommsInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UserCommsInterface.h; path = ../../shared/UserCommsInterface.h; sourceTree = "<group>"; };
7D4FF8CB1F0EF2F9001A4A68 /* XPCDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCDaemon.h; sourceTree = "<group>"; };
7D4FF8CC1F0EF2F9001A4A68 /* XPCDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCDaemon.m; sourceTree = "<group>"; };
7D6E876F1F3AE6FA00D6BD7C /* libprocInfo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libprocInfo.a; path = launchDaemon/libs/libprocInfo.a; sourceTree = "<group>"; };
7D7755D01F02DF9500D0017D /* Do Not Disturb */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Do Not Disturb"; sourceTree = BUILT_PRODUCTS_DIR; };
7D7755D31F02DF9500D0017D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@@ -159,8 +146,6 @@
7DD2BF671F1DC42700B33214 /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Utilities.m; path = ../../shared/Utilities.m; sourceTree = "<group>"; };
7DD2BF721F1E9CE700B33214 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
7DD2BF731F1E9CE700B33214 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; };
7DD2BF741F1E9CE700B33214 /* Queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Queue.h; sourceTree = "<group>"; };
7DD2BF751F1E9CE700B33214 /* Queue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Queue.m; sourceTree = "<group>"; };
CD208698208E8B1200BA1D0A /* VolumeMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VolumeMonitor.m; sourceTree = "<group>"; };
CD208699208E8B1200BA1D0A /* VolumeMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VolumeMonitor.h; sourceTree = "<group>"; };
CD20A0C9205793040044BCC5 /* Sentry.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sentry.framework; path = ../Carthage/Build/Mac/Sentry.framework; sourceTree = "<group>"; };
@@ -182,19 +167,15 @@
CD256DF82050DE4C00768457 /* Monitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Monitor.h; path = launchDaemon/monitor/Monitor.h; sourceTree = SOURCE_ROOT; };
CD256DFF2050DE6600768457 /* ProcListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProcListener.h; path = launchDaemon/monitor/ProcListener.h; sourceTree = SOURCE_ROOT; };
CD256E002050DE6600768457 /* ProcListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProcListener.m; path = launchDaemon/monitor/ProcListener.m; sourceTree = SOURCE_ROOT; };
CD27BC6321139AD70017AEFD /* LidTrigger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LidTrigger.m; path = triggers/LidTrigger.m; sourceTree = "<group>"; };
CD27BC6421139AD70017AEFD /* LidTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LidTrigger.h; path = triggers/LidTrigger.h; sourceTree = "<group>"; };
CD2C85F52119FB2A007CF784 /* DeviceTrigger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DeviceTrigger.m; path = triggers/DeviceTrigger.m; sourceTree = "<group>"; };
CD2C85F62119FB2A007CF784 /* DeviceTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeviceTrigger.h; path = triggers/DeviceTrigger.h; sourceTree = "<group>"; };
CD2C85F9211A006F007CF784 /* PowerTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PowerTrigger.h; path = triggers/PowerTrigger.h; sourceTree = "<group>"; };
CD2C85FA211A006F007CF784 /* PowerTrigger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PowerTrigger.m; path = triggers/PowerTrigger.m; sourceTree = "<group>"; };
CD3307C5203639AD00F10D71 /* procInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = procInfo.h; path = launchDaemon/libs/procInfo.h; sourceTree = "<group>"; };
CD3307C82036518400F10D71 /* main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = main.h; sourceTree = "<group>"; };
CDA993A32048905D00C1E9CD /* FrameworkInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameworkInterface.h; sourceTree = "<group>"; };
CDA993A42048905D00C1E9CD /* FrameworkInterface.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FrameworkInterface.m; sourceTree = "<group>"; };
CDAAC245202259B50032F2E6 /* Consts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Consts.h; path = ../../shared/Consts.h; sourceTree = "<group>"; };
CE60F9C71FC9BBE500EFFDDA /* Triggers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Triggers.h; sourceTree = "<group>"; };
CE60F9C81FC9BBE500EFFDDA /* Triggers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Triggers.m; sourceTree = "<group>"; };
CDFA088421367FB00089758C /* XPCUserProto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCUserProto.h; path = ../../shared/XPCUserProto.h; sourceTree = "<group>"; };
CDFA088521367FB00089758C /* XPCDaemonProto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCDaemonProto.h; path = ../../shared/XPCDaemonProto.h; sourceTree = "<group>"; };
CE60F9C71FC9BBE500EFFDDA /* Lid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Lid.h; sourceTree = "<group>"; };
CE60F9C81FC9BBE500EFFDDA /* Lid.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Lid.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -213,7 +194,6 @@
209E45B9203DF64E00900B89 /* CocoaMQTT.framework in Frameworks */,
209E45BB203DF64E00900B89 /* RealmSwift.framework in Frameworks */,
209E45BC203DF64E00900B89 /* dnd.framework in Frameworks */,
CD20A0CB205793100044BCC5 /* Sentry.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -286,25 +266,22 @@
7D7755D21F02DF9500D0017D /* src */ = {
isa = PBXGroup;
children = (
CD27BC6221139A800017AEFD /* triggers */,
CD256DEC2050DE3200768457 /* monitor */,
7D7756071F05D62E00D0017D /* shared */,
7DD2BF721F1E9CE700B33214 /* NSMutableArray+QueueAdditions.h */,
7DD2BF731F1E9CE700B33214 /* NSMutableArray+QueueAdditions.m */,
CE60F9C71FC9BBE500EFFDDA /* Triggers.h */,
CE60F9C81FC9BBE500EFFDDA /* Triggers.m */,
CE60F9C71FC9BBE500EFFDDA /* Lid.h */,
CE60F9C81FC9BBE500EFFDDA /* Lid.m */,
CDA993A32048905D00C1E9CD /* FrameworkInterface.h */,
CDA993A42048905D00C1E9CD /* FrameworkInterface.m */,
CD227869204648E000C72C76 /* Preferences.h */,
CD22786A204648E000C72C76 /* Preferences.m */,
7DD2BF741F1E9CE700B33214 /* Queue.h */,
7DD2BF751F1E9CE700B33214 /* Queue.m */,
CD3307C82036518400F10D71 /* main.h */,
7D7755D31F02DF9500D0017D /* main.m */,
7D4FF8CB1F0EF2F9001A4A68 /* UserComms.h */,
7D4FF8CC1F0EF2F9001A4A68 /* UserComms.m */,
7D46FEFE1F5E41F000FEB0F8 /* UserCommsListener.h */,
7D46FEFD1F5E41F000FEB0F8 /* UserCommsListener.m */,
7D4FF8CB1F0EF2F9001A4A68 /* XPCDaemon.h */,
7D4FF8CC1F0EF2F9001A4A68 /* XPCDaemon.m */,
7D46FEFE1F5E41F000FEB0F8 /* XPCListener.h */,
7D46FEFD1F5E41F000FEB0F8 /* XPCListener.m */,
);
name = src;
path = launchDaemon;
@@ -318,7 +295,8 @@
7DD2BF671F1DC42700B33214 /* Utilities.m */,
7D7755FA1F02EBBE00D0017D /* Logging.m */,
7D7755FB1F02EBBE00D0017D /* Logging.h */,
7D4FF8CE1F0EF360001A4A68 /* UserCommsInterface.h */,
CDFA088421367FB00089758C /* XPCUserProto.h */,
CDFA088521367FB00089758C /* XPCDaemonProto.h */,
);
name = shared;
sourceTree = "<group>";
@@ -346,19 +324,6 @@
path = monitor;
sourceTree = "<group>";
};
CD27BC6221139A800017AEFD /* triggers */ = {
isa = PBXGroup;
children = (
CD2C85F9211A006F007CF784 /* PowerTrigger.h */,
CD2C85FA211A006F007CF784 /* PowerTrigger.m */,
CD2C85F62119FB2A007CF784 /* DeviceTrigger.h */,
CD2C85F52119FB2A007CF784 /* DeviceTrigger.m */,
CD27BC6421139AD70017AEFD /* LidTrigger.h */,
CD27BC6321139AD70017AEFD /* LidTrigger.m */,
);
name = triggers;
sourceTree = "<group>";
};
CD3307C42036399900F10D71 /* Supporting Files */ = {
isa = PBXGroup;
children = (
@@ -376,12 +341,10 @@
isa = PBXNativeTarget;
buildConfigurationList = 2063725E203DC70A006D4C38 /* Build configuration list for PBXNativeTarget "launchDaemonBundle" */;
buildPhases = (
20637257203DC70A006D4C38 /* Sources */,
20637258203DC70A006D4C38 /* Frameworks */,
20637259203DC70A006D4C38 /* Resources */,
209E459E203DF5B200900B89 /* CopyFiles */,
20C8722C2046079F00F1275D /* CopyFiles */,
20C8725720460A2300F1275D /* CopyFiles */,
20C8722C2046079F00F1275D /* Copy Frameworks */,
20C8725720460A2300F1275D /* Copy Certs */,
CDD3ADF2213527E0004F805F /* CopyFiles */,
);
buildRules = (
);
@@ -399,7 +362,6 @@
buildPhases = (
7D7755CC1F02DF9500D0017D /* Sources */,
7D7755CD1F02DF9500D0017D /* Frameworks */,
7D7755CE1F02DF9500D0017D /* CopyFiles */,
);
buildRules = (
);
@@ -416,7 +378,7 @@
7D7755C81F02DF9400D0017D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Objective-See";
TargetAttributes = {
2063725A203DC70A006D4C38 = {
@@ -447,31 +409,11 @@
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
20637259203DC70A006D4C38 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
20637257203DC70A006D4C38 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7D7755CC1F02DF9500D0017D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CD2C85FC211A0084007CF784 /* PowerTrigger.m in Sources */,
CD2C85F82119FC02007CF784 /* DeviceTrigger.m in Sources */,
CD2C85F42119D9D5007CF784 /* LidTrigger.m in Sources */,
CD20869B208E8F0200BA1D0A /* VolumeMonitor.m in Sources */,
CD256E022050DE9B00768457 /* ProcListener.m in Sources */,
CD256E032050DE9B00768457 /* AuthEvent.m in Sources */,
@@ -482,13 +424,12 @@
CD256E082050DE9B00768457 /* UserAuthMonitor.m in Sources */,
CD22786C20464A6E00C72C76 /* Preferences.m in Sources */,
CDA993A62048905D00C1E9CD /* FrameworkInterface.m in Sources */,
7D46FEFF1F5E41F000FEB0F8 /* UserCommsListener.m in Sources */,
CE60F9C91FC9BBE500EFFDDA /* Triggers.m in Sources */,
7D46FEFF1F5E41F000FEB0F8 /* XPCListener.m in Sources */,
CE60F9C91FC9BBE500EFFDDA /* Lid.m in Sources */,
7DD2BF761F1E9CE700B33214 /* NSMutableArray+QueueAdditions.m in Sources */,
7DD2BF681F1DC42700B33214 /* Utilities.m in Sources */,
7DD2BF771F1E9CE700B33214 /* Queue.m in Sources */,
7D7755D41F02DF9500D0017D /* main.m in Sources */,
7D4FF8CD1F0EF2F9001A4A68 /* UserComms.m in Sources */,
7D4FF8CD1F0EF2F9001A4A68 /* XPCDaemon.m in Sources */,
7D7755FC1F02EBBE00D0017D /* Logging.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1,19 +1,20 @@
// file: Triggers.m
//
// file: Lid.h
// project: DND (launch daemon)
// description: generic management of various triggers (header)
// description: monitor and alert logic for lid open events (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Utilities.h"
#import "LidTrigger.h"
#import "PowerTrigger.h"
#import "DeviceTrigger.h"
#import <dnd/dnd-Swift.h>
@import Foundation;
#import <IOKit/IOKitLib.h>
#import <IOKit/pwr_mgt/IOPM.h>
/* FUNCTIONS */
//check if user auth'd
@@ -23,25 +24,26 @@ BOOL authViaTouchID(void);
/* CLASS INTERFACE */
@interface Triggers : NSObject <DNDClientMacDelegate>
@interface Lid : NSObject <DNDClientMacDelegate, DNDClientMacTaskingDelegate>
{
//lid state
LidState lidState;
//dispatch queue
dispatch_queue_t dispatchQ;
//notification port
IONotificationPortRef notificationPort;
//notification object
io_object_t notification;
}
/* PROPERTIES */
//lid trigger obj
@property(nonatomic, retain)LidTrigger* lidTrigger;
//device(s) trigger obj
@property(nonatomic, retain)DeviceTrigger* deviceTrigger;
//power trigger obj
@property(nonatomic, retain)PowerTrigger* powerTrigger;
//client
@property(nonatomic, retain)DNDClientMac* client;
@property(nonatomic, retain)DNDClientMac *client;
//dismiss dispatch group
@property(nonatomic, retain)dispatch_group_t dispatchGroup;
@@ -52,14 +54,19 @@ BOOL authViaTouchID(void);
//dispatch blocks
@property(nonatomic, retain)NSMutableArray* dispatchBlocks;
//TODO: make dictionary w/ alert
//latest undeliveried alert
//latest undelivered alert
@property(nonatomic, retain)NSDate* undeliveredAlert;
/* METHODS */
//observer for dismiss alerts
@property(nonatomic, retain)id dismissObserver;
//toggle trigger(s)
-(void)toggle:(NSUInteger)type state:(NSControlStateValue)state;
//observer for new client/user (login item)
@property(nonatomic, retain)id userObserver;
//undelivered alerts
@property(nonatomic, retain)NSMutableArray* undeliveredAlerts;
/* METHODS */
//check if client should be init'd
-(BOOL)shouldInitClient;
@@ -70,8 +77,14 @@ BOOL authViaTouchID(void);
//cancel all dipatch blocks
-(void)cancelDispatchBlocks;
//process trigger event
-(void)processEvent:(NSUInteger)type info:(NSDictionary*)info;
//register for notifications
-(BOOL)register4Notifications;
//register for notifications
-(void)unregister4Notifications;
//proces lid open event
-(void)processEvent:(NSDate*)timestamp user:(NSString*)user;
//wait for dismiss
// note: handles multiple client via dispatch group
@@ -1,29 +1,36 @@
// file: Triggers.m
// file: Lid.m
// project: DND (launch daemon)
// description: generic management of various triggers
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
// description: monitor and alert logic for lid open events
// code inspired by:
// https://github.com/zarigani/ClamshellWake/blob/master/ClamshellWake.cpp
// https://github.com/dustinrue/ControlPlane/blob/master/Source/LaptopLidEvidenceSource.m
// note: manually get state from terminal via:
// ioreg -r -k AppleClamshellState -d 4 | grep AppleClamshellState
#import "Lid.h"
#import "Consts.h"
#import "Queue.h"
#import "Logging.h"
#import "Monitor.h"
#import "Triggers.h"
#import "AuthEvent.h"
#import "Utilities.h"
#import "XPCListener.h"
#import "Preferences.h"
#import "UserAuthMonitor.h"
#import "FrameworkInterface.h"
#import "XPCUserProto.h"
/* GLOBALS */
//trigger obj
extern Triggers* triggers;
//last state
// sometimes multiple notifications are delivered!?
LidState lastLidState;
//queue object
extern Queue* eventQueue;
//lid obj
extern Lid* lid;
//user auth event listener
extern UserAuthMonitor* userAuthMonitor;
@@ -34,6 +41,126 @@ extern Preferences* preferences;
//DND framework interface obj
extern FrameworkInterface* framework;
//XPC listener
extern XPCListener* xpcListener;
//callback for power/lid events
static void pmDomainChange(void *refcon, io_service_t service, uint32_t messageType, void *messageArgument)
{
//lid state
int lidState = stateUnavailable;
//sleep bit
int sleepState = -1;
//preferences
NSDictionary* currentPrefs = nil;
//timestamp
NSDate* timestamp = nil;
//init timestamp
timestamp = [NSDate date];
//ignore any messages that are related to lid state
if(kIOPMMessageClamshellStateChange != messageType)
{
//bail
goto bail;
}
//dbg msg
logMsg(LOG_DEBUG, @"got 'kIOPMMessageClamshellStateChange' message");
//get prefs
currentPrefs = [preferences get:nil];
//if user explicity set disabled
// bail here, to ignore everything
if(YES == [currentPrefs[PREF_IS_DISABLED] boolValue])
{
//dbg msg
logMsg(LOG_DEBUG, @"client disabled DND, so ignoring lid event");
//bail
goto bail;
}
//get state
lidState = ((int) messageArgument & kClamshellStateBit);
//get sleep state
sleepState = !!(((int)messageArgument & kClamshellSleepBit));
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"lid state: %@ (sleep bit: %d)", (lidState) ? @"closed" : @"open", sleepState]);
//(new) open?
// OS sometimes delivers 2x events, so ignore same same
if( (stateOpen == lidState) &&
(stateOpen != lastLidState) )
{
//ignore if lid isn't really open
// on reboot, OS may deliver 'open' message if external monitors are connected
if(stateOpen != getLidState())
{
//bail
goto bail;
}
//update 'prev' state
lastLidState = stateOpen;
//dbg msg
// log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"[NEW EVENT] lid state: open (sleep state: %d)", sleepState]);
//touch id mode?
// wait up to 10 seconds, and ignore event if user auth'd via biometrics
if(YES == [currentPrefs[PREF_TOUCHID_MODE] boolValue])
{
//dbg msg
logMsg(LOG_DEBUG, @"'touch id' mode enabled, waiting up to 10 seconds for biometric auth event");
//user auth'd via touchID?
// will wait for up to 10 seconds
if(YES == authViaTouchID())
{
//dbg msg
// log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, @"user authenticated via touchID, so ignoring event");
//bail
// will ignore the event
goto bail;
}
//dbg msg
logMsg(LOG_DEBUG, @"no touch id auth event found, so will process event");
}
//process event
// report to user, execute actions, etc
[lid processEvent:timestamp user:getConsoleUser()];
}
//(new) close?
// OS sometimes delivers 2x events, so ignore same same
else if( (stateClosed == lidState) &&
(stateClosed != lastLidState) )
{
//update 'prev' state
lastLidState = stateClosed;
//dbg msg
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"[NEW EVENT] lid state: closed (sleep state: %d)", sleepState]);
}
bail:
return;
}
//check if user auth'd
// a) within last 10 seconds
// b) via biometrics (touchID)
@@ -106,7 +233,7 @@ BOOL authViaTouchID()
});
//wait for touch id auth
// ...up to ten seconds for event
// ...up to five seconds
dispatch_semaphore_wait(semaphore, dispatch_time(0, 10*NSEC_PER_SEC));
//tell user auth monitor to stop
@@ -118,17 +245,15 @@ BOOL authViaTouchID()
return touchIDAuth;
}
@implementation Triggers
@implementation Lid
@synthesize client;
@synthesize lidTrigger;
@synthesize powerTrigger;
@synthesize deviceTrigger;
@synthesize userObserver;
@synthesize dispatchGroup;
@synthesize dispatchBlocks;
@synthesize dismissObserver;
@synthesize undeliveredAlert;
@synthesize undeliveredAlerts;
@synthesize dispatchGroupEmpty;
//init
@@ -138,15 +263,24 @@ BOOL authViaTouchID()
self = [super init];
if(nil != self)
{
//init lid (trigger) obj
lidTrigger = [[LidTrigger alloc] init];
//init
dispatchQ = NULL;
//init device (trigger) obj
deviceTrigger = [[DeviceTrigger alloc] init];
//init
notificationPort = NULL;
//init power (trigger) obj
powerTrigger = [[PowerTrigger alloc] init];
//init
notification = 0;
//alloc array for alerts
undeliveredAlerts = [NSMutableArray array];
//init to current state
lastLidState = getLidState();
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"initial lid state: %d", lastLidState]);
//init dispatch group for dismiss events
dispatchGroup = dispatch_group_create();
@@ -156,6 +290,52 @@ BOOL authViaTouchID()
//init array for blocks
dispatchBlocks = [NSMutableArray array];
//register listener for dismiss alerts
// when it fires, invoke (user) XPC method to dismiss alert
self.dismissObserver = [[NSNotificationCenter defaultCenter] addObserverForName:DISMISS_NOTIFICATION object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification)
{
//connected login item?
if(nil != xpcListener.loginItem)
{
//dbg msg
logMsg(LOG_DEBUG, @"'DISMISS_NOTIFICATION' triggered, will send XPC msg to user (login item) to dismiss any alerts");
//send XPC msg to dismiss
[[xpcListener.loginItem remoteObjectProxy] alertDismiss];
}
else
{
//dbg msg
logMsg(LOG_DEBUG, @"no client (login item) is connected, so nothing to dismiss...");
}
}];
//register listener for new client/user (login item)
// when it fires, invoke (user) XPC method to deliver any alerts that occured when user wasn't logged in
self.userObserver = [[NSNotificationCenter defaultCenter] addObserverForName:USER_NOTIFICATION object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification)
{
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"'USER_NOTIFICATION' triggered, will send XPC msg to user (login item) to display %lu undelivered alerts", self.undeliveredAlerts.count]);
//sync to access
@synchronized(self.undeliveredAlerts)
{
//send each alert to user
for(NSDictionary* alert in self.undeliveredAlerts)
{
//send XPC msg to user, to display alert
[[xpcListener.loginItem remoteObjectProxy] alertShow:alert];
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"(re)delivered alert: %@", alert]);
}
//remove all
[self.undeliveredAlerts removeAllObjects];
}
}];
//should init client?
if(YES == [self shouldInitClient])
{
@@ -210,7 +390,7 @@ BOOL authViaTouchID()
self.client.delegate = self;
//indicate we want tasking
[self.client handleTasksWithFramework:[[preferences get:nil][PREF_NO_REMOTE_TASKING] boolValue]];
[self.client handleTasksWithFramework:[[preferences get:nil][PREF_NO_REMOTE_TASKING] boolValue] imageDelegate:self];
//happy
initialized = YES;
@@ -220,86 +400,144 @@ bail:
return initialized;
}
//toggle trigger(s)
-(void)toggle:(NSUInteger)type state:(NSControlStateValue)state
//register for notifications
-(BOOL)register4Notifications
{
//current prefs
NSDictionary* currentPrefs = nil;
//return var
BOOL registered = NO;
//dbd msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"toggling trigger (type: %lu, state: %lu)", (unsigned long)type, state]);
//status var
kern_return_t status = kIOReturnError;
//enable based on type
switch(type)
//root domain for power management
io_service_t powerManagementRD = MACH_PORT_NULL;
//dbg msg
logMsg(LOG_DEBUG, @"registering for lid notifications");
//make sure state is ok
if(stateUnavailable == getLidState())
{
//all
// based on triggers
case ALL_TRIGGERS:
//dbg msg
logMsg(LOG_DEBUG, @"toggling all triggers");
//get current prefs
currentPrefs = [preferences get:nil];
//lid trigger?
if(YES == [currentPrefs[PREF_LID_TRIGGER] boolValue])
{
//toggle
[self.lidTrigger toggle:state];
}
//device trigger?
if(YES == [currentPrefs[PREF_DEVICE_TRIGGER] boolValue])
{
//toggle
[self.deviceTrigger toggle:state];
}
//power trigger
if(YES == [currentPrefs[PREF_POWER_TRIGGER] boolValue])
{
//toggle
[self.powerTrigger toggle:state];
}
break;
//lid trigger
case LID_TRIGGER:
//toggle
[self.lidTrigger toggle:state];
break;
//err msg
logMsg(LOG_ERR, @"failed to get lid state, so aborting lid notifications registration");
//device trigger
case DEVICE_TRIGGER:
//toggle
[self.deviceTrigger toggle:state];
break;
//power trigger
case POWER_TRIGGER:
//toggle
[self.powerTrigger toggle:state];
break;
//error
goto bail;
}
default:
break;
//create queue
dispatchQ = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
if(NULL == dispatchQ)
{
//err msg
logMsg(LOG_ERR, @"failed to create dispatch queue for lid notifications");
//error
goto bail;
}
//set target
dispatch_set_target_queue(dispatchQ, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));
//create notification port
notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
if(NULL == notificationPort)
{
//err msg
logMsg(LOG_ERR, @"failed to create notification port for lid notifications");
//error
goto bail;
}
//set dispatch queue
IONotificationPortSetDispatchQueue(notificationPort, dispatchQ);
//get matching service for power management root domain
powerManagementRD = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPMrootDomain"));
if(0 == powerManagementRD)
{
//err msg
logMsg(LOG_ERR, @"failed to get power management root domain for lid notifications");
//error
goto bail;
}
//add interest notification
status = IOServiceAddInterestNotification(notificationPort, powerManagementRD, kIOGeneralInterest,
pmDomainChange, &lidState, &notification);
if(KERN_SUCCESS != status)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to get add interest notifcation for lid notifications (error: 0x:%x)", status]);
//error
goto bail;
}
//happy
registered = YES;
bail:
//release
if(MACH_PORT_NULL != powerManagementRD)
{
//release
IOObjectRelease(powerManagementRD);
//unset
powerManagementRD = MACH_PORT_NULL;
}
return registered;
}
//unregister for notifications
-(void)unregister4Notifications
{
//dbg msg
logMsg(LOG_DEBUG, @"unregistering lid notifications");
//release notification
if(0 != notification)
{
//release
IOObjectRelease(notification);
//unset
notification = 0;
//dbg msg
logMsg(LOG_DEBUG, @"released service interest notification");
}
//destroy notification port
if(NULL != notificationPort)
{
//set queue to NULL
IONotificationPortSetDispatchQueue(notificationPort, NULL);
//unset dispatch queue
dispatchQ = NULL;
//destroy port
IONotificationPortDestroy(notificationPort);
//unset
notificationPort = NULL;
//dbg msg
logMsg(LOG_DEBUG, @"destroyed notification port");
}
return;
}
//proces trigger event
//proces lid open event
// report to user, execute cmd, send alert to server, etc
-(void)processEvent:(NSUInteger)type info:(NSDictionary*)info
-(void)processEvent:(NSDate*)timestamp user:(NSString*)user
{
//monitor obj
Monitor* monitor = nil;
@@ -307,41 +545,47 @@ bail:
//current prefs
NSDictionary* currentPrefs = nil;
//alert
NSDictionary* alert;
//init alert
alert = @{ALERT_TIMESTAMP:timestamp};
//get current prefs
currentPrefs = [preferences get:nil];
//auth mode?
// wait up to 10 seconds, and ignore event if user auth'd via biometrics or apple watch
if(YES == [currentPrefs[PREF_AUTH_MODE] boolValue])
{
//dbg msg
logMsg(LOG_DEBUG, @"'auth' mode enabled, waiting up to 10 seconds for biometric auth || apple watch event");
//TODO: add apple watch
//user auth'd via touchID?
// will wait for up to 10 seconds
if(YES == authViaTouchID())
{
//dbg msg
// log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, @"user authenticated via touchID, so ignoring event");
//bail
goto bail;
}
//dbg msg
logMsg(LOG_DEBUG, @"no touch id auth event found, so will continue processing event");
}
//only add events to queue
// when client is not running in passive mode
if(YES != [currentPrefs[PREF_PASSIVE_MODE] boolValue])
{
//add to global queue
// this will trigger processing of alert to user
[eventQueue enqueue:@{ALERT_TYPE:[NSNumber numberWithInteger:type], ALERT_TIMESTAMP:[NSDate date], ALERT_INFO:info}];
//connected client? (login item)
// deliver alert via XPC, to user
if(nil != xpcListener.loginItem)
{
//send to client
// this will fail (but we'll handle) if no clients are connected
[[xpcListener.loginItem remoteObjectProxyWithErrorHandler:^(NSError * proxyError)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to invoke USER XPC method: 'alertShow' (error: %@)", proxyError]);
//save undelivered alert
@synchronized(self.undeliveredAlerts)
{
//save
[self.undeliveredAlerts addObject:alert];
}
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"saved %@, will deliver when user (login item) connects", alert]);
}] alertShow:alert];
}
else
{
//dbg msg
logMsg(LOG_DEBUG, @"no client (login item) is connected, so won't locally deliver alert");
}
}
//passive mode
// just log a msg about this fact
@@ -405,7 +649,7 @@ bail:
}
//registered device?
// send alert to server
// send to alert to server
if(nil != self.client)
{
//dbg msg
@@ -419,14 +663,14 @@ bail:
logMsg(LOG_DEBUG, @"no (prev) alerts undelivered");
//save timestamp
self.undeliveredAlert = [NSDate date];
self.undeliveredAlert = timestamp;
//send to server
// will wait up to x minutes if there's no network connectivity
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//wait
[self send2Server:getConsoleUser()];
[self send2Server:user];
});
}
@@ -439,7 +683,7 @@ bail:
logMsg(LOG_DEBUG, @"previously alert undelivered, just updating that...");
//save timestamp
self.undeliveredAlert = [NSDate date];
self.undeliveredAlert = timestamp;
}
}
@@ -448,7 +692,7 @@ bail:
else
{
//dbg msg
logMsg(LOG_DEBUG, @"did not send to server, as there's no client/registered device");
logMsg(LOG_DEBUG, @"did not send to server - no client/registered device");
}
bail:
@@ -496,7 +740,7 @@ bail:
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"sending alert to server (user: %@)", user]);
//send
response = [self.client sendAlertSyncWithUuid:[NSUUID UUID] userName:user date:self.undeliveredAlert];
response = [self.client sendAlertSyncWithUuid:[NSUUID UUID] userName:user date:self.undeliveredAlert photo:NO];
if(nil != response)
{
//log
@@ -525,7 +769,7 @@ bail:
logMsg(LOG_DEBUG, @"could not reach endpoint - network offline?");
//not online
//... so tak a nap
//... so take a nap
[NSThread sleepForTimeInterval:i*1.5];
}
@@ -701,4 +945,41 @@ bail:
return result;
}
//framework delegate method
// send XPC message to user (login item) to take picture
-(void)captureImageWithCompletion:(void (^ _Nonnull)(NSData * _Nullable))completion
{
//connected client? (login item)
// request image capture of camera, via XPC
if(nil != xpcListener.loginItem)
{
//request to user (login item) to take a picture
[[xpcListener.loginItem remoteObjectProxyWithErrorHandler:^(NSError * proxyError)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to invoke USER XPC method: 'capture picture' (error: %@)", proxyError]);
//error
completion(nil);
}] captureImage:^(NSData* image)
{
//pass back to framework
completion(image);
}];
}
else
{
//dbg msg
logMsg(LOG_DEBUG, @"no client (login item) is connected, so can't capture image");
//still, invoke callback
completion(nil);
}
return;
}
@end
+16 -78
View File
@@ -7,16 +7,16 @@
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Lid.h"
#import "consts.h"
#import "logging.h"
#import "Triggers.h"
#import "Preferences.h"
#import "FrameworkInterface.h"
/* GLOBALS */
//trigger obj
extern Triggers* triggers;
//lid obj
extern Lid* lid;
//DND framework interface obj
extern FrameworkInterface* framework;
@@ -160,27 +160,28 @@ bail:
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"updating preferences (%@)", updates]);
//user setting state?
// toggle the state of the daemon triggers too
// toggle the state of the daemon (lid) watcher too
if(nil != updates[PREF_IS_DISABLED])
{
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"client toggling state: %@", updates[PREF_IS_DISABLED]]);
//disable triggers
//disable?
if(YES == [updates[PREF_IS_DISABLED] boolValue])
{
//dbg msg
// and log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, @"disabling...");
//turn off all triggers
[triggers toggle:ALL_TRIGGERS state:NSOffState];
//unregister for lid notifications
[lid unregister4Notifications];
//dbg msg
logMsg(LOG_DEBUG, @"disabled triggers");
logMsg(LOG_DEBUG, @"unregistered for lid change notifications");
//cancel all dispatch blocks
[triggers cancelDispatchBlocks];
//cancel all lid notifications
// ...will also disconnect client
[lid cancelDispatchBlocks];
//dbg msg
logMsg(LOG_DEBUG, @"cancelled all dispatch blocks (disconnecting any connected iOS client)");
@@ -189,81 +190,18 @@ bail:
[[NSNotificationCenter defaultCenter] postNotificationName:DISMISS_NOTIFICATION object:nil userInfo:nil];
}
//enable triggers
//enable?
else
{
//dbg msg
// and log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, @"enabling...");
//turn off all triggers
[triggers toggle:ALL_TRIGGERS state:NSOnState];
//register for lid notifications
[lid register4Notifications];
//dbg msg
logMsg(LOG_DEBUG, @"enabled (all) triggers");
}
}
//toggle lid triggers
if(nil != updates[PREF_LID_TRIGGER])
{
//dbg msg
logMsg(LOG_DEBUG, @"toggling lid notifications");
//enable lid trigger
if(YES == [updates[PREF_LID_TRIGGER] boolValue])
{
//enable
[triggers toggle:LID_TRIGGER state:NSOnState];
}
//disable lid trigger
else
{
//disable
[triggers toggle:LID_TRIGGER state:NSOffState];
}
}
//toggle device triggers
if(nil != updates[PREF_DEVICE_TRIGGER])
{
//dbg msg
logMsg(LOG_DEBUG, @"toggling device notifications");
//enable device trigger
if(YES == [updates[PREF_DEVICE_TRIGGER] boolValue])
{
//enable
[triggers toggle:DEVICE_TRIGGER state:NSOnState];
}
//disable device trigger
else
{
//disable
[triggers toggle:DEVICE_TRIGGER state:NSOffState];
}
}
//toggle power triggers
if(nil != updates[PREF_POWER_TRIGGER])
{
//dbg msg
logMsg(LOG_DEBUG, @"toggling power notifications");
//enable power trigger
if(YES == [updates[PREF_POWER_TRIGGER] boolValue])
{
//enable
[triggers toggle:POWER_TRIGGER state:NSOnState];
}
//disable power trigger
else
{
//disable
[triggers toggle:POWER_TRIGGER state:NSOffState];
logMsg(LOG_DEBUG, @"registered for lid change notifications");
}
}
-40
View File
@@ -1,40 +0,0 @@
//
// file: Queue.h
// project: DND (launch daemon)
// description: a queue implementation (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
#import "NSMutableArray+QueueAdditions.h"
@interface Queue : NSObject
{
}
/* PROPERTIES */
//event queue
@property(retain, atomic)NSMutableArray* eventQueue;
//queue condition
@property (nonatomic, retain)NSCondition* queueCondition;
/* METHODS */
//add an object to the queue
-(void)enqueue:(id)anObject;
//wait until queue has item
// then pull if off, and return it
-(id)dequeue;
//wait until queue has item
// and return it, w/o removing it
-(id)peek;
@end
-106
View File
@@ -1,106 +0,0 @@
//
// file: Queue.m
// project: DND (launch daemon)
// description: a queue implementation
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Queue.h"
#import "Consts.h"
#import "Logging.h"
@implementation Queue
@synthesize eventQueue;
@synthesize queueCondition;
//init
-(id)init
{
//init super
self = [super init];
if(nil != self)
{
//init queue
eventQueue = [NSMutableArray array];
//init empty condition
queueCondition = [[NSCondition alloc] init];
}
return self;
}
//add an object to the queue
-(void)enqueue:(id)anObject
{
//lock
[self.queueCondition lock];
//add to queue
[self.eventQueue enqueue:anObject];
//signal
[self.queueCondition signal];
//unlock
[self.queueCondition unlock];
return;
}
//wait until queue has item
// then pull if off, and return it
-(id)dequeue
{
//queue item
id item = nil;
//lock
[self.queueCondition lock];
//wait while queue is empty
while(YES == [self.eventQueue isEmpty])
{
//wait
[self.queueCondition wait];
}
//get item off queue
item = [self.eventQueue dequeue];
//unlock
[self.queueCondition unlock];
return item;
}
//wait until queue has item
// and return it, w/o removing it
-(id)peek
{
//queue item
id item = nil;
//lock
[self.queueCondition lock];
//wait while queue is empty
while(YES == [self.eventQueue isEmpty])
{
//wait
[self.queueCondition wait];
}
//get item off queue
item = [self.eventQueue peek];
//unlock
[self.queueCondition unlock];
return item;
}
@end
@@ -1,29 +1,25 @@
//
// file: UserComms.h
// file: XPCDaemon.h
// project: DND (launch daemon)
// description: interface for user componets (header)
// description: interface for user XPC methods (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
#import "UserCommsInterface.h"
#import <dnd/dnd-Swift.h>
@interface UserComms : NSObject <UserProtocol, DNDClientMacDelegate>
#import "XPCDaemonProto.h"
@interface XPCDaemon : NSObject <XPCDaemonProtocol, DNDClientMacDelegate>
{
}
/* PROPERTIES */
//client status
@property NSInteger currentStatus;
//last alert
@property(nonatomic,retain)NSDictionary* dequeuedAlert;
//registration info from server
@property(nonatomic,retain)NSDictionary *registrationInfo;
@@ -1,38 +1,31 @@
//
// file: UserComms.m
// file: XPCDaemon.m
// project: DND (launch daemon)
// description: interface for user componets
// description: interface for user XPC methods
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Consts.h"
#import "Queue.h"
#import "Logging.h"
#import "UserComms.h"
#import "XPCDaemon.h"
#import "Preferences.h"
#import "FrameworkInterface.h"
#import "UserCommsInterface.h"
#import <dnd/dnd-swift.h>
//signing auth
#define SIGNING_AUTH @"Developer ID Application: Objective-See, LLC (VBG97UB4TA)"
//global queue object
extern Queue* eventQueue;
//global prefs obj
extern Preferences* preferences;
//framework interface obc
extern FrameworkInterface* framework;
@implementation UserComms
@implementation XPCDaemon
@synthesize currentStatus;
@synthesize dequeuedAlert;
@synthesize registrationInfo;
@synthesize registrationSema;
@@ -44,8 +37,7 @@ extern FrameworkInterface* framework;
self = [super init];
if(nil != self)
{
//set status
self.currentStatus = STATUS_CLIENT_UNKNOWN;
}
return self;
@@ -200,48 +192,7 @@ bail:
return;
}
//process alert request from client
// blocks for queue item, then sends to client
-(void)alertRequest:(void (^)(NSDictionary* alert))reply
{
//dbg msg
logMsg(LOG_DEBUG, @"XPC request: alert request");
//reset
self.dequeuedAlert = nil;
//read off queue
// will block until alert is ready
self.dequeuedAlert = [eventQueue peek];
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"found alert on queue: %@", self.dequeuedAlert]);
//log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"sending alert to login item to display to user: %@", self.dequeuedAlert]);
//return alert
reply(self.dequeuedAlert);
return;
}
//invoke when alert has been displayed
// for now, just remove it from the queue
-(void)alertResponse
{
//dbg msg
logMsg(LOG_DEBUG, @"XPC request: alert response");
//remove
[eventQueue dequeue];
//unset
self.dequeuedAlert = nil;
//dbg msg
logMsg(LOG_DEBUG, @"removed alert, as it's been consumed by the user");
}
//process alert dismiss request from client
// blocks until framework tell us it was dismissed via the phone || login item said 'disable'
@@ -1,16 +1,15 @@
//
// file: UserCommsListener.h
// file: XPCListener.h
// project: DND (launch daemon)
// description: XPC listener for connections for user components (header)
// description: XPC listener for connections from user components (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
#import "UserCommsInterface.h"
@interface UserCommsListener : NSObject <NSXPCListenerDelegate>
@interface XPCListener : NSObject <NSXPCListenerDelegate>
{
}
@@ -20,6 +19,12 @@
//XPC listener
@property(nonatomic, retain)NSXPCListener* listener;
//XPC connection for login item
@property(weak)NSXPCConnection* loginItem;
//XPC connection for main app
@property(weak)NSXPCConnection* mainApp;
/* METHODS */
//setup XPC listener
@@ -30,9 +35,4 @@
// note: we only allow binaries signed by Objective-See to talk to this!
-(BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection;
//connection invalidated
// if there is an 'undelivered' alert, (re)enqueue it
-(void)connectionInvalidated:(NSXPCConnection *)connection;
@end
@@ -1,7 +1,7 @@
//
// file: UserCommsListener.m
// file: XPCListener.h
// project: DND (launch daemon)
// description: XPC listener for connections for user components
// description: XPC listener for connections from user components
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
@@ -9,18 +9,15 @@
#import "Consts.h"
#import "Logging.h"
#import "Queue.h"
#import "UserComms.h"
#import "UserCommsListener.h"
#import "UserCommsInterface.h"
#import "Utilities.h"
#import "XPCDaemon.h"
#import "XPCListener.h"
#import "XPCUSERProto.h"
#import "XPCDaemonProto.h"
//signing auth
#define SIGNING_AUTH @"Developer ID Application: Objective-See, LLC (VBG97UB4TA)"
//global queue object
extern Queue* eventQueue;
//interface for 'extension' to NSXPCConnection
// allows us to access the 'private' auditToken iVar
@interface ExtendedNSXPCConnection : NSXPCConnection
@@ -42,14 +39,10 @@ extern Queue* eventQueue;
@end
//function
OSStatus SecTaskValidateForRequirement(SecTaskRef task, CFStringRef requirement);
//global queue object
extern Queue* eventQueue;
@implementation UserCommsListener
@implementation XPCListener
@synthesize listener;
@@ -65,11 +58,10 @@ extern Queue* eventQueue;
if(YES != [self initListener])
{
//unset
self = nil;
self = nil;
//bail
goto bail;
}
}
@@ -112,7 +104,6 @@ bail:
return result;
}
#pragma mark -
#pragma mark NSXPCConnection method overrides
@@ -128,29 +119,14 @@ bail:
SecTaskRef taskRef = 0;
//signing req string
NSString *requirementString = nil;
NSString* requirementString = nil;
//make weak ref
// see: https://stackoverflow.com/a/23628986/3854841
__weak typeof(NSXPCConnection*) weakConnection = newConnection;
//path of connecting app
NSString* path = nil;
//dbg msg
logMsg(LOG_DEBUG, @"received request to connect to XPC interface");
//set interrupt & invalidation handler
newConnection.interruptionHandler = newConnection.invalidationHandler = ^{
//make strong ref
// see: https://stackoverflow.com/a/23628986/3854841
__strong typeof(NSXPCConnection*)strongConnection = weakConnection;
//dbg msg
logMsg(LOG_DEBUG, @"connection interrupted/invalidated");
//handle invalidation
[self connectionInvalidated:strongConnection];
};
//init signing req string
requirementString = [NSString stringWithFormat:@"anchor trusted and certificate leaf [subject.CN] = \"%@\"", SIGNING_AUTH];
@@ -170,18 +146,47 @@ bail:
//bail
goto bail;
}
//set the interface that the exported object implements
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(UserProtocol)];
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCDaemonProtocol)];
//set object exported by connection
newConnection.exportedObject = [[UserComms alloc] init];
newConnection.exportedObject = [[XPCDaemon alloc] init];
//set type of remote object
// user (login item/main app) will set this object
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol: @protocol(XPCUserProtocol)];
//get path
path = getProcessPath(newConnection.processIdentifier);
//login item
// save connection and notify that new client has connected
if(YES == [path hasSuffix:LOGIN_ITEM_NAME])
{
//save
self.loginItem = newConnection;
//in background
// notify that a new client connected
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
//notify
[[NSNotificationCenter defaultCenter] postNotificationName:USER_NOTIFICATION object:nil userInfo:nil];
});
}
//main app
else
{
//save
self.mainApp = newConnection;
}
//resume
[newConnection resume];
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"allowed XPC connection: %@", newConnection.exportedObject]);
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"allowed XPC connection from %@", path]);
//happy
shouldAccept = YES;
@@ -201,50 +206,4 @@ bail:
return shouldAccept;
}
//connection invalidated
// if there is an 'undelivered' alert, (re)enqueue it
-(void)connectionInvalidated:(NSXPCConnection *)connection
{
//user comms obj
UserComms* userComms = nil;
//dbg msg
logMsg(LOG_DEBUG, @"XPC connection interrupted/invalidated");
//sanity check
if(nil == connection)
{
//bail
goto bail;
}
//grab user comms object
userComms = connection.exportedObject;
//no undelivered (dequeued) alert?
if(nil == userComms.dequeuedAlert)
{
//bail
goto bail;
}
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"found undelivered alert, will (re)enqueue"]);
//have alert
// requeue it up
[eventQueue enqueue:userComms.dequeuedAlert];
bail:
//unset export obj
connection.exportedObject = nil;
//unset connection
connection = nil;
return;
}
@end
-2
View File
@@ -7,8 +7,6 @@
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
/* FUNCTIONS */
//uninstall
+27 -36
View File
@@ -7,15 +7,14 @@
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Lid.h"
#import "main.h"
#import "Queue.h"
#import "Consts.h"
#import "Logging.h"
#import "Triggers.h"
#import "Utilities.h"
#import "Preferences.h"
#import "XPCListener.h"
#import "UserAuthMonitor.h"
#import "UserCommsListener.h"
#import "FrameworkInterface.h"
@import Sentry;
@@ -27,11 +26,7 @@ Preferences* preferences = nil;
//lid object
// registers for notifications, gets state, etc
Triggers* triggers = nil;
//queue object
// contains watch items that should be processed
Queue* eventQueue = nil;
Lid* lid = nil;
//user auth event listener
UserAuthMonitor* userAuthMonitor = nil;
@@ -42,29 +37,26 @@ FrameworkInterface* framework = nil;
//dispatch source for SIGTERM
dispatch_source_t dispatchSource = nil;
//XPC listener
XPCListener* xpcListener = nil;
//main
// init & kickoff stuffz
int main(int argc, const char * argv[])
{
//return
int result = -1;
@autoreleasepool
{
//user comms listener (XPC) obj
UserCommsListener* userCommsListener = nil;
//current preferences
NSDictionary* currentPrefs = nil;
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"STARTED: launch daemon (args: %@)", [[NSProcessInfo processInfo] arguments]]);
//init crash reporting client
SentryClient.sharedClient = [[SentryClient alloc] initWithDsn:CRASH_REPORTING_URL didFailWithError:nil];
//start crash handler
[SentryClient.sharedClient startCrashHandlerWithError:nil];
//init crash reporting
initCrashReporting();
//alloc/init/load prefs
// to here (early) as other logic (below) uses prefs
@@ -123,7 +115,6 @@ int main(int argc, const char * argv[])
// allows to close logging, etc.
register4Shutdown();
//1st time identity generatation is done on demand
// subsequent times though, can just always do here
if(nil != currentPrefs[PREF_CLIENT_ID])
@@ -142,39 +133,36 @@ int main(int argc, const char * argv[])
logMsg(LOG_DEBUG, @"initialized DND identity");
}
//init global triggers object
triggers = [[Triggers alloc] init];
//init global lid object
lid = [[Lid alloc] init];
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"lid state: %d", getLidState()]);
//not (prev) disabled?
// toggle all triggers based on their setting
// register for lid notifications
if(YES != [currentPrefs[PREF_IS_DISABLED] boolValue])
{
//toggle all triggers
[triggers toggle:ALL_TRIGGERS state:NSOnState];
//register for lid notifications
[lid register4Notifications];
//dbg msg
logMsg(LOG_DEBUG, @"toggled (all) triggers");
logMsg(LOG_DEBUG, @"registered for lid change notifications");
}
//(prev) disabled
else
{
//dbg msg
logMsg(LOG_DEBUG, @"user set 'disabled' preference, so did not register for any triggers");
logMsg(LOG_DEBUG, @"currently disabled, so did not register for lid change notifications");
}
//init global queue
eventQueue = [[Queue alloc] init];
//dbg msg
logMsg(LOG_DEBUG, @"initialized global queue");
//alloc/init user comms XPC obj
userCommsListener = [[UserCommsListener alloc] init];
if(nil == userCommsListener)
//alloc/init XPC listener
xpcListener = [[XPCListener alloc] init];
if(nil == xpcListener)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to initialize user comms XPC listener"]);
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to initialize XPC listener"]);
//bail
goto bail;
@@ -183,6 +171,9 @@ int main(int argc, const char * argv[])
//dbg msg
logMsg(LOG_DEBUG, @"listening for client XPC connections");
//run loop
[[NSRunLoop currentRunLoop] run];
}//pool
//happy
@@ -1,44 +0,0 @@
//
// file: DeviceTrigger.h
// project: DND (launch daemon)
// description: monitor and alert logic for device insertion events (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Cocoa;
@import Foundation;
#import <IOKit/usb/IOUSBLib.h>
/* CLASS INTERFACE */
@interface DeviceTrigger : NSObject
{
}
/* PROPERTIES */
//notification port
@property(nonatomic)IONotificationPortRef notificationPort;
//callback for USB devices
void usbAppeared(void *refCon, io_iterator_t iterator);
//run loop source
@property(nonatomic)CFRunLoopSourceRef runLoopSource;
/* METHODS */
//register for notifications
-(BOOL)toggle:(NSControlStateValue)state;
//process new USB insertion
// get info about device and log
-(void)handleNewDevice:(io_iterator_t)iterator;
@end
@@ -1,244 +0,0 @@
// file: DeviceTrigger.m
// project: DND (launch daemon)
// description: monitor and alert logic for device insertion events
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Consts.h"
#import "Logging.h"
#import "Triggers.h"
#import "Utilities.h"
#import "Preferences.h"
#import "DeviceTrigger.h"
/* GLOBALS */
//triggers object
extern Triggers* triggers;
//preferences obj
extern Preferences* preferences;
@implementation DeviceTrigger
@synthesize runLoopSource;
@synthesize notificationPort;
//callback for USB devices
void usbAppeared(void *refCon, io_iterator_t iterator)
{
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"usb device inserted"]);
//process new device
[(__bridge DeviceTrigger *)refCon handleNewDevice:iterator];
return;
}
//toggle lid notifications
-(BOOL)toggle:(NSControlStateValue)state
{
//flag
BOOL wasToggled = NO;
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"toggling devices notifications: %lu", state]);
//on?
// enable
if(NSOnState == state)
{
//enable
wasToggled = [self enable];
}
//off
// disable
else
{
//disable
[self disable];
//manually set flag
wasToggled = YES;
}
return wasToggled;
}
//start USB monitoring
-(BOOL)enable
{
//status
BOOL initialized = NO;
//status
kern_return_t status = kIOReturnError;
//iterator
io_iterator_t iterator = 0;
//device
io_service_t device = 0;
//create notification port
self.notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
//get run loop source
self.runLoopSource = IONotificationPortGetRunLoopSource(self.notificationPort);
//add source
CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, kCFRunLoopDefaultMode);
//add notification
// pass in 'self' so can access obj-c methods in callbacks
status = IOServiceAddMatchingNotification(self.notificationPort, kIOMatchedNotification, IOServiceMatching(kIOUSBDeviceClassName), usbAppeared,(__bridge void *)self, &iterator);
if(kIOReturnSuccess != status)
{
//err
logMsg(LOG_ERR, [NSString stringWithFormat:@"IOServiceAddMatchingNotification() failed with %d", status]);
//bail
goto bail;
}
//process existing devices
// also 'drains' interator...
device = IOIteratorNext(iterator);
while(0 != device)
{
//record device name/properties
//[self logDeviceProperties:device];
//release
IOObjectRelease(device);
//get next
device = IOIteratorNext(iterator);
}
//happy
initialized = YES;
bail:
return initialized;
}
//stop
// invalidate runloop src and notification port
-(void)disable
{
//invalidate runloop src
if(nil != self.runLoopSource)
{
//invalidate
CFRunLoopSourceInvalidate(self.runLoopSource);
//unset
self.runLoopSource = nil;
}
//destroy notification port
if(nil != self.notificationPort)
{
//destroy
IONotificationPortDestroy(self.notificationPort);
//unset
self.notificationPort = nil;
}
return;
}
//process new USB insertion
// get info about device and log
-(void)handleNewDevice:(io_iterator_t)iterator
{
//usb device
io_service_t device;
//device name
io_name_t deviceName = {0};
//timestamp
NSDate* timestamp = nil;
//process
while((device = IOIteratorNext(iterator)))
{
//reset
bzero(deviceName, sizeof(io_name_t));
//init timestamp
timestamp = [NSDate date];
//get device name
if(KERN_SUCCESS != IORegistryEntryGetName(device, deviceName))
{
//err msg
logMsg(LOG_ERR, @"failed to get usb device name");
//set to unknown
strncpy(deviceName, "<unknown>", sizeof(io_name_t)-1);
}
//dbg msg
// log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"[NEW EVENT] usb inserted: \"%s\"", deviceName]);
//process event
// report to user, server, execute actions, etc.
[triggers processEvent:DEVICE_TRIGGER info:@{KEY_DEVICE_NAME:[NSString stringWithUTF8String:deviceName]}];
//release device
IOObjectRelease(device);
//unset
device = 0;
}
return;
}
//log name/properties of a device
-(void)logDeviceProperties:(io_service_t)device
{
//device name
io_name_t deviceName = {0};
//device properties
CFMutableDictionaryRef deviceProperties = NULL;
//get device name
if(KERN_SUCCESS == IORegistryEntryGetName(device, deviceName))
{
//dbg msg & log
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"usb device name: %s", deviceName]);
}
//get device properties
if( (kIOReturnSuccess == IORegistryEntryCreateCFProperties(device, &deviceProperties, kCFAllocatorDefault, kNilOptions)) &&
(NULL != deviceProperties) )
{
//dbg msg & log
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"usb device properties: %@", deviceProperties]);
}
//release device props
if(NULL != deviceProperties)
{
//release
CFRelease(deviceProperties);
//unset
deviceProperties = NULL;
}
return;
}
@end
@@ -1,44 +0,0 @@
//
// file: LidTrigger.h
// project: DND (launch daemon)
// description: monitor and alert logic for lid open events (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Utilities.h"
@import Foundation;
#import <IOKit/IOKitLib.h>
#import <IOKit/pwr_mgt/IOPM.h>
/* CLASS INTERFACE */
@interface LidTrigger : NSObject
{
}
/* PROPERTIES */
//lid state
@property LidState lidState;
//dispatch queue
@property dispatch_queue_t dispatchQ;
//notification port
@property IONotificationPortRef notificationPort;
//notification object
@property io_object_t notification;
/* METHODS */
//register for notifications
-(BOOL)toggle:(NSControlStateValue)state;
@end
@@ -1,325 +0,0 @@
// file: LidTrigger.m
// project: DND (launch daemon)
// description: monitor and alert logic for lid open events
// code inspired by:
// https://github.com/zarigani/ClamshellWake/blob/master/ClamshellWake.cpp
// https://github.com/dustinrue/ControlPlane/blob/master/Source/LaptopLidEvidenceSource.m
// note: manually get state from terminal via:
// ioreg -r -k AppleClamshellState -d 4 | grep AppleClamshellState
#import "Consts.h"
#import "Logging.h"
#import "Triggers.h"
#import "Utilities.h"
#import "LidTrigger.h"
#import "Preferences.h"
/* GLOBALS */
//last state
// sometimes multiple notifications are delivered!?
LidState lastLidState;
//triggers object
extern Triggers* triggers;
//preferences obj
extern Preferences* preferences;
//callback for power/lid events
static void pmDomainChange(void *refcon, io_service_t service, uint32_t messageType, void *messageArgument)
{
//lid state
int lidState = stateUnavailable;
//sleep bit
int sleepState = -1;
//preferences
NSDictionary* currentPrefs = nil;
//timestamp
NSDate* timestamp = nil;
//init timestamp
timestamp = [NSDate date];
//ignore any messages that are related to lid state
if(kIOPMMessageClamshellStateChange != messageType)
{
//bail
goto bail;
}
//dbg msg
logMsg(LOG_DEBUG, @"got 'kIOPMMessageClamshellStateChange' message");
//get prefs
currentPrefs = [preferences get:nil];
//if user explicity set disabled
// bail here, to ignore everything
if(YES == [currentPrefs[PREF_IS_DISABLED] boolValue])
{
//dbg msg
logMsg(LOG_DEBUG, @"client disabled DND, so ignoring lid event");
//update 'prev' state?
lastLidState = stateOpen;
//bail
goto bail;
}
//get state
lidState = ((int) messageArgument & kClamshellStateBit);
//get sleep state
sleepState = !!(((int)messageArgument & kClamshellSleepBit));
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"lid state: %@ (sleep bit: %d)", (lidState) ? @"closed" : @"open", sleepState]);
//(new) open?
// OS sometimes delivers 2x events, so ignore same same
if( (stateOpen == lidState) &&
(stateOpen != lastLidState) )
{
//ignore if lid isn't really open
// on reboot, OS may deliver 'open' message if external monitors are connected
if(stateOpen != getLidState())
{
//bail
goto bail;
}
//update 'prev' state
lastLidState = stateOpen;
//dbg msg
// log to file
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"[NEW EVENT] lid state: open (sleep state: %d)", sleepState]);
//process event
// report to user, server, execute actions, etc.
[triggers processEvent:LID_TRIGGER info:nil];
}
//(new) close?
// OS sometimes delivers 2x events, so ignore same same
else if( (stateClosed == lidState) &&
(stateClosed != lastLidState) )
{
//update 'prev' state
lastLidState = stateClosed;
//dbg msg
logMsg(LOG_DEBUG|LOG_TO_FILE, [NSString stringWithFormat:@"[NEW EVENT] lid state: closed (sleep state: %d)", sleepState]);
}
bail:
return;
}
@implementation LidTrigger
@synthesize lidState;
@synthesize dispatchQ;
@synthesize notification;
@synthesize notificationPort;
//init
-(id)init
{
//super
self = [super init];
if(nil != self)
{
//init
notificationPort = NULL;
//init
notification = 0;
//init to current state
lastLidState = getLidState();
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"initial lid state: %d", lastLidState]);
//init
dispatchQ = NULL;
}
return self;
}
//toggle lid notifications
-(BOOL)toggle:(NSControlStateValue)state
{
//flag
BOOL wasToggled = NO;
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"toggling lid notifications: %lu", state]);
//on?
// enable
if(NSOnState == state)
{
//enable
wasToggled = [self enable];
}
//off
// disable
else
{
//disable
[self disable];
//manually set flag
wasToggled = YES;
}
return wasToggled;
}
//register for notifications
-(BOOL)enable
{
//return var
BOOL registered = NO;
//status var
kern_return_t status = kIOReturnError;
//root domain for power management
io_service_t powerManagementRD = MACH_PORT_NULL;
//dbg msg
logMsg(LOG_DEBUG, @"registering for lid notifications");
//make sure state is ok
if(stateUnavailable == getLidState())
{
//err msg
logMsg(LOG_ERR, @"failed to get lid state, so aborting lid notifications registration");
//error
goto bail;
}
//create queue
dispatchQ = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
if(NULL == dispatchQ)
{
//err msg
logMsg(LOG_ERR, @"failed to create dispatch queue for lid notifications");
//error
goto bail;
}
//set target
dispatch_set_target_queue(dispatchQ, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));
//create notification port
notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
if(NULL == notificationPort)
{
//err msg
logMsg(LOG_ERR, @"failed to create notification port for lid notifications");
//error
goto bail;
}
//set dispatch queue
IONotificationPortSetDispatchQueue(notificationPort, dispatchQ);
//get matching service for power management root domain
powerManagementRD = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPMrootDomain"));
if(0 == powerManagementRD)
{
//err msg
logMsg(LOG_ERR, @"failed to get power management root domain for lid notifications");
//error
goto bail;
}
//add interest notification
status = IOServiceAddInterestNotification(notificationPort, powerManagementRD, kIOGeneralInterest,
pmDomainChange, &lidState, &notification);
if(KERN_SUCCESS != status)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to get add interest notifcation for lid notifications (error: 0x:%x)", status]);
//error
goto bail;
}
//happy
registered = YES;
bail:
//release
if(MACH_PORT_NULL != powerManagementRD)
{
//release
IOObjectRelease(powerManagementRD);
//unset
powerManagementRD = MACH_PORT_NULL;
}
return registered;
}
//unregister for notifications
-(void)disable
{
//dbg msg
logMsg(LOG_DEBUG, @"unregistering lid notifications");
//release notification
if(0 != notification)
{
//release
IOObjectRelease(notification);
//unset
notification = 0;
//dbg msg
logMsg(LOG_DEBUG, @"released service interest notification");
}
//destroy notification port
if(NULL != notificationPort)
{
//set queue to NULL
IONotificationPortSetDispatchQueue(notificationPort, NULL);
//unset dispatch queue
dispatchQ = NULL;
//destroy port
IONotificationPortDestroy(notificationPort);
//unset
notificationPort = NULL;
//dbg msg
logMsg(LOG_DEBUG, @"destroyed notification port");
}
return;
}
@end
@@ -1,35 +0,0 @@
//
// file: Power.m
// project: DND (launch daemon)
// description: monitor and alert logic for power events (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Cocoa;
@import Foundation;
#import <IOKit/usb/IOUSBLib.h>
/* CLASS INTERFACE */
@interface PowerTrigger : NSObject
{
}
/* PROPERTIES */
//observer for screensaver off events
@property(nonatomic, retain)id screenSaverNotification;
/* METHODS */
//register for notifications
-(BOOL)toggle:(NSControlStateValue)state;
@end
@@ -1,118 +0,0 @@
// file: Power.m
// project: DND (launch daemon)
// description: monitor and alert logic for power events (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Consts.h"
#import "Logging.h"
#import "Triggers.h"
#import "Utilities.h"
#import "Preferences.h"
#import "PowerTrigger.h"
/* GLOBALS */
//triggers object
extern Triggers* triggers;
//preferences obj
extern Preferences* preferences;
@implementation PowerTrigger
@synthesize screenSaverNotification;
//toggle lid notifications
-(BOOL)toggle:(NSControlStateValue)state
{
//flag
BOOL wasToggled = NO;
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"toggling power notifications: %lu", state]);
//on?
// enable
if(NSOnState == state)
{
//enable
wasToggled = [self enable];
}
//off
// disable
else
{
//disable
[self disable];
//manually set flag
wasToggled = YES;
}
return wasToggled;
}
//start power event monitoring
-(BOOL)enable
{
//status
BOOL initialized = NO;
/*
com.apple.screensaver.didstart
com.apple.screensaver.willstop
com.apple.screensaver.didstop
*/
//add observer for screen save on
// we don't get a screen save stop, so this will trigger process monitoring for exit of ScreenSaverEngine
self.screenSaverNotification = [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"com.apple.screensaver.didlaunch" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification)
{
//TODO: trigger process monitoring
//dbg msg
// log to file
//logMsg(LOG_DEBUG|LOG_TO_FILE, @"[NEW EVENT] screen saver did stop");
//process event
// report to user, server, execute actions, etc.
//[triggers processEvent:POWER_TRIGGER info:@{KEY_POWER_TYPE:@"screen saver did stop"}];
}];
//dbg msg
logMsg(LOG_DEBUG, @"enabled screen saver 'did launch'");
bail:
return initialized;
}
//disable
-(void)disable
{
//disable
// screen saver start notification
if(nil != self.screenSaverNotification)
{
//remove
[[NSNotificationCenter defaultCenter] removeObserver:self.screenSaverNotification];
//unset
self.screenSaverNotification = nil;
}
//TODO: make sure to stop process monitoring, if it's still going
return;
}
@end
+52 -37
View File
@@ -11,7 +11,6 @@
7D16D6951F64E43300DB3161 /* UpdateWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D16D6911F64E43300DB3161 /* UpdateWindow.xib */; };
7D16D6961F64E43300DB3161 /* UpdateWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D16D6931F64E43300DB3161 /* UpdateWindowController.m */; };
7D3B75141F13354900568828 /* StatusBarMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D3B74FD1F13354900568828 /* StatusBarMenu.m */; };
7D3B75151F13354900568828 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D3B75011F13354900568828 /* MainMenu.xib */; };
7D3B75251F13357D00568828 /* Logging.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D3B75231F13357D00568828 /* Logging.m */; };
7D5C5F521F200B9200C0E94A /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D5C5F511F200B9200C0E94A /* Utilities.m */; };
7D7755E81F02E05B00D0017D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7755E71F02E05B00D0017D /* AppDelegate.m */; };
@@ -19,9 +18,7 @@
7D7755F01F02E05B00D0017D /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D7755EE1F02E05B00D0017D /* MainMenu.xib */; };
7DD25FF01F23B73C00277EC4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7DD25FEF1F23B73C00277EC4 /* Assets.xcassets */; };
7DD260131F25307B00277EC4 /* HyperlinkTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD260121F25307B00277EC4 /* HyperlinkTextField.m */; };
7DD2BF6E1F1DDF1F00B33214 /* AlertMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2BF6D1F1DDF1F00B33214 /* AlertMonitor.m */; };
7DD2BF7A1F1EAC9C00B33214 /* DaemonComms.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2BF791F1EAC9C00B33214 /* DaemonComms.m */; };
CD20A0D720579AFD0044BCC5 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD20A0D620579AFD0044BCC5 /* Sentry.framework */; };
7DD2BF7A1F1EAC9C00B33214 /* XPCDaemonClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2BF791F1EAC9C00B33214 /* XPCDaemonClient.m */; };
CD3307E020375ED000F10D71 /* StatusBarPopoverController.m in Sources */ = {isa = PBXBuildFile; fileRef = CD3307DF20375ED000F10D71 /* StatusBarPopoverController.m */; };
CD3307E22037648B00F10D71 /* StatusBarPopover.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD3307E12037648B00F10D71 /* StatusBarPopover.xib */; };
CD3307E420376B8300F10D71 /* popoverCloseAlt.png in Resources */ = {isa = PBXBuildFile; fileRef = CD3307E320376B8300F10D71 /* popoverCloseAlt.png */; };
@@ -29,6 +26,9 @@
CD3307E820376CCB00F10D71 /* dndIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CD3307E720376CCB00F10D71 /* dndIcon.png */; };
CD981A8D2069049B001B875B /* statusIconDisabled.png in Resources */ = {isa = PBXBuildFile; fileRef = CD981A8B2069049A001B875B /* statusIconDisabled.png */; };
CD981A8E2069049B001B875B /* statusIconDisabled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CD981A8C2069049A001B875B /* statusIconDisabled@2x.png */; };
CDD8075D2134E0930046594E /* Sentry.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = CDD8075C2134E0930046594E /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CDFA0888213685370089758C /* XPCUser.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFA0887213685370089758C /* XPCUser.m */; };
CDFA08AA213B3ECA0089758C /* Camera.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFA08A9213B3ECA0089758C /* Camera.m */; };
CDFB7888206E2F3400ABDD04 /* statusIconWhite.png in Resources */ = {isa = PBXBuildFile; fileRef = CDFB7884206E2F3400ABDD04 /* statusIconWhite.png */; };
CDFB7889206E2F3400ABDD04 /* statusIconDisabledWhite.png in Resources */ = {isa = PBXBuildFile; fileRef = CDFB7885206E2F3400ABDD04 /* statusIconDisabledWhite.png */; };
CDFB788A206E2F3400ABDD04 /* statusIconDisabledWhite@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CDFB7886206E2F3400ABDD04 /* statusIconDisabledWhite@2x.png */; };
@@ -37,6 +37,20 @@
CE968A9D1FCC590200AD6B78 /* statusIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CE968A9B1FCC590200AD6B78 /* statusIcon@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CDD8075B2134E0670046594E /* Copy Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
CDD8075D2134E0930046594E /* Sentry.framework in Copy Frameworks */,
);
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
7D16D68F1F64E43300DB3161 /* Update.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Update.h; path = ../shared/Update.h; sourceTree = "<group>"; };
7D16D6901F64E43300DB3161 /* Update.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Update.m; path = ../shared/Update.m; sourceTree = "<group>"; };
@@ -46,7 +60,6 @@
7D3B74FD1F13354900568828 /* StatusBarMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusBarMenu.m; sourceTree = "<group>"; };
7D3B74FF1F13354900568828 /* StatusBarMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusBarMenu.h; sourceTree = "<group>"; };
7D3B75021F13354900568828 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = MainMenu.xib; sourceTree = "<group>"; };
7D3B75211F13357D00568828 /* UserCommsInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserCommsInterface.h; path = ../shared/UserCommsInterface.h; sourceTree = "<group>"; };
7D3B75221F13357D00568828 /* Consts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Consts.h; path = ../shared/Consts.h; sourceTree = "<group>"; };
7D3B75231F13357D00568828 /* Logging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Logging.m; path = ../shared/Logging.m; sourceTree = "<group>"; };
7D3B75241F13357D00568828 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../shared/Logging.h; sourceTree = "<group>"; };
@@ -61,11 +74,8 @@
7DD25FEF1F23B73C00277EC4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7DD260111F25307B00277EC4 /* HyperlinkTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HyperlinkTextField.h; path = loginItem/3rdParty/HyperlinkTextField.h; sourceTree = "<group>"; };
7DD260121F25307B00277EC4 /* HyperlinkTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HyperlinkTextField.m; path = loginItem/3rdParty/HyperlinkTextField.m; sourceTree = "<group>"; };
7DD2BF6C1F1DDF1F00B33214 /* AlertMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlertMonitor.h; sourceTree = "<group>"; };
7DD2BF6D1F1DDF1F00B33214 /* AlertMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlertMonitor.m; sourceTree = "<group>"; };
7DD2BF781F1EAC9C00B33214 /* DaemonComms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DaemonComms.h; path = ../shared/DaemonComms.h; sourceTree = "<group>"; };
7DD2BF791F1EAC9C00B33214 /* DaemonComms.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DaemonComms.m; path = ../shared/DaemonComms.m; sourceTree = "<group>"; };
CD20A0D620579AFD0044BCC5 /* Sentry.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sentry.framework; path = ../Carthage/Build/Mac/Sentry.framework; sourceTree = "<group>"; };
7DD2BF781F1EAC9C00B33214 /* XPCDaemonClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCDaemonClient.h; path = ../shared/XPCDaemonClient.h; sourceTree = "<group>"; };
7DD2BF791F1EAC9C00B33214 /* XPCDaemonClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPCDaemonClient.m; path = ../shared/XPCDaemonClient.m; sourceTree = "<group>"; };
CD3307DE20375ECF00F10D71 /* StatusBarPopoverController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusBarPopoverController.h; sourceTree = "<group>"; };
CD3307DF20375ED000F10D71 /* StatusBarPopoverController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusBarPopoverController.m; sourceTree = "<group>"; };
CD3307E12037648B00F10D71 /* StatusBarPopover.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = StatusBarPopover.xib; sourceTree = "<group>"; };
@@ -74,6 +84,14 @@
CD3307E720376CCB00F10D71 /* dndIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dndIcon.png; path = ../shared/images/dndIcon.png; sourceTree = "<group>"; };
CD981A8B2069049A001B875B /* statusIconDisabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = statusIconDisabled.png; sourceTree = "<group>"; };
CD981A8C2069049A001B875B /* statusIconDisabled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "statusIconDisabled@2x.png"; sourceTree = "<group>"; };
CDD8075C2134E0930046594E /* Sentry.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sentry.framework; path = ../Carthage/Build/Mac/Sentry.framework; sourceTree = "<group>"; };
CDFA088121367C690089758C /* XPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = XPC.h; path = ../shared/XPC.h; sourceTree = "<group>"; };
CDFA088221367F980089758C /* XPCUserProto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCUserProto.h; path = ../shared/XPCUserProto.h; sourceTree = "<group>"; };
CDFA088321367F980089758C /* XPCDaemonProto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCDaemonProto.h; path = ../shared/XPCDaemonProto.h; sourceTree = "<group>"; };
CDFA0886213685370089758C /* XPCUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCUser.h; sourceTree = "<group>"; };
CDFA0887213685370089758C /* XPCUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCUser.m; sourceTree = "<group>"; };
CDFA08A8213B3ECA0089758C /* Camera.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Camera.h; sourceTree = "<group>"; };
CDFA08A9213B3ECA0089758C /* Camera.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Camera.m; sourceTree = "<group>"; };
CDFB7884206E2F3400ABDD04 /* statusIconWhite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = statusIconWhite.png; sourceTree = "<group>"; };
CDFB7885206E2F3400ABDD04 /* statusIconDisabledWhite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = statusIconDisabledWhite.png; sourceTree = "<group>"; };
CDFB7886206E2F3400ABDD04 /* statusIconDisabledWhite@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "statusIconDisabledWhite@2x.png"; sourceTree = "<group>"; };
@@ -82,17 +100,6 @@
CE968A9B1FCC590200AD6B78 /* statusIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "statusIcon@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
7D7755E01F02E05B00D0017D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CD20A0D720579AFD0044BCC5 /* Sentry.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7D3B75001F13354900568828 /* Base.lproj */ = {
isa = PBXGroup;
@@ -122,7 +129,10 @@
7D3B75201F13356900568828 /* shared */ = {
isa = PBXGroup;
children = (
CDFA088321367F980089758C /* XPCDaemonProto.h */,
CDFA088221367F980089758C /* XPCUserProto.h */,
CD3307E720376CCB00F10D71 /* dndIcon.png */,
CDFA088121367C690089758C /* XPC.h */,
7D16D68F1F64E43300DB3161 /* Update.h */,
7D16D6901F64E43300DB3161 /* Update.m */,
7D16D6911F64E43300DB3161 /* UpdateWindow.xib */,
@@ -130,9 +140,8 @@
7D16D6931F64E43300DB3161 /* UpdateWindowController.m */,
7D5C5F501F200B9200C0E94A /* Utilities.h */,
7D5C5F511F200B9200C0E94A /* Utilities.m */,
7DD2BF781F1EAC9C00B33214 /* DaemonComms.h */,
7DD2BF791F1EAC9C00B33214 /* DaemonComms.m */,
7D3B75211F13357D00568828 /* UserCommsInterface.h */,
7DD2BF781F1EAC9C00B33214 /* XPCDaemonClient.h */,
7DD2BF791F1EAC9C00B33214 /* XPCDaemonClient.m */,
7D3B75221F13357D00568828 /* Consts.h */,
7D3B75231F13357D00568828 /* Logging.m */,
7D3B75241F13357D00568828 /* Logging.h */,
@@ -162,8 +171,8 @@
7D7755E51F02E05B00D0017D /* src */ = {
isa = PBXGroup;
children = (
7DD2BF6C1F1DDF1F00B33214 /* AlertMonitor.h */,
7DD2BF6D1F1DDF1F00B33214 /* AlertMonitor.m */,
CDFA0886213685370089758C /* XPCUser.h */,
CDFA0887213685370089758C /* XPCUser.m */,
7D7755E61F02E05B00D0017D /* AppDelegate.h */,
7D7755E71F02E05B00D0017D /* AppDelegate.m */,
7D3B74FF1F13354900568828 /* StatusBarMenu.h */,
@@ -177,6 +186,8 @@
7D7755EE1F02E05B00D0017D /* MainMenu.xib */,
7D7755F11F02E05B00D0017D /* Info.plist */,
7D7755E91F02E05B00D0017D /* Supporting Files */,
CDFA08A8213B3ECA0089758C /* Camera.h */,
CDFA08A9213B3ECA0089758C /* Camera.m */,
);
name = src;
path = loginItem;
@@ -202,7 +213,7 @@
CD20A0D520579AE50044BCC5 /* Frameworks */ = {
isa = PBXGroup;
children = (
CD20A0D620579AFD0044BCC5 /* Sentry.framework */,
CDD8075C2134E0930046594E /* Sentry.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -215,8 +226,8 @@
buildConfigurationList = 7D7755F41F02E05B00D0017D /* Build configuration list for PBXNativeTarget "loginItem" */;
buildPhases = (
7D7755DF1F02E05B00D0017D /* Sources */,
7D7755E01F02E05B00D0017D /* Frameworks */,
7D7755E11F02E05B00D0017D /* Resources */,
CDD8075B2134E0670046594E /* Copy Frameworks */,
);
buildRules = (
);
@@ -233,7 +244,7 @@
7D7755DB1F02E05B00D0017D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Objective-See";
TargetAttributes = {
7D7755E21F02E05B00D0017D = {
@@ -241,7 +252,7 @@
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.ApplicationGroups.Mac = {
enabled = 1;
enabled = 0;
};
};
};
@@ -280,7 +291,6 @@
CDFB788B206E2F3400ABDD04 /* statusIconWhite@2x.png in Resources */,
CDFB7889206E2F3400ABDD04 /* statusIconDisabledWhite.png in Resources */,
CDFB788A206E2F3400ABDD04 /* statusIconDisabledWhite@2x.png in Resources */,
7D3B75151F13354900568828 /* MainMenu.xib in Resources */,
CD3307E22037648B00F10D71 /* StatusBarPopover.xib in Resources */,
CD981A8D2069049B001B875B /* statusIconDisabled.png in Resources */,
CD981A8E2069049B001B875B /* statusIconDisabled@2x.png in Resources */,
@@ -300,12 +310,13 @@
7D3B75141F13354900568828 /* StatusBarMenu.m in Sources */,
7D7755EB1F02E05B00D0017D /* main.m in Sources */,
7DD260131F25307B00277EC4 /* HyperlinkTextField.m in Sources */,
CDFA08AA213B3ECA0089758C /* Camera.m in Sources */,
7D3B75251F13357D00568828 /* Logging.m in Sources */,
7D5C5F521F200B9200C0E94A /* Utilities.m in Sources */,
CD3307E020375ED000F10D71 /* StatusBarPopoverController.m in Sources */,
7D7755E81F02E05B00D0017D /* AppDelegate.m in Sources */,
7DD2BF6E1F1DDF1F00B33214 /* AlertMonitor.m in Sources */,
7DD2BF7A1F1EAC9C00B33214 /* DaemonComms.m in Sources */,
7DD2BF7A1F1EAC9C00B33214 /* XPCDaemonClient.m in Sources */,
CDFA0888213685370089758C /* XPCUser.m in Sources */,
7D16D6941F64E43300DB3161 /* Update.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -361,7 +372,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: Objective-See, LLC (VBG97UB4TA)";
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -416,7 +427,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: Objective-See, LLC (VBG97UB4TA)";
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
@@ -439,6 +450,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
@@ -447,7 +459,8 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
INFOPLIST_FILE = loginItem/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../../../../../Frameworks";
OTHER_CODE_SIGN_FLAGS = "";
OTHER_CFLAGS = "-DXPC_USER=1";
OTHER_CODE_SIGN_FLAGS = "-o hard,kill,library";
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.dnd.helper";
PRODUCT_NAME = "Do Not Disturb Helper";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -459,6 +472,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
@@ -467,7 +481,8 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
INFOPLIST_FILE = loginItem/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../../../../../Frameworks";
OTHER_CODE_SIGN_FLAGS = "-o hard,kill";
OTHER_CFLAGS = "-DXPC_USER=1";
OTHER_CODE_SIGN_FLAGS = "-o hard,kill,library";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.dnd.helper";
PRODUCT_NAME = "Do Not Disturb Helper";
-28
View File
@@ -1,28 +0,0 @@
//
// file: AlertMonitor.h
// project: DND (login item)
// description: monitor for alerts from daemon (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
@interface AlertMonitor : NSObject <NSUserNotificationCenterDelegate>
/* PROPERTIES */
@property(nonatomic, retain)NSDate* lastAlert;
/* METHODS */
//forever,
// wait for & display alerts
-(void)monitor;
//forever
// wait for dismiss XPC msg from dameon
// note: currently, will dismiss all alerts...
-(void)dismissAlerts;
@end
-226
View File
@@ -1,226 +0,0 @@
//
// file: AlertMonitor.m
// project: DND (login item)
// description: monitor for alerts from daemom
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Consts.h"
#import "Logging.h"
#import "AppDelegate.h"
#import "DaemonComms.h"
#import "AlertMonitor.h"
@implementation AlertMonitor
@synthesize lastAlert;
//forever,
// receive & display alerts
-(void)monitor
{
//daemon comms object
DaemonComms* daemonComms = nil;
//wait semaphore
dispatch_semaphore_t semaphore = 0;
//init daemon
// use local var here, as we need to block
daemonComms = [[DaemonComms alloc] init];
//init sema
semaphore = dispatch_semaphore_create(0);
//process alerts
// call daemon and block, then display, and repeat!
while(YES)
{
//dbg msg
logMsg(LOG_DEBUG, @"requesting alert(s) from daemon, will block");
//wait for alert from daemon via XPC
[daemonComms alertRequest:^(NSDictionary* alert)
{
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"got alert from daemon: %@", alert]);
//tell daemon we got it
// allows it to be discarded from queue
[daemonComms alertResponse];
//signal alert
// indicates it was processed
dispatch_semaphore_signal(semaphore);
//ignore if it's same/same
// sometimes lid open/awake cause weird stuff with XPC resume, so multiple deliveries
if(YES == [self.lastAlert isEqualToDate:alert[ALERT_TIMESTAMP]])
{
//ignore
// will just exit block
return;
}
//update
self.lastAlert = alert[ALERT_TIMESTAMP];
//show alert on main thread
dispatch_async(dispatch_get_main_queue(), ^{
//show notification
[self showNotification:alert];
});
}];
//wait for alert to be received
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
}//forevers
return;
}
//forever
// wait for alert dismiss XPC msg from dameon
// note: currently, will dismiss all alerts shown...
-(void)dismissAlerts
{
//daemon comms object
DaemonComms* daemonComms = nil;
//wait semaphore
dispatch_semaphore_t semaphore = 0;
//init daemon
// use local var here, as we need to block
daemonComms = [[DaemonComms alloc] init];
//init sema
semaphore = dispatch_semaphore_create(0);
//dimisss alerts
// call daemon and block, then dismiss/repeat
while(YES)
{
//pool
@autoreleasepool
{
//dbg msg
logMsg(LOG_DEBUG, @"requesting alert dismiss message(s) from daemon, will block");
//wait for alert dismiss from daemon via XPC
// for now, will just dimiss all (shown) alerts
[daemonComms alertDismiss:^(NSDictionary* alert)
{
//dbg msg
logMsg(LOG_DEBUG, @"got 'alert dismiss' message from daemon");
//dismiss alerts on main thread
dispatch_async(dispatch_get_main_queue(), ^{
//show notification
[[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications];
//set app delegate's touch bar to nil
// will hide/unset the touch bar alert....
((AppDelegate*)[[NSApplication sharedApplication] delegate]).touchBar = nil;
});
//signal alert
// indicates it was processed
dispatch_semaphore_signal(semaphore);
}];
//wait for alert dismiss msg to be received
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
}//pool
}//forevers
return;
}
//format, then show notification
// both on screen and on touch bar
-(void)showNotification:(NSDictionary*)alert
{
//notification
NSUserNotification* notification = nil;
//formatter
NSDateFormatter* dateFormat = nil;
//dbg msg
logMsg(LOG_DEBUG, @"displaying alert to user...");
//alloc notification
notification = [[NSUserNotification alloc] init];
//alloc formatter
dateFormat = [[NSDateFormatter alloc] init];
//set date format
[dateFormat setDateFormat:@"MM/dd/yyyy HH:mm:ss"];
//set other button title
notification.otherButtonTitle = @"Dismiss";
//remove action button
notification.hasActionButton = NO;
//set title
notification.title = @"⚠️ Do Not Disturb Alert";
//set subtitle
// based on trigger type (lid, usb, etc.)
switch([alert[ALERT_TYPE] integerValue])
{
//lid
case LID_TRIGGER:
notification.subtitle = [NSString stringWithFormat:@"Lid Opened: %@", [dateFormat stringFromDate:alert[ALERT_TIMESTAMP]]];
break;
//device
case DEVICE_TRIGGER:
notification.subtitle = [NSString stringWithFormat:@"Device Inserted: %@", alert[ALERT_INFO][KEY_DEVICE_NAME]];
break;
//power
case POWER_TRIGGER:
notification.subtitle = [NSString stringWithFormat:@"Power Event: %@", alert[ALERT_INFO][KEY_POWER_TYPE]];
break;
default:
break;
}
//set delegate to self
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self];
//deliver notification
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
//init/show touch bar
[((AppDelegate*)[[NSApplication sharedApplication] delegate]) initTouchBar];
return;
}
//delegate method
// always should alert to user
-(BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification
{
return YES;
}
@end
+3 -2
View File
@@ -8,9 +8,10 @@
//
@import Cocoa;
@import AVFoundation;
#import "DaemonComms.h"
#import "StatusBarMenu.h"
#import "XPCDaemonClient.h"
#import "UpdateWindowController.h"
@interface AppDelegate : NSObject <NSApplicationDelegate, NSTouchBarProvider, NSTouchBarDelegate>
@@ -30,7 +31,7 @@
@property(nonatomic, retain)UpdateWindowController* updateWindowController;
//daemon comms
@property(nonatomic, retain)DaemonComms* daemonComms;
@property(nonatomic, retain)XPCDaemonClient* daemonComms;
//observer
@property(nonatomic, retain)NSObject* appObserver;
+29 -54
View File
@@ -12,7 +12,7 @@
#import "Logging.h"
#import "Utilities.h"
#import "AppDelegate.h"
#import "AlertMonitor.h"
#import "XPCDaemonClient.h"
@interface AppDelegate ()
@@ -38,14 +38,14 @@
//dbg msg
logMsg(LOG_DEBUG, @"starting DND login item");
//init deamon comms
daemonComms = [[DaemonComms alloc] init];
//init deamon client
daemonComms = [[XPCDaemonClient alloc] init];
//get preferences
// sends XPC message to daemon
preferences = [self.daemonComms getPreferences:nil];
//no preferences yet? ... first run
//no preferences yet? ... first run on full (re)install
// a) set some defaults for login item (passive mode, etc)
// b) wait for main app to exit before checking in with daemon
if(0 == preferences.count)
@@ -70,39 +70,44 @@
// wait until it's exited to complete initializations
self.appObserver = [[[NSWorkspace sharedWorkspace] notificationCenter] addObserverForName:NSWorkspaceDidTerminateApplicationNotification object:nil queue:nil usingBlock:^(NSNotification *notification)
{
//ignore others
if(YES != [MAIN_APP_ID isEqualToString:[((NSRunningApplication*)notification.userInfo[NSWorkspaceApplicationKey]) bundleIdentifier]])
{
//ignore
return;
}
//ignore others
if(YES != [MAIN_APP_ID isEqualToString:[((NSRunningApplication*)notification.userInfo[NSWorkspaceApplicationKey]) bundleIdentifier]])
{
//ignore
return;
}
//dbg msg
logMsg(LOG_DEBUG, @"main application completed");
//dbg msg
logMsg(LOG_DEBUG, @"main application completed");
//remove observer
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self.appObserver];
//unset
self.appObserver = nil;
//remove observer
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self.appObserver];
//unset
self.appObserver = nil;
//(re)load prefs
// main app should have set em all now
preferences = [self.daemonComms getPreferences:nil];
//complete initializations
[self completeInitialization:preferences firstTime:YES];
}];
//complete initializations
// will show popover, etc
[self completeInitialization:preferences firstTime:YES];
}]; //main app (welcome screen) exited
}
//found prefs
// main app already ran, so just complete init's
else
{
//might be an upgrade so ask for camera permissions
requestCameraAccess();
//complete initializations
[self completeInitialization:preferences firstTime:NO];
}
bail:
return;
@@ -112,9 +117,6 @@ bail:
// based on prefs, show status bar, check for updates, etc...
-(void)completeInitialization:(NSDictionary*)preferences firstTime:(BOOL)firstTime
{
//alert monitor obj
__block AlertMonitor* alertMonitor = nil;
//run with status bar icon?
if(YES != [preferences[PREF_NO_ICON_MODE] boolValue])
{
@@ -147,33 +149,6 @@ bail:
});
}
//wait to checkin
// first time, need a bit to show the popover
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, firstTime * 5 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
//init alert monitor
alertMonitor = [[AlertMonitor alloc] init];
//in background
// monitor / process alerts from daemon
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//monitor
[alertMonitor monitor];
});
//in background
// wait for alert dimiss msgs from daemon
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//monitor
[alertMonitor dismissAlerts];
});
});
return;
}
@@ -238,7 +213,7 @@ bail:
touchBarItem = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
//icon
if(YES == [identifier isEqualToString: @".icon" ])
if(YES == [identifier isEqualToString:@".icon"])
{
//init icon view
iconView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 30.0, 30.0)];
+27
View File
@@ -0,0 +1,27 @@
//
// Camera.h
// loginItem
//
// Created by Patrick Wardle on 9/1/18.
// Copyright © 2018 Objective-See. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface Camera : NSObject
/* PROPERTIES */
//av session
@property(nonatomic, retain)AVCaptureSession* session;
/* METHODS */
//capture an image from the webcam
-(NSData*)captureImage;
@end
+184
View File
@@ -0,0 +1,184 @@
//
// Camera.m
// loginItem
//
// Created by Patrick Wardle on 9/1/18.
// Copyright © 2018 Objective-See. All rights reserved.
//
#import "Camera.h"
#import "Logging.h"
@implementation Camera
@synthesize session;
//configure
-(BOOL)configure
{
//flag
BOOL configured = NO;
//device
AVCaptureDevice* device = nil;
//input
AVCaptureInput* input = nil;
//output
AVCaptureStillImageOutput* output = nil;
//find default camera
device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if(nil == device)
{
//err msg
logMsg(LOG_ERR, @"failed to find camera for capture");
//bail
goto bail;
}
//init input from camera
input = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil];
if(nil == input)
{
//err msg
logMsg(LOG_ERR, @"failed to find input from camera");
//bail
goto bail;
}
//init session
self.session = [[AVCaptureSession alloc] init];
//check if input can be added to session
if(YES != [self.session canAddInput:input])
{
//err msg
logMsg(LOG_ERR, @"cannot add input to session");
//bail
goto bail;
}
//add input
[self.session addInput:input];
//init output
output = [[AVCaptureStillImageOutput alloc] init];
//set output settings (jpeg)
output.outputSettings = @{AVVideoCodecKey:AVVideoCodecJPEG};
//check if output can be added to session
if(YES != [self.session canAddOutput:output])
{
//err msg
logMsg(LOG_ERR, @"cannot add output to session");
//bail
goto bail;
}
//add output
[self.session addOutput:output];
//happy
configured = YES;
bail:
return configured;
}
//capture an image from the webcam
-(NSData*)captureImage
{
//image
__block NSData* image = nil;
//output
__block AVCaptureStillImageOutput* output = nil;
//wait semaphore
dispatch_semaphore_t semaphore = 0;
//init sema
semaphore = dispatch_semaphore_create(0);
//configure/init session
if(YES == [self configure])
{
//dbg msg
logMsg(LOG_DEBUG, @"configured camera for capture");
//start
[self.session startRunning];
//give session some time to start
// could use KVO, etc, but this seems like a pain
// see: https://stackoverflow.com/questions/27260697/avcapturedevice-adjustingexposure-is-false-but-captured-image-is-dark
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
//grab output
output = self.session.outputs.firstObject;
//capture image
[output captureStillImageAsynchronouslyFromConnection:[output connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
{
//covert image
if( (nil == error) &&
(NULL != imageDataSampleBuffer))
{
//dbg msg
logMsg(LOG_DEBUG, @"captured image");
//covert
image = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
}
//error
else
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to capture image (%@)", error]);
}
//(always) signal sema
dispatch_semaphore_signal(semaphore);
}];
});
//wait for install to be completed by XPC
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
//stop session
if(YES == self.session.isRunning)
{
//stop
[self.session stopRunning];
}
}
//failed to init session
else
{
//err msg
logMsg(LOG_ERR, @"failed to initialize/configure camera capture session");
//bail
goto bail;
}
bail:
return image;
}
@end
+2 -2
View File
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
+2 -2
View File
@@ -9,7 +9,7 @@
@import Cocoa;
#import "DaemonComms.h"
#import "XPCDaemonClient.h"
@interface StatusBarMenu : NSObject <NSPopoverDelegate>
{
@@ -23,7 +23,7 @@
@property (retain, nonatomic)NSPopover *popover;
//daemom comms object
@property (nonatomic, retain)DaemonComms* daemonComms;
@property (nonatomic, retain)XPCDaemonClient* daemonComms;
//disabled flag
@property BOOL isDisabled;
+2 -3
View File
@@ -11,9 +11,8 @@
#import "Logging.h"
#import "Utilities.h"
#import "AppDelegate.h"
#import "DaemonComms.h"
#import "StatusBarMenu.h"
#import "UserCommsInterface.h"
#import "XPCDaemonClient.h"
#import "StatusBarPopoverController.h"
//menu items
@@ -44,7 +43,7 @@ enum menuItems
if(self != nil)
{
//init daemon comms
daemonComms = [[DaemonComms alloc] init];
daemonComms = [[XPCDaemonClient alloc] init];
//init status item
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
+20
View File
@@ -0,0 +1,20 @@
//
// file: XPCUser.h
// project: DND (login item)
// description: user XPC methods (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
#import <dnd/dnd-Swift.h>
#import "XPCUserProto.h"
@interface XPCUser : NSObject <XPCUserProtocol, NSUserNotificationCenterDelegate>
{
}
@end
+121
View File
@@ -0,0 +1,121 @@
//
// file: XPCUser.m
// project: DND (login item)
// description: user XPC methods
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#import "Camera.h"
#import "Consts.h"
#import "Logging.h"
#import "XPCUser.h"
#import "AppDelegate.h"
@implementation XPCUser
//show an alert
-(void)alertShow:(NSDictionary*)alert
{
//notification
NSUserNotification* notification = nil;
//formatter
NSDateFormatter* dateFormat = nil;
//dbg msg
logMsg(LOG_DEBUG, @"XPC request from daemon: alert show");
//alloc notification
notification = [[NSUserNotification alloc] init];
//alloc formatter
dateFormat = [[NSDateFormatter alloc] init];
//set date format
[dateFormat setDateFormat:@"MM/dd/yyyy HH:mm:ss"];
//set other button title
notification.otherButtonTitle = @"Dismiss";
//remove action button
notification.hasActionButton = NO;
//set title
notification.title = @"⚠️ Do Not Disturb Alert";
//set subtitle
notification.subtitle = [NSString stringWithFormat:@"Lid Opened: %@", [dateFormat stringFromDate:alert[ALERT_TIMESTAMP]]];
//set delegate to self
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self];
//show alert on main thread
dispatch_async(dispatch_get_main_queue(), ^{
//deliver notification
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
//init/show touch bar
[((AppDelegate*)[[NSApplication sharedApplication] delegate]) initTouchBar];
});
return;
}
//dismiss alert(s)
-(void)alertDismiss
{
//dbg msg
logMsg(LOG_DEBUG, @"XPC request from daemon: alert dismiss");
//dismiss alerts on main thread
dispatch_async(dispatch_get_main_queue(), ^{
//clear (all) notification(s)
[[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications];
//set app delegate's touch bar to nil
// will hide/unset the touch bar alert....
((AppDelegate*)[[NSApplication sharedApplication] delegate]).touchBar = nil;
});
return;
}
//XPC method
// capture an image from the webcam
-(void)captureImage:(void (^)(NSData *))reply
{
//image data
NSData* image = nil;
//camera obj
Camera* camera = nil;
//dbg msg
logMsg(LOG_DEBUG, @"XPC request from daemon: capture picture");
//init camera
camera = [[Camera alloc] init];
//grab image
image = [camera captureImage];
//get current prefs
reply(image);
return;
}
//'NSUserNotificationCenterDelegate' delegate method
// tell system to always present (show) the alert to user
-(BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification
{
return YES;
}
@end
+2 -5
View File
@@ -24,11 +24,8 @@ int main(int argc, const char * argv[])
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"STARTED: login item (args: %@)", [[NSProcessInfo processInfo] arguments]]);
//init crash reporting client
SentryClient.sharedClient = [[SentryClient alloc] initWithDsn:CRASH_REPORTING_URL didFailWithError:nil];
//start crash handler
[SentryClient.sharedClient startCrashHandlerWithError:nil];
//init crash reporting
initCrashReporting();
//already running?
if(YES == isAppRunning([[NSBundle mainBundle] bundleIdentifier]))
+22 -43
View File
@@ -8,14 +8,13 @@
/* Begin PBXBuildFile section */
7D16D69A1F65EF9900DB3161 /* Update.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D16D6991F65EF9900DB3161 /* Update.m */; };
7D2582571F19FAD700D28B95 /* DaemonComms.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2582561F19FAD700D28B95 /* DaemonComms.m */; };
7D2582571F19FAD700D28B95 /* XPCDaemonClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2582561F19FAD700D28B95 /* XPCDaemonClient.m */; };
7D46FF041F5F496800FEB0F8 /* patrons.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7D46FF031F5F496800FEB0F8 /* patrons.txt */; };
7D564DAE1F18434F00B8AAD6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D564DAD1F18434F00B8AAD6 /* AppDelegate.m */; };
7D564DB11F18434F00B8AAD6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D564DB01F18434F00B8AAD6 /* main.m */; };
7D564DB61F18434F00B8AAD6 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D564DB41F18434F00B8AAD6 /* MainMenu.xib */; };
7D564DD61F18441500B8AAD6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7D564DBF1F18441500B8AAD6 /* Assets.xcassets */; };
7D564DDA1F18441500B8AAD6 /* AboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D564DC31F18441500B8AAD6 /* AboutWindowController.m */; };
7D564DDB1F18441500B8AAD6 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D564DC51F18441500B8AAD6 /* MainMenu.xib */; };
7D564DDC1F18441500B8AAD6 /* AboutWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D564DC71F18441500B8AAD6 /* AboutWindow.xib */; };
7D564DDF1F18441500B8AAD6 /* HyperlinkTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D564DCE1F18441500B8AAD6 /* HyperlinkTextField.m */; };
7D564DE61F18446200B8AAD6 /* Logging.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D564DE41F18446200B8AAD6 /* Logging.m */; };
@@ -23,6 +22,7 @@
7D564DEB1F1855E900B8AAD6 /* UpdateWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D564DE81F1855E900B8AAD6 /* UpdateWindow.xib */; };
7D75537F1F22E40E0010FE88 /* PrefsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D75537D1F22E40E0010FE88 /* PrefsWindowController.m */; };
7D7553801F22E40E0010FE88 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D75537E1F22E40E0010FE88 /* Preferences.xib */; };
7D7553831F23199A0010FE88 /* prefsGeneral.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D7553811F23199A0010FE88 /* prefsGeneral.png */; };
7D7553841F23199A0010FE88 /* prefsUpdate.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D7553821F23199A0010FE88 /* prefsUpdate.png */; };
7DD2BF461F1C2B4200B33214 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DD2BF431F1C2B4200B33214 /* logo.png */; };
7DD2BF471F1C2B4200B33214 /* logoBG.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DD2BF441F1C2B4200B33214 /* logoBG.png */; };
@@ -37,14 +37,12 @@
CD17D58C201A7F8500F798D7 /* Welcome.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD17D58A201A7F8500F798D7 /* Welcome.xib */; };
CD17D58F201A827A00F798D7 /* QuickResponseCode.m in Sources */ = {isa = PBXBuildFile; fileRef = CD17D58E201A827A00F798D7 /* QuickResponseCode.m */; };
CD1FD56B2089224F00151D1C /* appStore.pdf in Resources */ = {isa = PBXBuildFile; fileRef = CD1FD56A2089224E00151D1C /* appStore.pdf */; };
CD20A0CE205797030044BCC5 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD20A0CD205797030044BCC5 /* Sentry.framework */; };
CD20A0DA20579B290044BCC5 /* Sentry.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = CD20A0CD205797030044BCC5 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CD20A0DA20579B290044BCC5 /* Sentry.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = CD20A0CD205797030044BCC5 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CD2F407F204B417E0066673E /* alert.png in Resources */ = {isa = PBXBuildFile; fileRef = CD2F407E204B417E0066673E /* alert.png */; };
CD2F4081204B41C90066673E /* hacker.png in Resources */ = {isa = PBXBuildFile; fileRef = CD2F4080204B41C90066673E /* hacker.png */; };
CD325425204DEAEA0059951B /* dndText@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CD325424204DEAEA0059951B /* dndText@2x.png */; };
CD325427204E0C500059951B /* close.png in Resources */ = {isa = PBXBuildFile; fileRef = CD325426204E0C500059951B /* close.png */; };
CD32542B204E0E420059951B /* closeAlt.png in Resources */ = {isa = PBXBuildFile; fileRef = CD32542A204E0E420059951B /* closeAlt.png */; };
CD68AEE02110CD9E0019E431 /* prefsTriggers.png in Resources */ = {isa = PBXBuildFile; fileRef = CD68AEDF2110CD9D0019E431 /* prefsTriggers.png */; };
CDAAC213201D0CD90032F2E6 /* three.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC212201D0CD80032F2E6 /* three.png */; };
CDAAC215201D2DD30032F2E6 /* checkbox.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC214201D2DD30032F2E6 /* checkbox.png */; };
CDAAC217201D54C30032F2E6 /* prefsLink.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC216201D54C20032F2E6 /* prefsLink.png */; };
@@ -52,8 +50,6 @@
CDAAC21C201D77390032F2E6 /* connected.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC21A201D77390032F2E6 /* connected.png */; };
CDAAC21D201D77390032F2E6 /* unconnected.png in Resources */ = {isa = PBXBuildFile; fileRef = CDAAC21B201D77390032F2E6 /* unconnected.png */; };
CDAAC238201FD4660032F2E6 /* LocalAuthentication.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDAAC237201FD4660032F2E6 /* LocalAuthentication.framework */; };
CDEADE52210214A0005054B0 /* usb.png in Resources */ = {isa = PBXBuildFile; fileRef = CDEADE502102149F005054B0 /* usb.png */; };
CDEADE53210214A0005054B0 /* sleep.png in Resources */ = {isa = PBXBuildFile; fileRef = CDEADE51210214A0005054B0 /* sleep.png */; };
CE0F559C1FD408BB00529259 /* dndText.png in Resources */ = {isa = PBXBuildFile; fileRef = CE0F559B1FD408BB00529259 /* dndText.png */; };
CE133C5F1FD756CC00A29D67 /* dndIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CE133C5E1FD756CC00A29D67 /* dndIcon.png */; };
CE85D3FE1FDB47B200E116A5 /* settings.png in Resources */ = {isa = PBXBuildFile; fileRef = CE85D3FD1FDB47B200E116A5 /* settings.png */; };
@@ -61,23 +57,15 @@
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
7DD25FEE1F23B5AE00277EC4 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = Contents/Library/LoginItems;
dstSubfolderSpec = 1;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
CD20A0D920579B170044BCC5 /* CopyFiles */ = {
CD20A0D920579B170044BCC5 /* Copy Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
CD20A0DA20579B290044BCC5 /* Sentry.framework in CopyFiles */,
CD20A0DA20579B290044BCC5 /* Sentry.framework in Copy Frameworks */,
);
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
@@ -85,9 +73,9 @@
/* Begin PBXFileReference section */
7D16D6981F65EF9900DB3161 /* Update.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Update.h; path = ../shared/Update.h; sourceTree = "<group>"; };
7D16D6991F65EF9900DB3161 /* Update.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Update.m; path = ../shared/Update.m; sourceTree = "<group>"; };
7D2582551F19FAD700D28B95 /* DaemonComms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DaemonComms.h; path = ../shared/DaemonComms.h; sourceTree = "<group>"; };
7D2582561F19FAD700D28B95 /* DaemonComms.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DaemonComms.m; path = ../shared/DaemonComms.m; sourceTree = "<group>"; };
7D2582581F19FB6000D28B95 /* UserCommsInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserCommsInterface.h; path = ../shared/UserCommsInterface.h; sourceTree = "<group>"; };
7D2582551F19FAD700D28B95 /* XPCDaemonClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCDaemonClient.h; path = ../shared/XPCDaemonClient.h; sourceTree = "<group>"; };
7D2582561F19FAD700D28B95 /* XPCDaemonClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPCDaemonClient.m; path = ../shared/XPCDaemonClient.m; sourceTree = "<group>"; };
7D2582581F19FB6000D28B95 /* XPCDaemonProto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPCDaemonProto.h; path = ../shared/XPCDaemonProto.h; sourceTree = "<group>"; };
7D46FF031F5F496800FEB0F8 /* patrons.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = patrons.txt; sourceTree = "<group>"; };
7D564DA91F18434F00B8AAD6 /* Do Not Disturb.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Do Not Disturb.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7D564DAC1F18434F00B8AAD6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@@ -111,6 +99,7 @@
7D75537C1F22E40E0010FE88 /* PrefsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefsWindowController.h; sourceTree = "<group>"; };
7D75537D1F22E40E0010FE88 /* PrefsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrefsWindowController.m; sourceTree = "<group>"; };
7D75537E1F22E40E0010FE88 /* Preferences.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Preferences.xib; sourceTree = "<group>"; };
7D7553811F23199A0010FE88 /* prefsGeneral.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = prefsGeneral.png; sourceTree = "<group>"; };
7D7553821F23199A0010FE88 /* prefsUpdate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = prefsUpdate.png; sourceTree = "<group>"; };
7DD2BF431F1C2B4200B33214 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = "<group>"; };
7DD2BF441F1C2B4200B33214 /* logoBG.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logoBG.png; sourceTree = "<group>"; };
@@ -134,7 +123,6 @@
CD325424204DEAEA0059951B /* dndText@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "dndText@2x.png"; path = "../../../shared/images/dndText@2x.png"; sourceTree = "<group>"; };
CD325426204E0C500059951B /* close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = close.png; sourceTree = "<group>"; };
CD32542A204E0E420059951B /* closeAlt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = closeAlt.png; sourceTree = "<group>"; };
CD68AEDF2110CD9D0019E431 /* prefsTriggers.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = prefsTriggers.png; sourceTree = "<group>"; };
CDAAC212201D0CD80032F2E6 /* three.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = three.png; sourceTree = "<group>"; };
CDAAC214201D2DD30032F2E6 /* checkbox.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = checkbox.png; sourceTree = "<group>"; };
CDAAC216201D54C20032F2E6 /* prefsLink.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = prefsLink.png; sourceTree = "<group>"; };
@@ -142,8 +130,6 @@
CDAAC21A201D77390032F2E6 /* connected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = connected.png; sourceTree = "<group>"; };
CDAAC21B201D77390032F2E6 /* unconnected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = unconnected.png; sourceTree = "<group>"; };
CDAAC237201FD4660032F2E6 /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; };
CDEADE502102149F005054B0 /* usb.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = usb.png; sourceTree = "<group>"; };
CDEADE51210214A0005054B0 /* sleep.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sleep.png; sourceTree = "<group>"; };
CE0F559B1FD408BB00529259 /* dndText.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dndText.png; path = ../../../shared/images/dndText.png; sourceTree = "<group>"; };
CE133C5E1FD756CC00A29D67 /* dndIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dndIcon.png; path = ../../../shared/images/dndIcon.png; sourceTree = "<group>"; };
CE85D3FD1FDB47B200E116A5 /* settings.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = settings.png; sourceTree = "<group>"; };
@@ -156,7 +142,6 @@
buildActionMask = 2147483647;
files = (
CDAAC238201FD4660032F2E6 /* LocalAuthentication.framework in Frameworks */,
CD20A0CE205797030044BCC5 /* Sentry.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -246,9 +231,6 @@
7D564DD31F18441500B8AAD6 /* Images */ = {
isa = PBXGroup;
children = (
CD68AEDF2110CD9D0019E431 /* prefsTriggers.png */,
CDEADE51210214A0005054B0 /* sleep.png */,
CDEADE502102149F005054B0 /* usb.png */,
CD32542A204E0E420059951B /* closeAlt.png */,
CD325426204E0C500059951B /* close.png */,
CD325424204DEAEA0059951B /* dndText@2x.png */,
@@ -269,6 +251,7 @@
CE133C5E1FD756CC00A29D67 /* dndIcon.png */,
CE0F559B1FD408BB00529259 /* dndText.png */,
CE968A9E1FCC66A300AD6B78 /* prefsAction.png */,
7D7553811F23199A0010FE88 /* prefsGeneral.png */,
7D7553821F23199A0010FE88 /* prefsUpdate.png */,
7DD2BF431F1C2B4200B33214 /* logo.png */,
7DD2BF441F1C2B4200B33214 /* logoBG.png */,
@@ -282,11 +265,11 @@
children = (
CD1FD56A2089224E00151D1C /* appStore.pdf */,
7D564DE31F18446200B8AAD6 /* Consts.h */,
7D2582551F19FAD700D28B95 /* DaemonComms.h */,
7D2582561F19FAD700D28B95 /* DaemonComms.m */,
7D2582551F19FAD700D28B95 /* XPCDaemonClient.h */,
7D2582561F19FAD700D28B95 /* XPCDaemonClient.m */,
7D564DE51F18446200B8AAD6 /* Logging.h */,
7D564DE41F18446200B8AAD6 /* Logging.m */,
7D2582581F19FB6000D28B95 /* UserCommsInterface.h */,
7D2582581F19FB6000D28B95 /* XPCDaemonProto.h */,
7D16D6981F65EF9900DB3161 /* Update.h */,
7D16D6991F65EF9900DB3161 /* Update.m */,
7D564DE91F1855E900B8AAD6 /* UpdateWindowController.h */,
@@ -317,9 +300,8 @@
7D564DA51F18434F00B8AAD6 /* Sources */,
7D564DA61F18434F00B8AAD6 /* Frameworks */,
7D564DA71F18434F00B8AAD6 /* Resources */,
7DD25FEE1F23B5AE00277EC4 /* CopyFiles */,
7D16D6971F650FF400DB3161 /* ShellScript */,
CD20A0D920579B170044BCC5 /* CopyFiles */,
CD20A0D920579B170044BCC5 /* Copy Frameworks */,
);
buildRules = (
);
@@ -336,7 +318,7 @@
7D564DA11F18434F00B8AAD6 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Objective-See";
TargetAttributes = {
7D564DA81F18434F00B8AAD6 = {
@@ -344,7 +326,7 @@
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.ApplicationGroups.Mac = {
enabled = 1;
enabled = 0;
};
};
};
@@ -374,7 +356,6 @@
buildActionMask = 2147483647;
files = (
CD32542B204E0E420059951B /* closeAlt.png in Resources */,
CDEADE53210214A0005054B0 /* sleep.png in Resources */,
CD17D56E20178DFC00F798D7 /* mobilePhone.png in Resources */,
CD1FD56B2089224F00151D1C /* appStore.pdf in Resources */,
CD2F407F204B417E0066673E /* alert.png in Resources */,
@@ -389,14 +370,13 @@
CDAAC213201D0CD90032F2E6 /* three.png in Resources */,
CDAAC219201D72780032F2E6 /* linked.png in Resources */,
CD325425204DEAEA0059951B /* dndText@2x.png in Resources */,
CDEADE52210214A0005054B0 /* usb.png in Resources */,
7DD2BF481F1C2B4200B33214 /* logoOver.png in Resources */,
7D7553801F22E40E0010FE88 /* Preferences.xib in Resources */,
7D7553831F23199A0010FE88 /* prefsGeneral.png in Resources */,
CD17D5772017941C00F798D7 /* laptop.png in Resources */,
CD17D58520179BC700F798D7 /* two.png in Resources */,
CD325427204E0C500059951B /* close.png in Resources */,
7D564DD61F18441500B8AAD6 /* Assets.xcassets in Resources */,
CD68AEE02110CD9E0019E431 /* prefsTriggers.png in Resources */,
CD17D57020178EB500F798D7 /* one.png in Resources */,
7D7553841F23199A0010FE88 /* prefsUpdate.png in Resources */,
7D564DDC1F18441500B8AAD6 /* AboutWindow.xib in Resources */,
@@ -404,7 +384,6 @@
CDAAC21D201D77390032F2E6 /* unconnected.png in Resources */,
CD2F4081204B41C90066673E /* hacker.png in Resources */,
CE968A9F1FCC66A300AD6B78 /* prefsAction.png in Resources */,
7D564DDB1F18441500B8AAD6 /* MainMenu.xib in Resources */,
CDAAC217201D54C30032F2E6 /* prefsLink.png in Resources */,
CE133C5F1FD756CC00A29D67 /* dndIcon.png in Resources */,
7D564DEB1F1855E900B8AAD6 /* UpdateWindow.xib in Resources */,
@@ -426,7 +405,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "mkdir -p \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\n\n#archiving\nif [[ $BUILT_PRODUCTS_DIR = *\"ArchiveIntermediates\"* ]]; then\n cp -R -f \"$PROJECT_TEMP_ROOT/UninstalledProducts/macosx/Do Not Disturb Helper.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\n\n#normal build\nelse\n cp -R -f \"$BUILT_PRODUCTS_DIR/Do Not Disturb Helper.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\nfi";
shellScript = "rm -rf \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\nmkdir -p \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\n\n#archiving\nif [[ $BUILT_PRODUCTS_DIR = *\"ArchiveIntermediates\"* ]]; then\n cp -R -f \"$PROJECT_TEMP_ROOT/UninstalledProducts/macosx/Do Not Disturb Helper.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\n\n#normal build\nelse\n cp -R -f \"$BUILT_PRODUCTS_DIR/Do Not Disturb Helper.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */
@@ -437,7 +416,7 @@
files = (
7D564DEA1F1855E900B8AAD6 /* UpdateWindowController.m in Sources */,
CD17D58F201A827A00F798D7 /* QuickResponseCode.m in Sources */,
7D2582571F19FAD700D28B95 /* DaemonComms.m in Sources */,
7D2582571F19FAD700D28B95 /* XPCDaemonClient.m in Sources */,
7D564DE61F18446200B8AAD6 /* Logging.m in Sources */,
7D16D69A1F65EF9900DB3161 /* Update.m in Sources */,
7D564DB11F18434F00B8AAD6 /* main.m in Sources */,
@@ -588,7 +567,7 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
INFOPLIST_FILE = mainApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
OTHER_CODE_SIGN_FLAGS = "";
OTHER_CODE_SIGN_FLAGS = "-o hard,kill,library";
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.dnd";
PRODUCT_NAME = "Do Not Disturb";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -609,7 +588,7 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
INFOPLIST_FILE = mainApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
OTHER_CODE_SIGN_FLAGS = "-o hard,kill";
OTHER_CODE_SIGN_FLAGS = "-o hard,kill,library";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.dnd";
PRODUCT_NAME = "Do Not Disturb";
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
@@ -56,7 +56,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
@@ -75,12 +75,6 @@
ReferencedContainer = "container:mainApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-prefs"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
+9 -2
View File
@@ -22,6 +22,8 @@
{
//center
[self.window center];
return;
}
//automatically invoked when window is loaded
@@ -34,8 +36,13 @@
//super
[super windowDidLoad];
//make white
[self.window setBackgroundColor: NSColor.whiteColor];
//not in mojave dark mode?
// make window color white
if(YES != isDarkMode())
{
//make white
self.window.backgroundColor = NSColor.whiteColor;
}
//grab app version
version = getAppVersion();
+1 -1
View File
@@ -9,7 +9,7 @@
@import Cocoa;
#import "DaemonComms.h"
#import "XPCDaemonClient.h"
#import "AboutWindowController.h"
#import "PrefsWindowController.h"
#import "UpdateWindowController.h"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

+4 -2
View File
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
@@ -28,5 +28,7 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>AppDelegate</string>
<key>NSCameraUsageDescription</key>
<string>When a lid open event occurs, this will allow the application to take a picture!</string>
</dict>
</plist>
+37 -141
View File
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<capability name="box content view" minToolsVersion="7.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.13.2"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -24,7 +23,6 @@
<outlet property="qrcPanel" destination="vdL-RT-p6a" id="KrV-Fe-sK0"/>
<outlet property="qrcProgressIndicator" destination="pUS-KZ-De6" id="EYG-28-zkH"/>
<outlet property="toolbar" destination="V8g-Ya-LK4" id="SH2-6E-QST"/>
<outlet property="triggersView" destination="BuY-2M-Ecx" id="hrr-N9-ajg"/>
<outlet property="updateButton" destination="Mtn-pi-zIl" id="Oe1-Jy-nMH"/>
<outlet property="updateIndicator" destination="o0T-ra-4H0" id="DwL-OB-WQR"/>
<outlet property="updateLabel" destination="Oe2-Ye-1s6" id="1gP-K0-cpP"/>
@@ -34,7 +32,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<rect key="contentRect" x="196" y="240" width="600" height="383"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
@@ -53,27 +51,22 @@
<allowedToolbarItems>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="J66-tT-qAf"/>
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="6nW-4K-zf4"/>
<toolbarItem implicitItemIdentifier="99F00439-5E3B-4FBB-BC65-3E1F7EBDDBC6" explicitItemIdentifier="general" label="general" paletteLabel="general" image="dndIcon" selectable="YES" id="Twx-TJ-y2Q">
<toolbarItem implicitItemIdentifier="99F00439-5E3B-4FBB-BC65-3E1F7EBDDBC6" explicitItemIdentifier="general" label="general" paletteLabel="general" image="prefsGeneral" selectable="YES" id="Twx-TJ-y2Q">
<connections>
<action selector="toolbarButtonHandler:" target="-2" id="9JH-zR-BcH"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="0204F7A2-F780-423C-89FB-28784C971A9A" explicitItemIdentifier="triggers" label="triggers" paletteLabel="triggers" tag="1" image="prefsTriggers" selectable="YES" id="pr7-Pz-jdz">
<connections>
<action selector="toolbarButtonHandler:" target="-2" id="jYk-kP-mSc"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="48B3FCFA-8A19-4D19-A840-E21E6D564389" explicitItemIdentifier="action" label="action" paletteLabel="action" tag="2" image="prefsAction" selectable="YES" id="hqU-b9-59A">
<toolbarItem implicitItemIdentifier="48B3FCFA-8A19-4D19-A840-E21E6D564389" explicitItemIdentifier="action" label="action" paletteLabel="action" tag="1" image="prefsAction" selectable="YES" id="hqU-b9-59A">
<connections>
<action selector="toolbarButtonHandler:" target="-2" id="dy9-vy-N89"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="B0FD7AF2-DAC5-45EF-A31B-2E2C7CB85294" explicitItemIdentifier="update" label="update" paletteLabel="update" tag="4" image="prefsUpdate" selectable="YES" id="2Fi-c8-fnE">
<toolbarItem implicitItemIdentifier="B0FD7AF2-DAC5-45EF-A31B-2E2C7CB85294" explicitItemIdentifier="update" label="update" paletteLabel="update" tag="3" image="prefsUpdate" selectable="YES" id="2Fi-c8-fnE">
<connections>
<action selector="toolbarButtonHandler:" target="-2" id="jeu-wN-mgR"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="5DB39F09-CC43-4EC3-BF61-362FDA2DF782" explicitItemIdentifier="link" label="link" paletteLabel="link" tag="3" image="prefsLink" selectable="YES" id="43J-tU-rUa">
<toolbarItem implicitItemIdentifier="5DB39F09-CC43-4EC3-BF61-362FDA2DF782" explicitItemIdentifier="link" label="link" paletteLabel="link" tag="2" image="prefsLink" selectable="YES" id="43J-tU-rUa">
<connections>
<action selector="toolbarButtonHandler:" target="-2" id="tSK-K0-f7H"/>
</connections>
@@ -82,8 +75,6 @@
<defaultToolbarItems>
<toolbarItem reference="Twx-TJ-y2Q"/>
<toolbarItem reference="J66-tT-qAf"/>
<toolbarItem reference="pr7-Pz-jdz"/>
<toolbarItem reference="J66-tT-qAf"/>
<toolbarItem reference="hqU-b9-59A"/>
<toolbarItem reference="J66-tT-qAf"/>
<toolbarItem reference="43J-tU-rUa"/>
@@ -161,7 +152,7 @@
<button fixedFrame="YES" tag="3" translatesAutoresizingMaskIntoConstraints="NO" id="ANF-lj-j0H">
<rect key="frame" x="37" y="156" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Fpb-6d-DfT">
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" enabled="NO" inset="2" id="Fpb-6d-DfT">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
@@ -172,7 +163,7 @@
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="F9r-H0-4xe">
<rect key="frame" x="72" y="157" width="471" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Authentication Mode" id="l1H-sS-Md8">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="'Touch ID' Mode" id="l1H-sS-Md8">
<font key="font" size="13" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -181,13 +172,13 @@
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="BhQ-tq-9gJ">
<rect key="frame" x="72" y="138" width="508" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Ignore events if computer unlocked via Touch ID or Apple Watch." id="yKN-Kc-8Q2">
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Suppress alerts if proceeded by a Touch ID login (10.13.4+)." id="yKN-Kc-8Q2">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" tag="4" translatesAutoresizingMaskIntoConstraints="NO" id="OkJ-ds-qSY">
<button fixedFrame="YES" tag="7" translatesAutoresizingMaskIntoConstraints="NO" id="OkJ-ds-qSY">
<rect key="frame" x="37" y="99" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="HEY-GS-vSr">
@@ -216,95 +207,30 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="852" y="437"/>
</customView>
<customView id="BuY-2M-Ecx" userLabel="Triggers">
<rect key="frame" x="0.0" y="0.0" width="600" height="322"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="QSk-EX-Gs3">
<rect key="frame" x="37" y="270" width="29" height="18"/>
<button fixedFrame="YES" tag="4" translatesAutoresizingMaskIntoConstraints="NO" id="5ep-7h-VpU">
<rect key="frame" x="37" y="42" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" enabled="NO" inset="2" id="4Ia-YW-I03">
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="J3b-LL-38M">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
<connections>
<action selector="togglePreference:" target="-2" id="ko3-U3-K1d"/>
<action selector="togglePreference:" target="-2" id="5gO-Zo-43d"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="c2q-TO-7Hx">
<rect key="frame" x="72" y="271" width="160" height="19"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Yza-iC-hAP">
<rect key="frame" x="72" y="42" width="160" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Laptop Lid Open" id="svL-i1-bx7">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Start at Login" id="ksD-bk-5jE">
<font key="font" size="13" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="9cA-xI-Rkq">
<rect key="frame" x="72" y="253" width="475" height="19"/>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="LOC-tP-KQd">
<rect key="frame" x="72" y="22" width="475" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Alert when your laptop lid is opened." id="eYK-5x-T41">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" tag="6" translatesAutoresizingMaskIntoConstraints="NO" id="Tdc-FL-Prs">
<rect key="frame" x="37" y="213" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Lxz-uf-N9R">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
<connections>
<action selector="togglePreference:" target="-2" id="C4T-Ye-XAC"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wzx-aD-Ob5">
<rect key="frame" x="72" y="214" width="161" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="USB Device Insertion" id="a2r-f0-Qw2">
<font key="font" size="13" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="xBV-DA-rOc">
<rect key="frame" x="72" y="195" width="475" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Alert when a USB device is plugged in." id="yaL-Sz-w38">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" tag="7" translatesAutoresizingMaskIntoConstraints="NO" id="G6G-cU-bdG">
<rect key="frame" x="37" y="156" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="oKm-iS-CO8">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
<connections>
<action selector="togglePreference:" target="-2" id="whf-Fn-MSZ"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="CjK-AK-Uzg">
<rect key="frame" x="72" y="157" width="471" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Power Events" id="YR8-oc-TgU">
<font key="font" size="13" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="7Cw-J0-A9x">
<rect key="frame" x="72" y="118" width="490" height="38"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Alert when the your computer is powered on, awakened, or when the screen saver is stopped. " id="yW3-Uo-Ir7">
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Automatically start login item." id="k4V-lS-86b">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -317,7 +243,7 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="311"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" tag="8" translatesAutoresizingMaskIntoConstraints="NO" id="1z0-vD-5Vz">
<button fixedFrame="YES" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="1z0-vD-5Vz">
<rect key="frame" x="37" y="259" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="0eO-nb-SYy">
@@ -346,8 +272,8 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" tag="9" translatesAutoresizingMaskIntoConstraints="NO" id="Od2-P2-SXK">
<rect key="frame" x="37" y="202" width="29" height="18"/>
<button fixedFrame="YES" tag="6" translatesAutoresizingMaskIntoConstraints="NO" id="Od2-P2-SXK">
<rect key="frame" x="37" y="201" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="qyn-YP-C2s">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -358,7 +284,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BXf-fg-RpF">
<rect key="frame" x="72" y="203" width="59" height="19"/>
<rect key="frame" x="72" y="201" width="59" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Monitor" id="YH2-4b-Iv5">
<font key="font" size="13" name="Menlo-Bold"/>
@@ -375,47 +301,18 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" tag="10" translatesAutoresizingMaskIntoConstraints="NO" id="C6E-J8-lhh">
<rect key="frame" x="37" y="132" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="ngn-La-kHu">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
<connections>
<action selector="togglePreference:" target="-2" id="d0h-1p-AtX"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Np1-aP-w1p">
<rect key="frame" x="72" y="133" width="98" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Snap Picture" id="BQ4-1f-ZXw">
<font key="font" size="13" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eWd-63-7Gn">
<rect key="frame" x="198" y="257" width="354" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="path" drawsBackground="YES" id="kLf-zy-hmt">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="delegate" destination="-2" id="DAs-b2-8Zb"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="471" translatesAutoresizingMaskIntoConstraints="NO" id="cuP-oI-A6A">
<rect key="frame" x="72" y="113" width="475" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Automatically take a picture via the webcam." id="7Xg-3U-FQp">
<font key="font" size="13" name="Menlo-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="911" y="901.5"/>
</customView>
@@ -468,7 +365,7 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" tag="11" translatesAutoresizingMaskIntoConstraints="NO" id="dml-JS-liI">
<button fixedFrame="YES" tag="8" translatesAutoresizingMaskIntoConstraints="NO" id="dml-JS-liI">
<rect key="frame" x="37" y="220" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="ljs-bE-JTP">
@@ -497,7 +394,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" tag="7" translatesAutoresizingMaskIntoConstraints="NO" id="Mtn-pi-zIl">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mtn-pi-zIl">
<rect key="frame" x="233" y="132" width="134" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Check Now" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2qr-2x-A3U">
@@ -545,20 +442,20 @@
</textField>
<scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RDW-1i-H7T">
<rect key="frame" x="322" y="115" width="258" height="153"/>
<clipView key="contentView" id="FSf-NQ-BdZ">
<clipView key="contentView" drawsBackground="NO" id="FSf-NQ-BdZ">
<rect key="frame" x="1" y="1" width="256" height="151"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" importsGraphics="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="9cB-rx-0JH">
<rect key="frame" x="0.0" y="0.0" width="256" height="151"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="256" height="151"/>
<size key="maxSize" width="463" height="10000000"/>
<color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="efX-ju-LJj">
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
@@ -621,7 +518,7 @@
</constraints>
<point key="canvasLocation" x="218" y="1428.5"/>
</customView>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="vdL-RT-p6a" userLabel="QRC Panel" customClass="NSPanel">
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="vdL-RT-p6a" userLabel="QRC Panel" customClass="NSPanel">
<windowStyleMask key="styleMask" utility="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="2832" y="172" width="594" height="440"/>
@@ -706,7 +603,6 @@
<image name="close" width="24" height="24"/>
<image name="closeAlt" width="24" height="24"/>
<image name="connected" width="128" height="128"/>
<image name="dndIcon" width="256" height="256"/>
<image name="dndText" width="164.57142639160156" height="21.188571929931641"/>
<image name="imageCell:eTI-5p-4rR:image" width="256" height="256">
<mutableData key="keyedArchiveRepresentation">
@@ -5228,9 +5124,9 @@ IGsABCB5AAQgfQAEIIQABCCJAAQglgAEIJkABCCmAAQgqwAEILMABCC2AAQguwAEIMMABCDGAAQg2AAE
INsABCDgAAAAAAAABAEAAAAAAAAAVgAAAAAAAAAAAAAAAAAEIOI
</mutableData>
</image>
<image name="prefsAction" width="256" height="256"/>
<image name="prefsLink" width="256" height="256"/>
<image name="prefsTriggers" width="224" height="205"/>
<image name="prefsUpdate" width="256" height="256"/>
<image name="prefsAction" width="64" height="64"/>
<image name="prefsGeneral" width="64" height="64"/>
<image name="prefsLink" width="64" height="64"/>
<image name="prefsUpdate" width="64" height="64"/>
</resources>
</document>
+14 -30
View File
@@ -9,6 +9,7 @@
@import Cocoa;
#import "XPCDaemonClient.h"
#import "UpdateWindowController.h"
/* CONSTS */
@@ -17,16 +18,13 @@
#define TOOLBAR_GENERAL 0
//action view
#define TOOLBAR_TRIGGERS 1
//action view
#define TOOLBAR_ACTION 2
#define TOOLBAR_ACTION 1
//link view
#define TOOLBAR_LINK 3
#define TOOLBAR_LINK 2
//update view
#define TOOLBAR_UPDATE 4
#define TOOLBAR_UPDATE 3
//tool bar id for 'general'
#define TOOLBAR_GENERAL_ID @"general"
@@ -37,41 +35,30 @@
//no icon mode button
#define BUTTON_NO_ICON_MODE 2
//auth mode button
#define BUTTON_AUTH_MODE 3
//remote tasking
#define BUTTON_TASKING_MODE 4
//lid open trigger
#define BUTTON_LID_TRIGGER 5
//usb device trigger
#define BUTTON_DEVICE_TRIGGER 6
//power events trigger
#define BUTTON_POWER_TRIGGER 7
//touch id mode button
#define BUTTON_TOUCHID_MODE 3
//start mode button
#define BUTTON_START_MODE 4
//execute action button
#define BUTTON_EXECUTE_ACTION 8
#define BUTTON_EXECUTE_ACTION 5
//monitor button
#define BUTTON_MONITOR_ACTION 9
#define BUTTON_MONITOR_ACTION 6
//snap picture button
#define BUTTON_PHOTO_ACTION 10
//no remote tasking button
#define BUTTON_NO_REMOTE_TASKING 7
//no updates button
#define BUTTON_NO_UPDATES_MODE 11
#define BUTTON_NO_UPDATES_MODE 8
@interface PrefsWindowController : NSWindowController <NSTextFieldDelegate, NSToolbarDelegate>
/* PROPERTIES */
//daemon comms object
@property (retain, nonatomic)DaemonComms* daemonComms;
@property (retain, nonatomic)XPCDaemonClient* daemonComms;
//preferences
@property(nonatomic, retain)NSDictionary* preferences;
@@ -82,9 +69,6 @@
//general prefs view
@property (weak) IBOutlet NSView *generalView;
//triggers view
@property (strong) IBOutlet NSView *triggersView;
//action view
@property (weak) IBOutlet NSView *actionView;
+46 -78
View File
@@ -12,7 +12,7 @@
#import "Logging.h"
#import "Utilities.h"
#import "AppDelegate.h"
#import "DaemonComms.h"
#import "XPCDaemonClient.h"
#import "QuickResponseCode.h"
#import "PrefsWindowController.h"
#import "UpdateWindowController.h"
@@ -40,7 +40,7 @@
self.window.title = [NSString stringWithFormat:@"Do Not Disturb (v. %@)", getAppVersion()];
//init daemon comms
daemonComms = [[DaemonComms alloc] init];
daemonComms = [[XPCDaemonClient alloc] init];
//make 'general' selected
[self.toolbar setSelectedItemIdentifier:TOOLBAR_GENERAL_ID];
@@ -48,12 +48,13 @@
//set general prefs as default
[self toolbarButtonHandler:nil];
//clamshell?
// enable laptop trigger option
if(stateUnavailable != getLidState())
//enable touchID mode option
// if: < 10.13.4 (check first!) && no touch bar
if( (YES == [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 13, 4}]) &&
(YES == hasTouchID()) )
{
//enable button
((NSButton*)[self.triggersView viewWithTag:BUTTON_LID_TRIGGER]).enabled = YES;
((NSButton*)[self.generalView viewWithTag:BUTTON_TOUCHID_MODE]).enabled = YES;
}
return;
@@ -62,7 +63,7 @@
//required for toolbar item enable/disable
-(BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
{
return [toolbarItem isEnabled];
return [toolbarItem isEnabled] ;
}
//toolbar view handler
@@ -108,28 +109,13 @@
((NSButton*)[view viewWithTag:BUTTON_NO_ICON_MODE]).state = [self.preferences[PREF_NO_ICON_MODE] boolValue];
//set 'touch id' button state
((NSButton*)[view viewWithTag:BUTTON_AUTH_MODE]).state = [self.preferences[PREF_AUTH_MODE] boolValue];
((NSButton*)[view viewWithTag:BUTTON_TOUCHID_MODE]).state = [self.preferences[PREF_TOUCHID_MODE] boolValue];
//set 'no remote tasking' button state
((NSButton*)[view viewWithTag:BUTTON_TASKING_MODE]).state = [self.preferences[PREF_NO_REMOTE_TASKING] boolValue];
((NSButton*)[view viewWithTag:BUTTON_NO_REMOTE_TASKING]).state = [self.preferences[PREF_NO_REMOTE_TASKING] boolValue];
break;
}
//triggers
case TOOLBAR_TRIGGERS:
{
//set view
view = self.triggersView;
//set 'lap lid' trigger button state
((NSButton*)[view viewWithTag:BUTTON_LID_TRIGGER]).state = [self.preferences[PREF_LID_TRIGGER] boolValue];
//set 'usb device' trigger button state
((NSButton*)[view viewWithTag:BUTTON_DEVICE_TRIGGER]).state = [self.preferences[PREF_DEVICE_TRIGGER] boolValue];
//set 'power events' trigger button state
((NSButton*)[view viewWithTag:BUTTON_POWER_TRIGGER]).state = [self.preferences[PREF_POWER_TRIGGER] boolValue];
//set 'start mode' button state
((NSButton*)[view viewWithTag:BUTTON_START_MODE]).state = [self.preferences[PREF_START_MODE] boolValue];
break;
}
@@ -156,9 +142,6 @@
//set 'monitor' button state
((NSButton*)[view viewWithTag:BUTTON_MONITOR_ACTION]).state = [self.preferences[PREF_MONITOR_ACTION] boolValue];
//set 'photo action' button state
((NSButton*)[view viewWithTag:BUTTON_PHOTO_ACTION]).state = [self.preferences[PREF_PHOTO_ACTION] boolValue];
break;
}
@@ -259,13 +242,22 @@
self.hostName.stringValue = [[NSHost currentHost] localizedName];
//set font
self.deviceNames.font = [NSFont fontWithName:@"Avenir Next Condensed Regular" size:20];
self.deviceNames.font = [NSFont fontWithName:@"Avenir Next Condensed Regular" size:18];
//set inset
self.deviceNames.textContainerInset = NSMakeSize(5.0, 10.0);
//reset
self.deviceNames.string = @"";
//not in mojave dark mode?
// make window color white
if( (YES != [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 14, 0}]) &&
(YES != [[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqualToString:@"Dark"]) )
{
//light gray
self.deviceNames.backgroundColor = [NSColor lightGrayColor];
}
//populate text view w/ registered devices
for(NSString* deviceToken in registeredDevices[PREF_REGISTERED_DEVICES])
@@ -321,8 +313,6 @@
//set appropriate preference
switch(((NSButton*)sender).tag)
{
/* GENERAL PREFS */
//passive mode
case BUTTON_PASSIVE_MODE:
{
@@ -342,54 +332,35 @@
break;
}
//auth mode
case BUTTON_AUTH_MODE:
//touch id mode
case BUTTON_TOUCHID_MODE:
{
//set pref
preferences[PREF_AUTH_MODE] = state;
preferences[PREF_TOUCHID_MODE] = state;
break;
}
//remote tasking
case BUTTON_TASKING_MODE:
//start mode
// also toggle here...
case BUTTON_START_MODE:
{
//set pref
preferences[PREF_NO_REMOTE_TASKING] = state;
preferences[PREF_START_MODE] = state;
//toggle login item in background
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
//toggle
if(YES != toggleLoginItem([NSURL fileURLWithPath:[((AppDelegate*)[[NSApplication sharedApplication] delegate]) path2LoginItem]], [preferences[PREF_START_MODE] intValue]))
{
//err msg
logMsg(LOG_ERR, @"failed to toggle login item");
}
});
break;
}
/* TRIGGER PREFS */
//lid trigger
case BUTTON_LID_TRIGGER:
{
//set pref
preferences[PREF_LID_TRIGGER] = state;
break;
}
//usb device trigger
case BUTTON_DEVICE_TRIGGER:
{
//set pref
preferences[PREF_DEVICE_TRIGGER] = state;
break;
}
//power trigger
case BUTTON_POWER_TRIGGER:
{
//set pref
preferences[PREF_POWER_TRIGGER] = state;
break;
}
/* ACTION PREFS */
//execute action
// also toggle state of path
@@ -413,16 +384,14 @@
break;
}
//monitor mode
case BUTTON_PHOTO_ACTION:
//no camera
case BUTTON_NO_REMOTE_TASKING:
{
//set pref
preferences[PREF_PHOTO_ACTION] = state;
preferences[PREF_NO_REMOTE_TASKING] = state;
break;
}
/* UPDATE PREFS */
//(no) update mode
case BUTTON_NO_UPDATES_MODE:
@@ -435,7 +404,7 @@
}
//tell daemon to update preferences
[self.daemonComms updatePreferences:preferences];
[daemonComms updatePreferences:preferences];
//restart login item if user toggle'd icon state
// note: this has to be done after the prefs are written out by the daemon
@@ -459,7 +428,7 @@
QuickResponseCode* qrcObj = nil;
//daemon comms obj
__block DaemonComms* daemonComms = nil;
__block XPCDaemonClient* daemonComms = nil;
//size
CGSize qrcSize = {0};
@@ -539,7 +508,7 @@
//init daemon comms
// will connect, etc.
daemonComms = [[DaemonComms alloc] init];
daemonComms = [[XPCDaemonClient alloc] init];
//call into daemon/framework
// this will block until phone linking/registration is complete
@@ -558,7 +527,6 @@
[self toolbarButtonHandler:self.linkToolbarItem];
});
}];
}];
+2 -2
View File
@@ -10,14 +10,14 @@
@import Cocoa;
@import Foundation;
#import "DaemonComms.h"
#import "XPCDaemonClient.h"
@interface QuickResponseCode : NSObject
/* PROPERTIES */
//daemon comms obj
@property(nonatomic, retain)DaemonComms* daemonComms;
@property(nonatomic, retain)XPCDaemonClient* daemonComms;
/* METHODS */
+2 -2
View File
@@ -8,7 +8,7 @@
//
#import "Logging.h"
#import "DaemonComms.h"
#import "XPCDaemonClient.h"
#import "QuickResponseCode.h"
#import <CoreImage/CoreImage.h>
@@ -27,7 +27,7 @@
{
//init daemon comms
// will connect, etc.
daemonComms = [[DaemonComms alloc] init];
daemonComms = [[XPCDaemonClient alloc] init];
}
return self;
+44 -155
View File
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<capability name="box content view" minToolsVersion="7.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.13.2"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -11,27 +10,23 @@
<connections>
<outlet property="activityIndicator" destination="12Q-wb-usj" id="OBk-O9-kxj"/>
<outlet property="activityMessage" destination="fFv-Gr-YPE" id="ItR-ES-c5V"/>
<outlet property="appInfo" destination="uXX-Wf-ZLL" id="x8l-zh-2Ww"/>
<outlet property="appInfo" destination="Saf-Qg-NBo" id="xs0-qj-7dm"/>
<outlet property="deviceName" destination="cwA-Cr-acf" id="2Iv-JH-zGS"/>
<outlet property="deviceTrigger" destination="1yX-PX-O3F" id="0PZ-dS-dxu"/>
<outlet property="hostName" destination="mFe-eu-nNm" id="oRs-cQ-NN6"/>
<outlet property="lidTrigger" destination="HhM-Wb-jX6" id="mqX-9A-Tlu"/>
<outlet property="linkedView" destination="Bbb-NZ-tuF" id="vGv-tV-8Mb"/>
<outlet property="powerTrigger" destination="gTR-JD-PmX" id="lLC-rw-fi7"/>
<outlet property="qrcImageView" destination="mos-zb-KRK" id="kKD-Ww-Bkx"/>
<outlet property="qrcView" destination="klO-RE-i9P" id="30O-Tc-jSC"/>
<outlet property="triggerView" destination="Saf-Qg-NBo" id="Aaf-2f-ehE"/>
<outlet property="welcomeView" destination="vZ0-Uk-9P1" id="JgS-86-4S1"/>
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Do Not Disturb" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<window title="Do Not Disturb" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="800" height="500"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="minSize" type="size" width="800" height="500"/>
<value key="maxSize" type="size" width="800" height="500"/>
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
@@ -101,7 +96,7 @@
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="660" translatesAutoresizingMaskIntoConstraints="NO" id="cxG-zN-szL">
<rect key="frame" x="31" y="180" width="738" height="117"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="'Do Not Disturb' attempts to detect 'evil maid' attacks, 
alerting you if somebody tampers with your Mac!" id="tYf-YX-PsV">
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="'Do Not Disturb' attempts to detect 'evil maid' attacks, 
alerting you if somebody tampers with your laptop!" id="tYf-YX-PsV">
<font key="font" size="32" name="AvenirNextCondensed-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -110,14 +105,33 @@
</subviews>
<point key="canvasLocation" x="-156" y="647"/>
</customView>
<customView id="Saf-Qg-NBo" userLabel="Triggers">
<customView id="Saf-Qg-NBo" userLabel="App Info">
<rect key="frame" x="0.0" y="0.0" width="800" height="500"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="660" translatesAutoresizingMaskIntoConstraints="NO" id="qwA-lo-6xT">
<rect key="frame" x="68" y="426" width="664" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="What should trigger 'Do Not Disturb'?" id="SFE-Jt-OYq">
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="Let's link with your iPhone to enable mobile alerts" id="SFE-Jt-OYq">
<font key="font" size="32" name="AvenirNextCondensed-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hgC-yZ-fp2">
<rect key="frame" x="342" y="292" width="116" height="73"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="unconnected" id="Mpj-kB-q4i"/>
</imageView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tSA-l2-uw1">
<rect key="frame" x="458" y="267" width="142" height="124"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="mobilePhone" id="ijd-WJ-9VT"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="388" translatesAutoresizingMaskIntoConstraints="NO" id="OFG-Gz-3rE">
<rect key="frame" x="18" y="157" width="764" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Download 'Do Not Disturb' from the iOS App Store" id="MAH-fc-gnv">
<font key="font" size="32" name="AvenirNextCondensed-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -130,7 +144,18 @@
<rect key="frame" x="0.0" y="0.0" width="800" height="48"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="k0d-RO-RST">
<button verticalHuggingPriority="750" fixedFrame="YES" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="XhZ-7d-es8">
<rect key="frame" x="14" y="6" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Skip" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="jHq-Ss-1eG">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="buttonHandler:" target="-2" id="skW-Zf-sd1"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" tag="3" translatesAutoresizingMaskIntoConstraints="NO" id="k0d-RO-RST">
<rect key="frame" x="715" y="6" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Next" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7AI-8x-NIJ">
@@ -146,153 +171,19 @@
<color key="fillColor" red="0.57793885469999995" green="0.75859862570000003" blue="0.2368842065" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</box>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Stm-VG-w3v">
<rect key="frame" x="76" y="150" width="180" height="200"/>
<rect key="frame" x="206" y="267" width="138" height="124"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="laptop" id="tNr-00-iNk"/>
</imageView>
<button fixedFrame="YES" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="HhM-Wb-jX6">
<rect key="frame" x="86" y="143" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="6kw-r2-rmN">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="e9r-Jq-TLi">
<rect key="frame" x="111" y="143" width="140" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Laptop Lid Open" id="3rB-77-9nQ">
<font key="font" size="15" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="gTR-JD-PmX">
<rect key="frame" x="581" y="143" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="ok3-Cj-tDO">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
</button>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gYG-uo-2F5">
<rect key="frame" x="315" y="165" width="170" height="170"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="usb" id="fcP-xx-A5f"/>
</imageView>
<button fixedFrame="YES" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="1yX-PX-O3F">
<rect key="frame" x="341" y="143" width="29" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="bJj-FO-Xp6">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="14" name="Consolas-Bold"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="93F-5x-Nuf">
<rect key="frame" x="605" y="82" width="177" height="84"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Power On
Computer Wake
Screen Saver Off" id="uOY-7O-Nsb">
<font key="font" size="15" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fTz-Wm-yY8">
<rect key="frame" x="571" y="170" width="159" height="159"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="sleep" id="LyW-2I-nNG"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2Vd-M8-05L">
<rect key="frame" x="365" y="143" width="122" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="USB Insertion" id="dHu-5b-Vk2">
<font key="font" size="15" name="Menlo-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="831" y="-530"/>
</customView>
<customView id="uXX-Wf-ZLL" userLabel="App Info">
<rect key="frame" x="0.0" y="0.0" width="800" height="500"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="660" translatesAutoresizingMaskIntoConstraints="NO" id="pzP-vr-mwp">
<rect key="frame" x="68" y="426" width="664" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="Let's link with your iPhone to enable mobile alerts" id="b7f-6P-fss">
<font key="font" size="32" name="AvenirNextCondensed-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3Ko-5I-ZkQ">
<rect key="frame" x="342" y="292" width="116" height="73"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="unconnected" id="biq-NY-wHH"/>
</imageView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rla-hF-y7t">
<rect key="frame" x="458" y="267" width="142" height="124"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="mobilePhone" id="ks4-qM-EJX"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="388" translatesAutoresizingMaskIntoConstraints="NO" id="1NC-nB-9TF">
<rect key="frame" x="18" y="157" width="764" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Download 'Do Not Disturb' from the iOS App Store" id="xMO-kA-ubY">
<font key="font" size="32" name="AvenirNextCondensed-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box fixedFrame="YES" boxType="custom" borderType="none" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="2wk-PX-com">
<rect key="frame" x="0.0" y="0.0" width="800" height="48"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView" ambiguous="YES" id="Cvt-0u-Fn9">
<rect key="frame" x="0.0" y="0.0" width="800" height="48"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" tag="3" translatesAutoresizingMaskIntoConstraints="NO" id="SzW-hq-Cay">
<rect key="frame" x="14" y="6" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Skip" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="F4D-7D-b7M">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="buttonHandler:" target="-2" id="Q9F-RZ-B16"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" tag="4" translatesAutoresizingMaskIntoConstraints="NO" id="IYF-UZ-e79">
<rect key="frame" x="715" y="6" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Next" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="KzN-1a-Bgl">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="buttonHandler:" target="-2" id="4kt-qR-EdK"/>
</connections>
</button>
</subviews>
</view>
<color key="fillColor" red="0.57793885469999995" green="0.75859862570000003" blue="0.2368842065" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</box>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pne-xe-SXP">
<rect key="frame" x="206" y="267" width="138" height="124"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="laptop" id="Yka-Wc-tqb"/>
</imageView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SIf-al-GRB">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9FN-FI-sj3">
<rect key="frame" x="337" y="94" width="127" height="55"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="appStore" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="rpd-Oh-aLh">
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="appStore" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="cPG-lr-39E">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="downloadApp:" target="-2" id="u1k-Ns-xde"/>
<action selector="downloadApp:" target="-2" id="IrW-7u-1OG"/>
</connections>
</button>
</subviews>
@@ -403,7 +294,7 @@
<rect key="frame" x="0.0" y="0.0" width="800" height="48"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="SCr-nL-4pA">
<button verticalHuggingPriority="750" fixedFrame="YES" tag="4" translatesAutoresizingMaskIntoConstraints="NO" id="SCr-nL-4pA">
<rect key="frame" x="705" y="6" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Jhe-Eu-d4x">
@@ -4961,8 +4852,6 @@ INsABCDgAAAAAAAABAEAAAAAAAAAVgAAAAAAAAAAAAAAAAAEIOI
<image name="laptop" width="256" height="256"/>
<image name="linked" width="256" height="467"/>
<image name="mobilePhone" width="512" height="512"/>
<image name="sleep" width="256" height="256"/>
<image name="unconnected" width="128" height="128"/>
<image name="usb" width="256" height="256"/>
</resources>
</document>
+1 -15
View File
@@ -8,6 +8,7 @@
//
@import Cocoa;
#import <objc/message.h>
@interface WelcomeWindowController : NSWindowController
@@ -17,27 +18,12 @@
//welcome view
@property (strong) IBOutlet NSView *welcomeView;
//app info view
@property (strong) IBOutlet NSView *triggerView;
//app info view
@property (strong) IBOutlet NSView *appInfo;
//config view
@property (strong) IBOutlet NSView *qrcView;
//button
// trigger for lid opens
@property (weak) IBOutlet NSButton *lidTrigger;
//button
// trigger for device insertions
@property (weak) IBOutlet NSButton *deviceTrigger;
//button
// trigger for power events
@property (weak) IBOutlet NSButton *powerTrigger;
//activity indicator
@property (weak) IBOutlet NSProgressIndicator *activityIndicator;
+29 -66
View File
@@ -10,16 +10,15 @@
#import "Consts.h"
#import "Logging.h"
#import "Utilities.h"
#import "DaemonComms.h"
#import "XPCDaemonClient.h"
#import "QuickResponseCode.h"
#import "WelcomeWindowController.h"
#define VIEW_WELCOME 0
#define SELECT_TRIGGERS 1
#define VIEW_APP_INFO 2
#define SKIP_LINKING 3
#define VIEW_QRC 4
#define VIEW_LINKED 5
#define VIEW_APP_INFO 1
#define SKIP_LINKING 2
#define VIEW_QRC 3
#define VIEW_LINKED 4
@implementation WelcomeWindowController
@@ -35,8 +34,13 @@
//center
[self.window center];
//make white
[self.window setBackgroundColor: NSColor.whiteColor];
//not in mojave dark mode?
// make window color white
if(YES != isDarkMode())
{
//make white
self.window.backgroundColor = NSColor.whiteColor;
}
//when supported
// indicate title bar is transparent (too)
@@ -55,6 +59,7 @@
return;
}
//button handler for all views
// show next view, sometimes, with view specific logic
-(IBAction)buttonHandler:(id)sender
@@ -76,48 +81,16 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (100 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
//set first responder
[self.window makeFirstResponder:[self.welcomeView viewWithTag:SELECT_TRIGGERS]];
[self.window makeFirstResponder:[self.welcomeView viewWithTag:VIEW_APP_INFO]];
});
break;
}
//select triggers info
case SELECT_TRIGGERS:
{
//remove prev. subview
[[[self.window.contentView subviews] lastObject] removeFromSuperview];
//no a laptop?
// uncheck and disable laptop lid trigger
if(stateUnavailable == getLidState())
{
//uncheck
self.lidTrigger.state = NSOffState;
//disable
self.lidTrigger.enabled = NO;
}
//set view
[self.window.contentView addSubview:self.triggerView];
//make 'next' button first responder
[self.window makeFirstResponder:[self.triggerView viewWithTag:VIEW_APP_INFO]];
break;
}
//app info
case VIEW_APP_INFO:
{
//save trigger prefs
[self setTriggers];
//dbg msg
logMsg(LOG_DEBUG, @"saved triggers");
//remove prev. subview
[[[self.window.contentView subviews] lastObject] removeFromSuperview];
@@ -133,8 +106,8 @@
//skip
case SKIP_LINKING:
{
//bye
[NSApp terminate:self];
//bye!
[self terminate];
break;
}
@@ -157,38 +130,28 @@
//linked view
case VIEW_LINKED:
{
//exit
[NSApp terminate:nil];
//bye!
[self terminate];
break;
}
}
return;
}
//get user's prefs for triggers
// then send them to daemon to save into prefs
-(void)setTriggers
//exit app
// performing any actions
-(void)terminate
{
//daemon comms
DaemonComms* daemonComms = nil;
//before exiting
// ask for camera
requestCameraAccess();
//alloc/init
daemonComms = [[DaemonComms alloc] init];
//dbg msg
logMsg(LOG_DEBUG, @"setting trigger prefs");
//send to daemon
// will update preferences
[daemonComms updatePreferences:@{PREF_LID_TRIGGER:[NSNumber numberWithInteger:self.lidTrigger.state],
PREF_DEVICE_TRIGGER:[NSNumber numberWithInteger:self.deviceTrigger.state],
PREF_POWER_TRIGGER:[NSNumber numberWithInteger:self.powerTrigger.state]}];
return;
//exit
[NSApp terminate:nil];
}
//generate a QRC
// calls into daemon and then displays
-(void)generateQRC
@@ -197,7 +160,7 @@
QuickResponseCode* qrcObj = nil;
//daemon comms obj
__block DaemonComms* daemonComms = nil;
__block XPCDaemonClient* daemonComms = nil;
//size
CGSize qrcSize = {0};
@@ -249,7 +212,7 @@
//init daemon comms
// will connect, etc.
daemonComms = [[DaemonComms alloc] init];
daemonComms = [[XPCDaemonClient alloc] init];
//call into daemon/framework
// this will block until phone linking/registration is complete
+3 -5
View File
@@ -14,6 +14,7 @@
#import "Logging.h"
#import "Utilities.h"
#import <ServiceManagement/ServiceManagement.h>
int main(int argc, const char * argv[])
{
@@ -23,11 +24,8 @@ int main(int argc, const char * argv[])
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"STARTED: config/prefs app (args: %@)", [[NSProcessInfo processInfo] arguments]]);
//init crash reporting client
SentryClient.sharedClient = [[SentryClient alloc] initWithDsn:CRASH_REPORTING_URL didFailWithError:nil];
//start crash handler
[SentryClient.sharedClient startCrashHandlerWithError:nil];
//init crash reporting
initCrashReporting();
//already running?
if(YES == isAppRunning([[NSBundle mainBundle] bundleIdentifier]))
+5 -1
View File
@@ -1 +1,5 @@
Halo Privacy, Ash Morgan, Geoffrey Weber, Jeff Golden, Khalil Sehnaoui, Nando Mendonca, Gamer_Bot
Patrons:
Halo Privacy, Ash Morgan, Jesse Daguanno, Beau Galbraith, Nando Mendonca, Khalil Sehnaoui, Jeff Golden, Geoffrey Weber, Randy Wong, Gamer_Bot
Friends of Objective-See:
Digita Security, Malwarebytes, Don MacAskill
+11 -48
View File
@@ -52,12 +52,6 @@
//button title: next
#define ACTION_NEXT @"Next »"
//button title: no
#define ACTION_NO @"No"
//button title: yes
#define ACTION_YES @"Yes!"
//frame shift
// for status msg to avoid activity indicator
#define FRAME_SHIFT 45
@@ -71,6 +65,9 @@
//flag to install
#define ACTION_INSTALL_FLAG 1
//next
#define ACTION_NEXT_FLAG 2
//flag for partial uninstall
// leave preferences file, etc.
#define UNINSTALL_PARTIAL 0
@@ -114,6 +111,9 @@
//daemon mach name
#define DAEMON_MACH_SERVICE @"com.objective-see.dndDaemon"
//user (login item) mach name
#define USER_MACH_SERVICE @"com.objective-see.dndUser"
//product url
#define PRODUCT_URL @"https://objective-see.com/products/dnd.html"
@@ -148,18 +148,6 @@
// status
#define PREF_IS_DISABLED @"disabled"
//prefs
// lid trigger
#define PREF_LID_TRIGGER @"lidTrigger"
//prefs
// device trigger
#define PREF_DEVICE_TRIGGER @"deviceTrigger"
//prefs
// power trigger
#define PREF_POWER_TRIGGER @"powerTrigger"
//prefs
// passive mode
#define PREF_PASSIVE_MODE @"passiveMode"
@@ -169,8 +157,8 @@
#define PREF_NO_ICON_MODE @"noIconMode"
//prefs
// auth mode
#define PREF_AUTH_MODE @"touchIDMode"
// touchID mode
#define PREF_TOUCHID_MODE @"touchIDMode"
//prefs
// start mode
@@ -192,10 +180,6 @@
// monitor stuff
#define PREF_MONITOR_ACTION @"monitorAction"
//pref
// auto take photo
#define PREF_PHOTO_ACTION @"photoAction"
//pref
// no remote tasking
#define PREF_NO_REMOTE_TASKING @"noRemoteTasking"
@@ -204,19 +188,6 @@
// update mode
#define PREF_NO_UPDATES_MODE @"noUpdatesMode"
//trigger: all
// based on prefs
#define ALL_TRIGGERS 0x0
//trigger: lid
#define LID_TRIGGER 0x1
//trigger: devices
#define DEVICE_TRIGGER 0x2
//trigger: power
#define POWER_TRIGGER 0x3
//log file
#define LOG_FILE_NAME @"DND.log"
@@ -224,20 +195,9 @@
// timestamp
#define ALERT_TIMESTAMP @"timestamp"
//alert key
// type (lid, usb, power)
#define ALERT_TYPE @"eventType"
//alert key
// info (specific to event type)
#define ALERT_INFO @"info"
//key for device name
#define KEY_DEVICE_NAME @"deviceName"
//key for power type
#define KEY_POWER_TYPE @"powerType"
//key for host name
#define KEY_HOST_NAME @"hostName"
@@ -316,6 +276,9 @@
//dismiss event notification
#define DISMISS_NOTIFICATION @"com.objective-see.dnd.dismissNotification"
//new user/client notification
#define USER_NOTIFICATION @"com.objective-see.dnd.userNotification"
//monitoring timeout
#define MONITORING_TIMEOUT 60*3
+7 -2
View File
@@ -41,8 +41,13 @@
//super
[super windowDidLoad];
//make white
[self.window setBackgroundColor: NSColor.whiteColor];
//not in mojave dark mode?
// make window color white
if(YES != isDarkMode())
{
//make white
self.window.backgroundColor = NSColor.whiteColor;
}
//when supported
// indicate title bar is transparent (too)
+19 -5
View File
@@ -10,6 +10,9 @@
#ifndef Utilities_h
#define Utilities_h
@import Sentry;
@import AVFoundation;
#import <AppKit/AppKit.h>
#import <IOKit/IOKitLib.h>
#import <IOKit/pwr_mgt/IOPM.h>
@@ -17,7 +20,8 @@
#import <SystemConfiguration/SystemConfiguration.h>
//enum of lid states
typedef NS_ENUM(int, LidState) {
typedef NS_ENUM(int, LidState)
{
stateUnavailable = -1,
stateOpen = 0,
stateClosed = 1
@@ -25,14 +29,17 @@ typedef NS_ENUM(int, LidState) {
/* FUNCTIONS */
//init crash reporting
void initCrashReporting(void);
//loads a framework
// note: assumes it is in 'Framework' dir
NSBundle* loadFramework(NSString* name);
//get app's version
// extracted from Info.plist
NSString* getAppVersion(void);
//get OS version
// note: this uses macOS 10.10+ methods
NSOperatingSystemVersion getOSVersion(void);
//get path to (main) app
// login item is in app bundle, so parse up to get main app
NSString* getMainAppPath(void);
@@ -84,4 +91,11 @@ BOOL hasTouchID(void);
//get current console user
NSString* currentConsoleUser(SCDynamicStoreRef store);
//macOS Mojave+
// gotta request camera access
void requestCameraAccess(void);
//check if (true) dark mode
BOOL isDarkMode(void);
#endif
+158 -8
View File
@@ -23,6 +23,101 @@
#import <LocalAuthentication/LocalAuthentication.h>
#import <SystemConfiguration/SystemConfiguration.h>
//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)
{
//err msg
logMsg(LOG_ERR, @"failed to load 'Sentry' framework");
//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)
{
//log error
logMsg(LOG_ERR, [NSString stringWithFormat:@"initializing 'Sentry' failed with %@", error]);
//bail
goto bail;
}
//start crash handler
[[SentryClient sharedClient] startCrashHandlerWithError:&error];
if(nil != error)
{
//log error
logMsg(LOG_ERR, [NSString stringWithFormat:@"starting 'Sentry' crash handler failed with %@", error]);
//bail
goto bail;
}
bail:
return;
}
//loads a framework
// note: assumes it is in 'Framework' dir
NSBundle* loadFramework(NSString* name)
{
//handle
NSBundle* framework = nil;
//framework path
NSString* path = nil;
//init path
path = [NSString stringWithFormat:@"%@/../Frameworks/%@", [NSProcessInfo.processInfo.arguments[0] stringByDeletingLastPathComponent], name];
//standardize path
path = [path stringByStandardizingPath];
//init framework (bundle)
framework = [NSBundle bundleWithPath:path];
if(NULL == framework)
{
//bail
goto bail;
}
//load framework
if(YES != [framework loadAndReturnError:nil])
{
//bail
goto bail;
}
bail:
return framework;
}
//get app's version
// extracted from Info.plist
NSString* getAppVersion()
@@ -31,13 +126,6 @@ NSString* getAppVersion()
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
}
//get OS version
// note: this uses macOS 10.10+ methods
NSOperatingSystemVersion getOSVersion()
{
return [[NSProcessInfo processInfo] operatingSystemVersion];
}
//get path to (main) app
// login item is in app bundle, so parse up to get main app
NSString* getMainAppPath()
@@ -929,9 +1017,71 @@ NSString* currentConsoleUser(SCDynamicStoreRef store)
goto bail;
}
bail:
return consoleUser;
}
//macOS Mojave+ gotta request camera access
// note, we check first, to see if request was already made
void requestCameraAccess()
{
//on macOS 10.14+
// trigger request for camera access
if(@available(macOS 10.14, *))
{
//auth status
AVAuthorizationStatus authStatus = AVAuthorizationStatusNotDetermined;
//get current status
authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
//already requested?
if(authStatus != AVAuthorizationStatusNotDetermined)
{
//bail
goto bail;
}
//request
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
{
//dbg msg
logMsg(LOG_DEBUG, [NSString stringWithFormat:@"user response for camera access: %d", granted]);
}];
}
bail:
return;
}
//check if (true) dark mode
BOOL isDarkMode()
{
//flag
BOOL darkMode = NO;
//not mojave?
// bail, since not true dark mode
if(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;
}
+47
View File
@@ -0,0 +1,47 @@
//
// file: XPC.h
// project: DND (shared)
// description: xpc protocols, ivars, etc,
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#ifndef XPC_h
#define XPC_h
//protocol
// methods that deamon exports
@protocol XPC_DAEMON
@end
//protocol
// methods that user exports
@protocol XPC_USER
- (void) updateProgress: (double) currentProgress;
- (void) finished;
@end
@interface XPCListener : NSObject<NSXPCListenerDelegate>
/* PROPERTIES */
//XPC listener
@property(retain, nonatomic)NSXPCListener* listener;
/* METHODS */
//setup XPC listener
-(BOOL)initListener;
//automatically invoked when new client (attempts) to connect
-(BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection;
@end
#endif /* XPC_h */
@@ -1,7 +1,7 @@
//
// file: DaemonComms.h
// file: XPCDaemonClient
// project: DND (shared)
// description: interface to talk to daemon (header)
// description: talk to the daemon, via XPC (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
@@ -9,16 +9,20 @@
@import Foundation;
#import "UserCommsInterface.h"
#import "XPCDaemonProto.h"
@interface DaemonComms : NSObject
@interface XPCDaemonClient : NSObject
{
}
//remote deamon proxy object
@property(nonatomic, retain) id <UserProtocol> daemon;
/* PROPERTIES */
//xpc connection
@property (atomic, strong, readwrite) NSXPCConnection* xpcServiceConnection;
/* METHODS */
//ask daemon for QRC info
// name, uuid, key, key size, etc...
-(void)qrcRequest:(void (^)(NSData* qrcInfo))reply;
@@ -34,17 +38,4 @@
//update (save) preferences
-(void)updatePreferences:(NSDictionary*)preferences;
//ask for alert
-(void)alertRequest:(void (^)(NSDictionary* alert))reply;
//send alert response back to the daemon
// for now, it's just an 'ack' that it was recieved/shown
-(void)alertResponse;
//ask (and then block) for an alert dismiss
-(void)alertDismiss:(void (^)(NSDictionary* alert))reply;
//close/cleanup connection
-(void)close;
@end
@@ -1,7 +1,7 @@
//
// file: DaemonComms.m
// file: XPCDaemonClient.m
// project: DND (shared)
// description: interface to talk to daemon
// description: talk to the daemon, via XPC (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
@@ -9,11 +9,15 @@
#import "Consts.h"
#import "Logging.h"
#import "DaemonComms.h"
#import "XPCUserProto.h"
#import "XPCDaemonClient.h"
@implementation DaemonComms
#ifdef XPC_USER
#import "XPCUser.h"
#endif
@implementation XPCDaemonClient
@synthesize daemon;
@synthesize xpcServiceConnection;
//init
@@ -28,7 +32,18 @@
xpcServiceConnection = [[NSXPCConnection alloc] initWithMachServiceName:DAEMON_MACH_SERVICE options:0];
//set remote object interface
self.xpcServiceConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(UserProtocol)];
self.xpcServiceConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCDaemonProtocol)];
#ifdef XPC_USER
//set exported object interface (protocol)
self.xpcServiceConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCUserProtocol)];
//set exported object
// this will allow daemon to invoke user methods!
self.xpcServiceConnection.exportedObject = [[XPCUser alloc] init];
#endif
//resume
[self.xpcServiceConnection resume];
@@ -144,76 +159,4 @@
return;
}
//ask (and then block) for an alert
-(void)alertRequest:(void (^)(NSDictionary* alert))reply
{
//dbg msg
logMsg(LOG_DEBUG, @"sending request, via XPC, for alert");
//request alert
[[self.xpcServiceConnection remoteObjectProxyWithErrorHandler:^(NSError * proxyError)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to execute 'alertRequest' method on launch daemon (error: %@)", proxyError]);
}] alertRequest:^(NSDictionary* alert)
{
//respond with alert
reply(alert);
}];
return;
}
//send alert response back to the daemon
// for now, it's just an 'ack' that it was recieved/shown
-(void)alertResponse
{
//dbg msg
logMsg(LOG_DEBUG, @"sending request, via XPC, for alert response");
//respond to alert
[[self.xpcServiceConnection remoteObjectProxyWithErrorHandler:^(NSError * proxyError)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to execute 'alertResponse' method on launch daemon (error: %@)", proxyError]);
}] alertResponse];
return;
}
//ask (and then block) for an alert dismiss
-(void)alertDismiss:(void (^)(NSDictionary* alert))reply
{
//dbg msg
logMsg(LOG_DEBUG, @"sending request, via XPC, for alert dismiss events");
//request alert
[[self.xpcServiceConnection remoteObjectProxyWithErrorHandler:^(NSError * proxyError)
{
//err msg
logMsg(LOG_ERR, [NSString stringWithFormat:@"failed to execute 'alertDismiss' method on launch daemon (error: %@)", proxyError]);
}] alertDismiss:^(NSDictionary* alert)
{
//respond with alert
reply(alert);
}];
return;
}
//close/cleanup connection
-(void)close
{
//invalidate
[self.xpcServiceConnection invalidate];
//unset
self.xpcServiceConnection = nil;
return;
}
@end
@@ -1,18 +1,15 @@
//
// file: UserCommsInterface.h
// file: XPCDaemonProtocol.h
// project: DND (shared)
// description: protocol for talking to the daemon
// description: methods exported by the daemon
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
#ifndef UserCommsInterface_h
#define UserCommsInterface_h
@import Foundation;
@protocol UserProtocol
@protocol XPCDaemonProtocol
//process qrc request from client
-(void)qrcRequest:(void (^)(NSData *))reply;
@@ -27,15 +24,5 @@
//update preferences
-(void)updatePreferences:(NSDictionary*)preferences;
//ask (and block) alert request from daemon
-(void)alertRequest:(void (^)(NSDictionary* alert))reply;
//process alert response from client
-(void)alertResponse;
//ask (and block) for alert dismiss msg from daemon
-(void)alertDismiss:(void (^)(NSDictionary* alert))reply;
@end
#endif
+25
View File
@@ -0,0 +1,25 @@
//
// file: XPCUserProtocol
// project: DND (shared)
// description: protocol for talking to the user (header)
//
// created by Patrick Wardle
// copyright (c) 2018 Objective-See. All rights reserved.
//
@import Foundation;
@protocol XPCUserProtocol
//show an alert
// returns with rep
-(void)alertShow:(NSDictionary*)alert;
//dismiss alert(s)
-(void)alertDismiss;
//take a picture
-(void)captureImage:(void (^)(NSData *))reply;
@end