├── .gitignore ├── .gitmodules ├── .travis.yml ├── Changelog.txt ├── English.lproj ├── Credits.rtf ├── InfoPlist.strings ├── MainMenu.xib └── SGKeyCodes.plist ├── LICENSE.txt ├── LaunchHelper ├── LaunchHelper.xcodeproj │ └── project.pbxproj ├── LaunchHelper │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── LaunchHelper.entitlements │ └── main.m └── LaunchHelperTests │ ├── Info.plist │ └── LaunchHelperTests.m ├── LockMeNow.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── README.md ├── Resources ├── DMG Artwork │ └── dmgBackground.tiff ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon_128x128.png │ │ ├── icon_128x128@2x.png │ │ ├── icon_16x16.png │ │ ├── icon_16x16@2x.png │ │ ├── icon_256x256.png │ │ ├── icon_256x256@2x.png │ │ ├── icon_32x32.png │ │ ├── icon_32x32@2x.png │ │ ├── icon_512x512.png │ │ └── icon_512x512@2x.png │ ├── Contents.json │ ├── lock.imageset │ │ ├── Contents.json │ │ ├── lock.png │ │ └── lock@2x.png │ ├── off.imageset │ │ ├── Contents.json │ │ ├── off.png │ │ └── off@2x.png │ └── on.imageset │ │ ├── Contents.json │ │ ├── on.png │ │ └── on@2x.png ├── Info.plist ├── Scripts │ ├── reactivate_asl_service.sh │ └── startCurrentScreensaver.scpt ├── TextFieldBG.png ├── dot_off.png ├── dot_on.png └── icon ├── Sandbox ├── XPCLoger.entitlements ├── XPCPower.entitlements ├── XPCPreferences.entitlements ├── XPCScreen.entitlements ├── XPCScripting.entitlements ├── XPCScriptingBridge.entitlements └── lockmenow.entitlements ├── Source ├── IGRUserDefaults.h ├── IGRUserDefaults.m ├── LMNLockMeNowApp.h ├── LMNLockMeNowApp.m ├── Listeners │ ├── LMNBluetoothListener.h │ ├── LMNBluetoothListener.m │ ├── LMNKeyListener.h │ ├── LMNKeyListener.m │ ├── LMNListenerManager.h │ ├── LMNListenerManager.m │ ├── LMNUSBListener.h │ └── LMNUSBListener.m ├── LockManager │ ├── LMNJustLock.h │ ├── LMNJustLock.m │ ├── LMNLockManager.h │ ├── LMNLockManager.m │ ├── LMNLoginWindowsLock.h │ └── LMNLoginWindowsLock.m ├── Pattern │ ├── DrawPatternLockView.h │ ├── DrawPatternLockView.m │ └── DrawPatternLockViewController.xib ├── Prefix.pch └── main.m ├── XPC ├── XPCLoger │ ├── Info.plist │ ├── XPCLoger.h │ ├── XPCLoger.m │ ├── XPCLogerProtocol.h │ └── main.m ├── XPCPower │ ├── Info.plist │ ├── XPCPower.h │ ├── XPCPower.m │ ├── XPCPowerProtocol.h │ └── main.m ├── XPCPreferences │ ├── Info.plist │ ├── XPCPreferences.h │ ├── XPCPreferences.m │ ├── XPCPreferencesProtocol.h │ └── main.m ├── XPCScreen │ ├── Info.plist │ ├── XPCScreen.h │ ├── XPCScreen.m │ ├── XPCScreenProtocol.h │ └── main.m ├── XPCScripting │ ├── Info.plist │ ├── XPCScripting.h │ ├── XPCScripting.m │ ├── XPCScriptingProtocol.h │ └── main.m └── XPCScriptingBridge │ ├── Info.plist │ ├── XPCScriptingBridge.h │ ├── XPCScriptingBridge.m │ ├── XPCScriptingBridgeProtocol.h │ └── main.m ├── img ├── menu.png ├── prefs_bluetooth.png ├── prefs_main.png ├── prefs_security.png └── prefs_usb.png └── keys ├── dsa_pub.pem ├── generate_info.command ├── generate_keys.rb ├── info_122.html ├── info_130.html ├── info_131.html ├── info_132.html ├── info_133.html ├── info_134.html ├── info_140.html ├── info_141.html ├── sign_update.rb └── update.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | DerivedData 17 | .idea/ 18 | dsa_priv.pem 19 | *.swp 20 | *.xcscmblueprint 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "External/shortcutrecorder"] 2 | path = External/shortcutrecorder 3 | url = https://github.com/iKorich/shortcutrecorder.git 4 | [submodule "External/peertalk"] 5 | path = External/peertalk 6 | url = https://github.com/rsms/peertalk.git 7 | [submodule "External/ImageSnap"] 8 | path = External/ImageSnap 9 | url = https://github.com/IGRSoft/ImageSnap.git 10 | [submodule "External/Sparkle"] 11 | path = External/Sparkle 12 | url = https://github.com/sparkle-project/Sparkle.git 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c -------------------------------------------------------------------------------- /Changelog.txt: -------------------------------------------------------------------------------- 1 | v 1.3.1: 2 | - http -> https. 3 | 4 | v 1.3.0: 5 | - Added Alert on Unplug MagSafe; 6 | - Fixed send photo via Email; 7 | - Updated a list of USB devices. 8 | 9 | v 1.2.2: 10 | - Added photo quality option. 11 | - Added Updater. 12 | 13 | v 1.2.0: 14 | - Added Security actions on wrong password, 15 | - Make photo / Сделать фото, 16 | - Send photo via mail, 17 | - Send location via mail. 18 | - Minor fixes. 19 | 20 | v 1.1.4: 21 | - Fixed Auto start on login, 22 | - Fixed icon for Dark Theme, 23 | - Refactoring. 24 | 25 | v 1.1.3: 26 | - Recodesigned, 27 | - Optimised for OS X 10.10. 28 | 29 | v 1.1.2: 30 | - Minor fixes. 31 | 32 | v 1.1.1: 33 | - Fixed resources for Retina Display. 34 | 35 | v 1.1.0: 36 | - Added Lock via Bluetooth device, 37 | - Added Lock via USB connected device, 38 | - Added options to run default Screensaver for "Just Lock". 39 | 40 | v 1.0.0: 41 | - Add Retina Display support, 42 | - Now work in Sandbox mode, 43 | - Fix iTunes control, 44 | - Minor fixes. 45 | 46 | v 0.8.1: 47 | - Fixed iTunes launch if option "Pause iTunes Music" is turned on, 48 | - Added Screensaver settings, 49 | - Minor fixes. 50 | 51 | v 0.7: 52 | - Added a Simple lock, 53 | - Added option "Pause iTunes Music". 54 | 55 | v 0.5: 56 | - Improved HotKeys actions, 57 | - Adjusted app for 10.6, 10.7, 58 | - Added option "Icon on Main menu", 59 | - Set open app preferences on repeat launch. 60 | 61 | v 0.4: 62 | - Fixed autolaunch Mac OS. 63 | 64 | v 0.3: 65 | - Added HotKeys customization. 66 | 67 | v 0.2 68 | - Improved HotKeys actions, 69 | - Minor fixes 70 | 71 | v 0.1 72 | - First release 73 | -------------------------------------------------------------------------------- /English.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf340 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \paperw11900\paperh16840\vieww9600\viewh8400\viewkind0 5 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 6 | 7 | \f0\fs24 \cf0 Lock your screen from the menu bar or by shortcut\ 8 | For more info, please, visit my site https://igrsoft.com\ 9 | And bymaster's site - http://bymaster.ru 10 | \b \ 11 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 12 | \cf0 \ 13 | Engineering: 14 | \b0 \ 15 | Vitaliy Parovishnik (Korich)\ 16 | \ 17 | 18 | \b Human Interface Design: 19 | \b0 \ 20 | Vitaliy Parovishnik (Korich)\ 21 | \ 22 | 23 | \b Testing: 24 | \b0 \ 25 | Vitaliy Parovishnik (Korich)\ 26 | \ 27 | 28 | \b With special thanks to: 29 | \b0 \ 30 | bymaster (uploaded to AppStore)\ 31 | \ 32 | 33 | \b Additional Frameworks: 34 | \b0 \ 35 | ShortcutRecorder,\ 36 | ImageSnap,\ 37 | peertalk.\ 38 | } -------------------------------------------------------------------------------- /English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleDisplayName = "Lock Me Now"; 4 | CFBundleName = "LockMeNow"; -------------------------------------------------------------------------------- /English.lproj/SGKeyCodes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | padKeyString 6 | Pad 7 | padKeys 8 | 9 | 65 10 | 67 11 | 69 12 | 75 13 | 78 14 | 81 15 | 82 16 | 83 17 | 84 18 | 85 19 | 86 20 | 87 21 | 88 22 | 89 23 | 91 24 | 92 25 | 26 | unmappedKeys 27 | 28 | 100 29 | F8 30 | 101 31 | F9 32 | 103 33 | F11 34 | 105 35 | F13 36 | 107 37 | F14 38 | 109 39 | F10 40 | 111 41 | F12 42 | 113 43 | F15 44 | 114 45 | Ins 46 | 115 47 | Home 48 | 116 49 | Page Up 50 | 117 51 | Del 52 | 118 53 | F4 54 | 119 55 | End 56 | 120 57 | F2 58 | 121 59 | Page Down 60 | 122 61 | F1 62 | 123 63 | Left Arrow 64 | 124 65 | Right Arrow 66 | 125 67 | Down Arrow 68 | 126 69 | Up Arrow 70 | 36 71 | Return 72 | 48 73 | Tab 74 | 49 75 | Space 76 | 51 77 | Backspace 78 | 53 79 | ESC 80 | 71 81 | Clear 82 | 76 83 | Pad Enter 84 | 96 85 | F5 86 | 97 87 | F6 88 | 98 89 | F7 90 | 99 91 | F3 92 | 93 | version 94 | 1 95 | 96 | 97 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 489 | 490 | Also add information on how to contact you by electronic and paper mail. 491 | 492 | You should also get your employer (if you work as a programmer) or your 493 | school, if any, to sign a "copyright disclaimer" for the library, if 494 | necessary. Here is a sample; alter the names: 495 | 496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 498 | 499 | , 1 April 1990 500 | Ty Coon, President of Vice 501 | 502 | That's all there is to it! 503 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A56234E71A817E04002B86A5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A56234E61A817E04002B86A5 /* AppDelegate.m */; }; 11 | A56234E91A817E04002B86A5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A56234E81A817E04002B86A5 /* main.m */; }; 12 | A56234EB1A817E04002B86A5 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A56234EA1A817E04002B86A5 /* Images.xcassets */; }; 13 | A56234EE1A817E04002B86A5 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = A56234EC1A817E04002B86A5 /* MainMenu.xib */; }; 14 | A56234FA1A817E04002B86A5 /* LaunchHelperTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A56234F91A817E04002B86A5 /* LaunchHelperTests.m */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXContainerItemProxy section */ 18 | A56234F41A817E04002B86A5 /* PBXContainerItemProxy */ = { 19 | isa = PBXContainerItemProxy; 20 | containerPortal = A56234D81A817E04002B86A5 /* Project object */; 21 | proxyType = 1; 22 | remoteGlobalIDString = A56234DF1A817E04002B86A5; 23 | remoteInfo = LaunchHelper; 24 | }; 25 | /* End PBXContainerItemProxy section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | A56234E01A817E04002B86A5 /* LaunchHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LaunchHelper.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | A56234E41A817E04002B86A5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | A56234E51A817E04002B86A5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 31 | A56234E61A817E04002B86A5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 32 | A56234E81A817E04002B86A5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | A56234EA1A817E04002B86A5 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 34 | A56234ED1A817E04002B86A5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 35 | A56234F31A817E04002B86A5 /* LaunchHelperTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LaunchHelperTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | A56234F81A817E04002B86A5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | A56234F91A817E04002B86A5 /* LaunchHelperTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LaunchHelperTests.m; sourceTree = ""; }; 38 | A56235031A817F30002B86A5 /* LaunchHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = LaunchHelper.entitlements; sourceTree = ""; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | A56234DD1A817E04002B86A5 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | A56234F01A817E04002B86A5 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | A56234D71A817E04002B86A5 = { 60 | isa = PBXGroup; 61 | children = ( 62 | A56234E21A817E04002B86A5 /* LaunchHelper */, 63 | A56234F61A817E04002B86A5 /* LaunchHelperTests */, 64 | A56234E11A817E04002B86A5 /* Products */, 65 | ); 66 | sourceTree = ""; 67 | }; 68 | A56234E11A817E04002B86A5 /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | A56234E01A817E04002B86A5 /* LaunchHelper.app */, 72 | A56234F31A817E04002B86A5 /* LaunchHelperTests.xctest */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | A56234E21A817E04002B86A5 /* LaunchHelper */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | A56235031A817F30002B86A5 /* LaunchHelper.entitlements */, 81 | A56234E51A817E04002B86A5 /* AppDelegate.h */, 82 | A56234E61A817E04002B86A5 /* AppDelegate.m */, 83 | A56234EA1A817E04002B86A5 /* Images.xcassets */, 84 | A56234EC1A817E04002B86A5 /* MainMenu.xib */, 85 | A56234E31A817E04002B86A5 /* Supporting Files */, 86 | ); 87 | path = LaunchHelper; 88 | sourceTree = ""; 89 | }; 90 | A56234E31A817E04002B86A5 /* Supporting Files */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | A56234E41A817E04002B86A5 /* Info.plist */, 94 | A56234E81A817E04002B86A5 /* main.m */, 95 | ); 96 | name = "Supporting Files"; 97 | sourceTree = ""; 98 | }; 99 | A56234F61A817E04002B86A5 /* LaunchHelperTests */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | A56234F91A817E04002B86A5 /* LaunchHelperTests.m */, 103 | A56234F71A817E04002B86A5 /* Supporting Files */, 104 | ); 105 | path = LaunchHelperTests; 106 | sourceTree = ""; 107 | }; 108 | A56234F71A817E04002B86A5 /* Supporting Files */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | A56234F81A817E04002B86A5 /* Info.plist */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | A56234DF1A817E04002B86A5 /* LaunchHelper */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = A56234FD1A817E04002B86A5 /* Build configuration list for PBXNativeTarget "LaunchHelper" */; 122 | buildPhases = ( 123 | A56234DC1A817E04002B86A5 /* Sources */, 124 | A56234DD1A817E04002B86A5 /* Frameworks */, 125 | A56234DE1A817E04002B86A5 /* Resources */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = LaunchHelper; 132 | productName = LaunchHelper; 133 | productReference = A56234E01A817E04002B86A5 /* LaunchHelper.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | A56234F21A817E04002B86A5 /* LaunchHelperTests */ = { 137 | isa = PBXNativeTarget; 138 | buildConfigurationList = A56235001A817E04002B86A5 /* Build configuration list for PBXNativeTarget "LaunchHelperTests" */; 139 | buildPhases = ( 140 | A56234EF1A817E04002B86A5 /* Sources */, 141 | A56234F01A817E04002B86A5 /* Frameworks */, 142 | A56234F11A817E04002B86A5 /* Resources */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | A56234F51A817E04002B86A5 /* PBXTargetDependency */, 148 | ); 149 | name = LaunchHelperTests; 150 | productName = LaunchHelperTests; 151 | productReference = A56234F31A817E04002B86A5 /* LaunchHelperTests.xctest */; 152 | productType = "com.apple.product-type.bundle.unit-test"; 153 | }; 154 | /* End PBXNativeTarget section */ 155 | 156 | /* Begin PBXProject section */ 157 | A56234D81A817E04002B86A5 /* Project object */ = { 158 | isa = PBXProject; 159 | attributes = { 160 | LastUpgradeCheck = 0920; 161 | ORGANIZATIONNAME = "IGR Software"; 162 | TargetAttributes = { 163 | A56234DF1A817E04002B86A5 = { 164 | CreatedOnToolsVersion = 6.1.1; 165 | DevelopmentTeam = DMP42GVPJ3; 166 | SystemCapabilities = { 167 | com.apple.Sandbox = { 168 | enabled = 1; 169 | }; 170 | }; 171 | }; 172 | A56234F21A817E04002B86A5 = { 173 | CreatedOnToolsVersion = 6.1.1; 174 | TestTargetID = A56234DF1A817E04002B86A5; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = A56234DB1A817E04002B86A5 /* Build configuration list for PBXProject "LaunchHelper" */; 179 | compatibilityVersion = "Xcode 3.2"; 180 | developmentRegion = English; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | Base, 185 | ); 186 | mainGroup = A56234D71A817E04002B86A5; 187 | productRefGroup = A56234E11A817E04002B86A5 /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | A56234DF1A817E04002B86A5 /* LaunchHelper */, 192 | A56234F21A817E04002B86A5 /* LaunchHelperTests */, 193 | ); 194 | }; 195 | /* End PBXProject section */ 196 | 197 | /* Begin PBXResourcesBuildPhase section */ 198 | A56234DE1A817E04002B86A5 /* Resources */ = { 199 | isa = PBXResourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | A56234EB1A817E04002B86A5 /* Images.xcassets in Resources */, 203 | A56234EE1A817E04002B86A5 /* MainMenu.xib in Resources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | A56234F11A817E04002B86A5 /* Resources */ = { 208 | isa = PBXResourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXResourcesBuildPhase section */ 215 | 216 | /* Begin PBXSourcesBuildPhase section */ 217 | A56234DC1A817E04002B86A5 /* Sources */ = { 218 | isa = PBXSourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | A56234E91A817E04002B86A5 /* main.m in Sources */, 222 | A56234E71A817E04002B86A5 /* AppDelegate.m in Sources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | A56234EF1A817E04002B86A5 /* Sources */ = { 227 | isa = PBXSourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | A56234FA1A817E04002B86A5 /* LaunchHelperTests.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXTargetDependency section */ 237 | A56234F51A817E04002B86A5 /* PBXTargetDependency */ = { 238 | isa = PBXTargetDependency; 239 | target = A56234DF1A817E04002B86A5 /* LaunchHelper */; 240 | targetProxy = A56234F41A817E04002B86A5 /* PBXContainerItemProxy */; 241 | }; 242 | /* End PBXTargetDependency section */ 243 | 244 | /* Begin PBXVariantGroup section */ 245 | A56234EC1A817E04002B86A5 /* MainMenu.xib */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | A56234ED1A817E04002B86A5 /* Base */, 249 | ); 250 | name = MainMenu.xib; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | A56234FB1A817E04002B86A5 /* Debug */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 263 | CLANG_WARN_BOOL_CONVERSION = YES; 264 | CLANG_WARN_COMMA = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_EMPTY_BODY = YES; 268 | CLANG_WARN_ENUM_CONVERSION = YES; 269 | CLANG_WARN_INFINITE_RECURSION = YES; 270 | CLANG_WARN_INT_CONVERSION = YES; 271 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 273 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 274 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 275 | CLANG_WARN_STRICT_PROTOTYPES = YES; 276 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | CODE_SIGN_IDENTITY = "-"; 280 | COPY_PHASE_STRIP = NO; 281 | ENABLE_STRICT_OBJC_MSGSEND = YES; 282 | ENABLE_TESTABILITY = YES; 283 | GCC_DYNAMIC_NO_PIC = NO; 284 | GCC_NO_COMMON_BLOCKS = YES; 285 | GCC_OPTIMIZATION_LEVEL = 0; 286 | GCC_PREPROCESSOR_DEFINITIONS = ( 287 | "DEBUG=1", 288 | "$(inherited)", 289 | ); 290 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | MACOSX_DEPLOYMENT_TARGET = 10.10; 298 | MTL_ENABLE_DEBUG_INFO = YES; 299 | ONLY_ACTIVE_ARCH = YES; 300 | SDKROOT = macosx; 301 | }; 302 | name = Debug; 303 | }; 304 | A56234FC1A817E04002B86A5 /* Release */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | CLANG_ENABLE_MODULES = YES; 309 | CLANG_ENABLE_OBJC_ARC = YES; 310 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 311 | CLANG_WARN_BOOL_CONVERSION = YES; 312 | CLANG_WARN_COMMA = YES; 313 | CLANG_WARN_CONSTANT_CONVERSION = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_EMPTY_BODY = YES; 316 | CLANG_WARN_ENUM_CONVERSION = YES; 317 | CLANG_WARN_INFINITE_RECURSION = YES; 318 | CLANG_WARN_INT_CONVERSION = YES; 319 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 320 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 323 | CLANG_WARN_STRICT_PROTOTYPES = YES; 324 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 325 | CLANG_WARN_UNREACHABLE_CODE = YES; 326 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 327 | CODE_SIGN_IDENTITY = "-"; 328 | COPY_PHASE_STRIP = YES; 329 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 330 | ENABLE_NS_ASSERTIONS = NO; 331 | ENABLE_STRICT_OBJC_MSGSEND = YES; 332 | GCC_NO_COMMON_BLOCKS = YES; 333 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 334 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 335 | GCC_WARN_UNDECLARED_SELECTOR = YES; 336 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 337 | GCC_WARN_UNUSED_FUNCTION = YES; 338 | GCC_WARN_UNUSED_VARIABLE = YES; 339 | MACOSX_DEPLOYMENT_TARGET = 10.10; 340 | MTL_ENABLE_DEBUG_INFO = NO; 341 | SDKROOT = macosx; 342 | }; 343 | name = Release; 344 | }; 345 | A56234FE1A817E04002B86A5 /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 349 | CODE_SIGN_ENTITLEMENTS = LaunchHelper/LaunchHelper.entitlements; 350 | CODE_SIGN_IDENTITY = "Developer ID Application"; 351 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; 352 | COMBINE_HIDPI_IMAGES = YES; 353 | INFOPLIST_FILE = LaunchHelper/Info.plist; 354 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 355 | PRODUCT_BUNDLE_IDENTIFIER = "com.igrsoft.$(PRODUCT_NAME:rfc1034identifier)"; 356 | PRODUCT_NAME = "$(TARGET_NAME)"; 357 | PROVISIONING_PROFILE = ""; 358 | SKIP_INSTALL = YES; 359 | }; 360 | name = Debug; 361 | }; 362 | A56234FF1A817E04002B86A5 /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | CODE_SIGN_ENTITLEMENTS = LaunchHelper/LaunchHelper.entitlements; 367 | CODE_SIGN_IDENTITY = "Developer ID Application"; 368 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; 369 | COMBINE_HIDPI_IMAGES = YES; 370 | INFOPLIST_FILE = LaunchHelper/Info.plist; 371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 372 | PRODUCT_BUNDLE_IDENTIFIER = "com.igrsoft.$(PRODUCT_NAME:rfc1034identifier)"; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | PROVISIONING_PROFILE = ""; 375 | SKIP_INSTALL = YES; 376 | }; 377 | name = Release; 378 | }; 379 | A56235011A817E04002B86A5 /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | BUNDLE_LOADER = "$(TEST_HOST)"; 383 | COMBINE_HIDPI_IMAGES = YES; 384 | FRAMEWORK_SEARCH_PATHS = ( 385 | "$(DEVELOPER_FRAMEWORKS_DIR)", 386 | "$(inherited)", 387 | ); 388 | GCC_PREPROCESSOR_DEFINITIONS = ( 389 | "DEBUG=1", 390 | "$(inherited)", 391 | ); 392 | INFOPLIST_FILE = LaunchHelperTests/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 394 | PRODUCT_BUNDLE_IDENTIFIER = "com.igrsoft.$(PRODUCT_NAME:rfc1034identifier)"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LaunchHelper.app/Contents/MacOS/LaunchHelper"; 397 | }; 398 | name = Debug; 399 | }; 400 | A56235021A817E04002B86A5 /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | BUNDLE_LOADER = "$(TEST_HOST)"; 404 | COMBINE_HIDPI_IMAGES = YES; 405 | FRAMEWORK_SEARCH_PATHS = ( 406 | "$(DEVELOPER_FRAMEWORKS_DIR)", 407 | "$(inherited)", 408 | ); 409 | INFOPLIST_FILE = LaunchHelperTests/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 411 | PRODUCT_BUNDLE_IDENTIFIER = "com.igrsoft.$(PRODUCT_NAME:rfc1034identifier)"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LaunchHelper.app/Contents/MacOS/LaunchHelper"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | A56234DB1A817E04002B86A5 /* Build configuration list for PBXProject "LaunchHelper" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | A56234FB1A817E04002B86A5 /* Debug */, 424 | A56234FC1A817E04002B86A5 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | A56234FD1A817E04002B86A5 /* Build configuration list for PBXNativeTarget "LaunchHelper" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | A56234FE1A817E04002B86A5 /* Debug */, 433 | A56234FF1A817E04002B86A5 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | A56235001A817E04002B86A5 /* Build configuration list for PBXNativeTarget "LaunchHelperTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | A56235011A817E04002B86A5 /* Debug */, 442 | A56235021A817E04002B86A5 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = A56234D81A817E04002B86A5 /* Project object */; 450 | } 451 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LaunchHelper 4 | // 5 | // Created by Vitalii Parovishnyk on 2/4/15. 6 | // Copyright (c) 2015 IGR Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LaunchHelper 4 | // 5 | // Created by Vitalii Parovishnyk on 2/4/15. 6 | // Copyright (c) 2015 IGR Software. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 18 | { 19 | // Insert code here to initialize your application 20 | 21 | NSString *launchAppId = [[NSBundle mainBundle] infoDictionary][@"LaunchAppId"]; 22 | 23 | NSWorkspace *ws = [NSWorkspace sharedWorkspace]; 24 | NSArray *runningApplications = [[ws runningApplications] valueForKey:@"bundleIdentifier"]; 25 | 26 | NSLog(@"launchAppName - %@", launchAppId); 27 | NSLog(@"runningApplications: %@", runningApplications); 28 | 29 | if (![runningApplications containsObject:launchAppId]) 30 | { 31 | NSString *launchAppName = [[NSBundle mainBundle] infoDictionary][@"LaunchAppName"]; 32 | [ws launchApplication:launchAppName]; 33 | } 34 | } 35 | 36 | - (void)applicationWillTerminate:(NSNotification *)aNotification 37 | { 38 | // Insert code here to tear down your application 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSBackgroundOnly 26 | 27 | LSMinimumSystemVersion 28 | $(MACOSX_DEPLOYMENT_TARGET) 29 | LaunchAppId 30 | com.igrsoft.LockMeNow 31 | LaunchAppName 32 | LockMeNow 33 | NSHumanReadableCopyright 34 | Copyright © 2015 IGR Software. All rights reserved. 35 | NSMainNibFile 36 | MainMenu 37 | NSPrincipalClass 38 | NSApplication 39 | 40 | 41 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper/LaunchHelper.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelper/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LaunchHelper 4 | // 5 | // Created by Vitalii Parovishnyk on 2/4/15. 6 | // Copyright (c) 2015 IGR Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelperTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LaunchHelper/LaunchHelperTests/LaunchHelperTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LaunchHelperTests.m 3 | // LaunchHelperTests 4 | // 5 | // Created by Vitalii Parovishnyk on 2/4/15. 6 | // Copyright (c) 2015 IGR Software. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LaunchHelperTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation LaunchHelperTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LockMeNow.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [The Project is not served, please, enjoy forward :)] 2 | == 3 | 4 | Lock Me Now 5 | ========= 6 | [![Platform](https://img.shields.io/badge/platform-OS%20X-lightgrey.svg?style=flat)](http://www.apple.com/osx/) 7 | [![License](https://img.shields.io/badge/license-LGPL%202.1-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/lgpl-2.1.html) 8 | 9 | With this app you can lock your Mac OS in short time and protect your personal data! 10 | 11 | **You can choose any method that you like:** 12 | * Assign hotkeys to lock your system; 13 | * Click on the icon in statusbar; 14 | * Leave the room with your bluetooth device (e.g. iPhone); 15 | * Disconnect your iPhone, iPad or iPod from computer. 16 | 17 | **You can choose any type to lock your system:** 18 | * Login window; 19 | * Just lock your screen; 20 | * New method with nice widgets coming soon! 21 | 22 | **Security options:** 23 | * Make user photo on wrong password; 24 | * Send photo via Mail. 25 | 26 | **Some features:** 27 | * You can choose any method you like; 28 | * You don't need to resume iTunes music player any more; 29 | * You can hide app icon from the status bar; 30 | * Lock your computer with any bluetooth-device you have; 31 | * You can recommend the new locking types for us. We will add it to new releases and You will get a surprise from developers :) 32 | 33 | ___ 34 | ### Download 35 | 36 | Also there [latest build][lockmenow], 37 | 38 | or [nightly build] [lockmenow_beta] 39 | 40 | ___ 41 | ### Contribute to Development Goals Here: 42 | 43 | BTC: 16tGJzt4gJJBhBetpV6BuaWuNfxvkdkbt4 44 | 45 | BCH: bitcoincash:qpcwefpxddjqzdpcrx6tek3uh6x9v7t8tugu30jvks 46 | 47 | LTC: litecoin:MLZxuAdJCaW7LdM4sQuRazgdNvd8G2bdyt 48 | 49 | ___ 50 | ### ScreenShots 51 | 52 | 53 | 54 | 55 | 56 | 57 | ___ 58 | ### Credits 59 | 60 | Developer: Vitalii (Korich) Parovishnyk 61 | 62 | ___ 63 | ### Known Issues 64 | 65 | * Not good work with Bluetooth 66 | 67 | ___ 68 | ### Licence 69 | 70 | This application is free open source software and licensed under the LGPL 2.1. 71 | 72 | 73 | [lockmenow]: http://downloads.igrsoft.com/lockmenow/lockmenow_latest.zip "latest build" 74 | [lockmenow_beta]: http://downloads.igrsoft.com/beta/LockMeNow_beta.zip "nightly build" 75 | -------------------------------------------------------------------------------- /Resources/DMG Artwork/dmgBackground.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/DMG Artwork/dmgBackground.tiff -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon_16x16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "icon_16x16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "icon_32x32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "icon_32x32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "icon_128x128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "icon_128x128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "icon_256x256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "icon_256x256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "icon_512x512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "icon_512x512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_128x128.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_16x16.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_256x256.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_32x32.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_512x512.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/AppIcon.appiconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/AppIcon.appiconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Resources/Images.xcassets/lock.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "filename" : "lock.png" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "filename" : "lock@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode", 17 | "template-rendering-intent" : "template" 18 | } 19 | } -------------------------------------------------------------------------------- /Resources/Images.xcassets/lock.imageset/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/lock.imageset/lock.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/lock.imageset/lock@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/lock.imageset/lock@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/off.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "filename" : "off.png" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "filename" : "off@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Resources/Images.xcassets/off.imageset/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/off.imageset/off.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/off.imageset/off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/off.imageset/off@2x.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/on.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "filename" : "on.png" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "filename" : "on@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Resources/Images.xcassets/on.imageset/on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/on.imageset/on.png -------------------------------------------------------------------------------- /Resources/Images.xcassets/on.imageset/on@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Images.xcassets/on.imageset/on@2x.png -------------------------------------------------------------------------------- /Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.4.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 141.1 25 | LSApplicationCategoryType 26 | public.app-category.utilities 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | LSUIElement 30 | 31 | NSAppTransportSecurity 32 | 33 | NSAllowsArbitraryLoads 34 | 35 | 36 | NSMainNibFile 37 | MainMenu 38 | NSPrincipalClass 39 | NSApplication 40 | SUFeedURL 41 | http://igrsoft.com/wp-content/lockmenow/update.xml 42 | SUPublicDSAKeyFile 43 | dsa_pub.pem 44 | 45 | 46 | -------------------------------------------------------------------------------- /Resources/Scripts/reactivate_asl_service.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /bin/launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist 4 | /bin/launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist 5 | 6 | /usr/sbin/diskutil repairPermissions / 7 | -------------------------------------------------------------------------------- /Resources/Scripts/startCurrentScreensaver.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/Scripts/startCurrentScreensaver.scpt -------------------------------------------------------------------------------- /Resources/TextFieldBG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/TextFieldBG.png -------------------------------------------------------------------------------- /Resources/dot_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/dot_off.png -------------------------------------------------------------------------------- /Resources/dot_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/dot_on.png -------------------------------------------------------------------------------- /Resources/icon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/Resources/icon -------------------------------------------------------------------------------- /Sandbox/XPCLoger.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.temporary-exception.files.absolute-path.read-only 6 | 7 | /private/var/log/opendirectoryd.log 8 | 9 | com.apple.security.app-sandbox 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sandbox/XPCPower.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sandbox/XPCPreferences.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.temporary-exception.shared-preference.read-only 8 | 9 | com.apple.screensaver 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sandbox/XPCScreen.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sandbox/XPCScripting.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.temporary-exception.apple-events 8 | 9 | com.apple.systemevents 10 | 11 | com.apple.security.temporary-exception.sbpl 12 | 13 | (allow iokit-set-properties) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sandbox/XPCScriptingBridge.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.assets.pictures.read-only 8 | 9 | com.apple.security.temporary-exception.apple-events 10 | 11 | com.apple.iTunes 12 | com.apple.mail 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Sandbox/lockmenow.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.assets.pictures.read-write 8 | 9 | com.apple.security.device.bluetooth 10 | 11 | com.apple.security.device.camera 12 | 13 | com.apple.security.device.usb 14 | 15 | com.apple.security.files.user-selected.read-only 16 | 17 | com.apple.security.network.client 18 | 19 | com.apple.security.personal-information.location 20 | 21 | com.apple.security.temporary-exception.sbpl 22 | 23 | (allow network-outbound (literal "/private/var/run/usbmuxd")) 24 | 25 | com.apple.security.temporary-exception.shared-preference.read-write 26 | 27 | com.apple.screensaver 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Source/IGRUserDefaults.h: -------------------------------------------------------------------------------- 1 | // 2 | // IGRUserDefaults.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/19/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, LockingType) 12 | { 13 | LOCK_LOGIN_WINDOW = 0, 14 | LOCK_SCREEN, 15 | LOCK_BLOCK, 16 | }; 17 | 18 | typedef NS_ENUM(NSUInteger, DeviceType) 19 | { 20 | USB_NONE = -1, 21 | USB_ALL_DEVICES = 0, 22 | USB_IPHONE, 23 | USB_IPOD, 24 | USB_IPAD 25 | }; 26 | 27 | typedef NS_ENUM(NSUInteger, PhotoQualityType) 28 | { 29 | PHOTO_QUALITY_TYPE_NORMAL = 0, 30 | PHOTO_QUALITY_TYPE_GOOD, 31 | PHOTO_QUALITY_TYPE_BEST, 32 | }; 33 | 34 | typedef NS_ENUM(NSUInteger, WrongUserActionType) 35 | { 36 | WRONG_PASSWORD_ACTION = 0, 37 | UNPLUG_MAGSAFE_ACTION, 38 | }; 39 | 40 | typedef void (^IGRUserDefaultsBluetoothData)(NSData *bluetoothData); 41 | 42 | @interface IGRUserDefaults : NSObject 43 | 44 | @property (nonatomic, assign) BOOL bEnableStartup; 45 | @property (nonatomic, assign) BOOL bUseIconOnMainMenu; 46 | @property (nonatomic, assign) BOOL bPauseiTunes; 47 | @property (nonatomic, assign) BOOL bUseCurrentScreenSaver; 48 | @property (nonatomic, assign) BOOL bResumeiTunes; 49 | @property (nonatomic, assign) BOOL bNeedResumeiTunes; 50 | @property (nonatomic, assign) NSNumber *iLockType; 51 | @property (nonatomic, assign) BOOL bMonitoringUSB; 52 | @property (nonatomic, assign) NSNumber *iUSBDeviceType; 53 | @property (nonatomic, assign) BOOL bMonitoringBluetooth; 54 | @property (nonatomic, strong) id keyCombo; 55 | @property (nonatomic, copy ) NSData *bluetoothData; 56 | @property (nonatomic, assign) NSNumber *iPhotoQualityType; 57 | @property (nonatomic, assign) BOOL bControllMagSafe; 58 | 59 | @property (nonatomic, assign) BOOL bMakePhotoOnIncorrectPasword; 60 | @property (nonatomic, assign) BOOL bSendMailOnIncorrectPasword; 61 | @property (nonatomic, copy ) NSString *sIncorrectPaswordMail; 62 | @property (nonatomic, assign) BOOL bSendLocationOnIncorrectPasword; 63 | 64 | - (void)loadUserSettings; 65 | - (void)saveUserSettingsWithBluetoothData:(NSData *)bluetoothData; 66 | 67 | @property (nonatomic, readonly) LockingType lockingType; 68 | @property (nonatomic, readonly) DeviceType deviceType; 69 | @property (nonatomic, readonly) PhotoQualityType photoQualityType; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Source/IGRUserDefaults.m: -------------------------------------------------------------------------------- 1 | // 2 | // IGRUserDefaults.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/19/15. 6 | // 7 | // 8 | 9 | #import "IGRUserDefaults.h" 10 | 11 | NSString *kEnableStartup = @"EnableStartup"; 12 | NSString *kGlobalHotKey = @"LockMeNowHotKey"; 13 | NSString *kIconOnMainMenu = @"IconOnMainMenu"; 14 | NSString *kLockType = @"LockType"; 15 | NSString *kUseCurrentScreenSaver = @"UseCurrentScreenSaver"; 16 | NSString *kPauseiTunes = @"PauseiTunes"; 17 | NSString *kResumeiTunes = @"ResumeiTunes"; 18 | NSString *kBluetoothDevice = @"BluetoothDevice"; 19 | NSString *kBluetoothCheckInterval = @"BluetoothCheckInterval"; 20 | NSString *kBluetoothMonitoring = @"BluetoothMonitoring"; 21 | NSString *kUSBMonitoring = @"USBMonitoring"; 22 | NSString *kUSBDeviceType = @"USBDevice"; 23 | NSString *kMakePhotoOnIncorrectPasword = @"MakePhotoOnIncorrectPasword"; 24 | NSString *kSendPhotoOnIncorrectPasword = @"SendPhotoOnIncorrectPasword"; 25 | NSString *kIncorrectPaswordMail = @"IncorrectPaswordMail"; 26 | NSString *kSendLocationOnIncorrectPasword = @"SendLocationOnIncorrectPasword"; 27 | NSString *kPhotoQualityType = @"PhotoQualityType"; 28 | NSString *kControllMegSafe = @"ControllMegSafe"; 29 | 30 | @interface IGRUserDefaults () 31 | 32 | @property (nonatomic, strong) NSUserDefaults *defaults; 33 | 34 | @end 35 | 36 | @implementation IGRUserDefaults 37 | 38 | - (void)initialize 39 | { 40 | // Create a dictionary 41 | NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; 42 | defaultValues[kEnableStartup] = @NO; 43 | defaultValues[kIconOnMainMenu] = @YES; 44 | defaultValues[kLockType] = @(LOCK_SCREEN); 45 | defaultValues[kUseCurrentScreenSaver] = @NO; 46 | defaultValues[kPauseiTunes] = @NO; 47 | defaultValues[kResumeiTunes] = @NO; 48 | 49 | defaultValues[kBluetoothCheckInterval] = @60; 50 | defaultValues[kBluetoothMonitoring] = @NO; 51 | defaultValues[kUSBMonitoring] = @NO; 52 | defaultValues[kUSBDeviceType] = @(USB_ALL_DEVICES); 53 | 54 | defaultValues[kMakePhotoOnIncorrectPasword] = @NO; 55 | defaultValues[kSendPhotoOnIncorrectPasword] = @NO; 56 | defaultValues[kControllMegSafe] = @NO; 57 | defaultValues[kIncorrectPaswordMail] = @""; 58 | defaultValues[kSendLocationOnIncorrectPasword] = @NO; 59 | defaultValues[kPhotoQualityType] = @(PHOTO_QUALITY_TYPE_GOOD); 60 | 61 | // Register the dictionary of defaults 62 | [self.defaults registerDefaults: defaultValues]; 63 | //DBNSLog(@"registered defaults: %@", defaultValues); 64 | } 65 | 66 | - (instancetype)init 67 | { 68 | if (self = [super init]) 69 | { 70 | NSString *bundleIdentifier = [[NSBundle mainBundle] infoDictionary][@"CFBundleIdentifier"]; 71 | bundleIdentifier = [@"sandbox." stringByAppendingString:bundleIdentifier]; 72 | 73 | _defaults = [[NSUserDefaults alloc] initWithSuiteName:bundleIdentifier]; 74 | [self initialize]; 75 | [self loadUserSettings]; 76 | } 77 | 78 | return self; 79 | } 80 | 81 | - (void)loadUserSettings 82 | { 83 | _bEnableStartup = [self.defaults boolForKey:kEnableStartup]; 84 | _bUseIconOnMainMenu = [self.defaults boolForKey:kIconOnMainMenu]; 85 | _iLockType = [self.defaults objectForKey:kLockType]; 86 | _bUseCurrentScreenSaver = [self.defaults boolForKey:kUseCurrentScreenSaver]; 87 | _bPauseiTunes = [self.defaults boolForKey:kPauseiTunes]; 88 | _bResumeiTunes = [self.defaults boolForKey:kResumeiTunes]; 89 | _bNeedResumeiTunes = [self.defaults boolForKey:kResumeiTunes]; 90 | _keyCombo = [self.defaults objectForKey:kGlobalHotKey]; 91 | _bMakePhotoOnIncorrectPasword = [self.defaults boolForKey:kMakePhotoOnIncorrectPasword]; 92 | _bSendMailOnIncorrectPasword = [self.defaults boolForKey:kSendPhotoOnIncorrectPasword]; 93 | _sIncorrectPaswordMail = [self.defaults objectForKey:kIncorrectPaswordMail]; 94 | _bSendLocationOnIncorrectPasword = [self.defaults boolForKey:kSendLocationOnIncorrectPasword]; 95 | _iPhotoQualityType = [self.defaults objectForKey:kPhotoQualityType]; 96 | _bControllMagSafe = [self.defaults boolForKey:kControllMegSafe]; 97 | 98 | NSData *deviceAsData = [self.defaults objectForKey:kBluetoothDevice]; 99 | if( [deviceAsData length] > 0 ) 100 | { 101 | _bluetoothData = deviceAsData; 102 | } 103 | 104 | // Monitoring enabled 105 | _bMonitoringBluetooth = [self.defaults boolForKey:kBluetoothMonitoring]; 106 | _bMonitoringUSB = [self.defaults boolForKey:kUSBMonitoring]; 107 | _iUSBDeviceType = [self.defaults objectForKey:kUSBDeviceType]; 108 | } 109 | 110 | - (void)saveUserSettingsWithBluetoothData:(NSData *)bluetoothData 111 | { 112 | [self.defaults setBool:_bUseIconOnMainMenu forKey:kIconOnMainMenu]; 113 | [self.defaults setObject:_iLockType forKey:kLockType]; 114 | [self.defaults setBool:_bUseCurrentScreenSaver forKey:kUseCurrentScreenSaver]; 115 | [self.defaults setBool:_bPauseiTunes forKey:kPauseiTunes]; 116 | [self.defaults setBool:_bResumeiTunes forKey:kResumeiTunes]; 117 | [self.defaults setBool:_bEnableStartup forKey:kEnableStartup]; 118 | [self.defaults setBool:_bMakePhotoOnIncorrectPasword forKey:kMakePhotoOnIncorrectPasword]; 119 | [self.defaults setBool:_bSendMailOnIncorrectPasword forKey:kSendPhotoOnIncorrectPasword]; 120 | [self.defaults setObject:_sIncorrectPaswordMail forKey:kIncorrectPaswordMail]; 121 | [self.defaults setBool:_bSendLocationOnIncorrectPasword forKey:kSendLocationOnIncorrectPasword]; 122 | [self.defaults setObject:_iPhotoQualityType forKey:kPhotoQualityType]; 123 | [self.defaults setBool:_bControllMagSafe forKey:kControllMegSafe]; 124 | 125 | // Monitoring enabled 126 | [self.defaults setBool:_bMonitoringBluetooth forKey:kBluetoothMonitoring]; 127 | 128 | // Device 129 | if( bluetoothData ) 130 | { 131 | [self.defaults setObject:bluetoothData forKey:kBluetoothDevice]; 132 | } 133 | 134 | if( _keyCombo ) 135 | { 136 | [self.defaults setObject:_keyCombo forKey:kGlobalHotKey]; 137 | } 138 | 139 | [self.defaults setBool:_bMonitoringUSB forKey:kUSBMonitoring]; 140 | [self.defaults setObject:_iUSBDeviceType forKey:kUSBDeviceType]; 141 | 142 | [self.defaults synchronize]; 143 | } 144 | 145 | - (LockingType)lockingType 146 | { 147 | return [_iLockType integerValue]; 148 | } 149 | 150 | - (DeviceType)deviceType 151 | { 152 | return [_iUSBDeviceType integerValue]; 153 | } 154 | 155 | - (PhotoQualityType)photoQualityType 156 | { 157 | return [_iPhotoQualityType integerValue]; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /Source/LMNLockMeNowApp.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNLockMeNowApp.m 3 | // Lock Me Now 4 | // 5 | // Created by Vitaly Parovishnik on 20.07.11. 6 | // Copyright 2010 IGR Software. All rights reserved. 7 | // 8 | 9 | @class StartAtLoginController; 10 | @class LMNKeyListener; 11 | 12 | @interface LMNLockMeNowApp : NSObject 13 | { 14 | StartAtLoginController *loginController; 15 | } 16 | 17 | @property (weak) IBOutlet NSWindow *window; 18 | @property (weak) IBOutlet NSMenu *statusMenu; 19 | @property (weak) IBOutlet NSTabView *tabView; 20 | @property (weak) IBOutlet LMNKeyListener *keyListener; 21 | 22 | @property (weak) IBOutlet NSImageView *bluetoothStatus; 23 | 24 | @property (weak) IBOutlet NSView *lockBlockView; 25 | 26 | @property (weak) IBOutlet NSButton *sendMailCheckbox; 27 | @property (weak) IBOutlet NSProgressIndicator *patchASLProgress; 28 | @property (weak) IBOutlet NSTextField *patchStatus; 29 | @property (weak) IBOutlet NSComboBox *thiefPhotoQuality; 30 | 31 | @property (weak) IBOutlet NSTextField *aboutText; 32 | 33 | // Status Item 34 | @property (strong, nonatomic) NSStatusItem *statusItem; 35 | 36 | - (IBAction)doUnLock:(id)sender; 37 | - (IBAction)doLock:(id)sender; 38 | 39 | - (IBAction)goToURL:(id)sender; 40 | 41 | - (IBAction)openPrefs:(id)sender; 42 | - (IBAction)changeDevice:(id)sender; 43 | 44 | - (IBAction)setMonitoringUSBDevice:(id)sender; 45 | - (IBAction)setMonitoringBluetooth:(id)sender; 46 | 47 | - (IBAction)setMenuIcon:(id)sender; 48 | 49 | - (NSString *)takePhoto; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Source/Listeners/LMNBluetoothListener.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNBluetoothListener.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNListenerManager.h" 10 | 11 | typedef NS_ENUM(NSUInteger, BluetoothStatus) 12 | { 13 | NoneRange = 0, 14 | InRange = 1, 15 | OutOfRange 16 | }; 17 | 18 | typedef void (^LMNBluetoothStatusChangedBlock)(BluetoothStatus bluetoothStatus); 19 | 20 | @interface LMNBluetoothListener : LMNListenerManager 21 | 22 | @property (nonatomic, copy) LMNBluetoothStatusChangedBlock bluetoothStatusChangedBlock; 23 | 24 | - (void)changeDevice; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Source/Listeners/LMNBluetoothListener.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNBluetoothListener.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNBluetoothListener.h" 10 | 11 | #import 12 | #import 13 | #import 14 | 15 | @interface LMNBluetoothListener () 16 | 17 | @property (nonatomic) NSOperationQueue *queue; 18 | @property (nonatomic) NSOperationQueue *guiQueue; 19 | 20 | //Bluetooth 21 | @property (nonatomic) NSInteger bluetoothTimerInterval; 22 | @property (nonatomic) BluetoothStatus bluetoothDevicePriorStatus; 23 | @property (nonatomic) NSTimer *bluetoothTimer; 24 | @property (nonatomic, copy ) NSString *bluetoothName; 25 | 26 | @property (nonatomic) IOBluetoothDevice *bluetoothDevice; 27 | 28 | @end 29 | 30 | @implementation LMNBluetoothListener 31 | 32 | - (instancetype)initWithSettings:(IGRUserDefaults *)aSettings 33 | { 34 | if (self = [super initWithSettings:aSettings]) 35 | { 36 | _bluetoothDevicePriorStatus = NoneRange; 37 | _bluetoothDevice = nil; 38 | if (self.userSettings.bluetoothData) 39 | { 40 | _bluetoothDevice = [NSKeyedUnarchiver unarchiveObjectWithData:self.userSettings.bluetoothData]; 41 | } 42 | [self updateDeviceName]; 43 | 44 | _bluetoothTimerInterval = 2; 45 | 46 | _guiQueue = [[NSOperationQueue alloc] init]; 47 | _queue = [[NSOperationQueue alloc] init]; 48 | 49 | if (self.userSettings.bMonitoringBluetooth) 50 | { 51 | [self startListen]; 52 | } 53 | } 54 | 55 | return self; 56 | } 57 | 58 | - (void)startListen 59 | { 60 | if (![_bluetoothDevice isConnected]) 61 | { 62 | IOReturn rt = [_bluetoothDevice openConnection:self]; 63 | [self reset]; 64 | if (rt != kIOReturnSuccess) 65 | { 66 | DBNSLog(@"Can't connect bluetoth device"); 67 | } 68 | } 69 | 70 | _bluetoothTimer = [NSTimer scheduledTimerWithTimeInterval:self.bluetoothTimerInterval 71 | target:self 72 | selector:@selector(handleTimer:) 73 | userInfo:nil 74 | repeats:YES]; 75 | } 76 | 77 | - (void)stopListen 78 | { 79 | [self reset]; 80 | 81 | [_bluetoothDevice closeConnection]; 82 | [_bluetoothTimer invalidate]; 83 | 84 | [_queue cancelAllOperations]; 85 | [_guiQueue cancelAllOperations]; 86 | 87 | [[NSOperationQueue mainQueue] cancelAllOperations]; 88 | } 89 | 90 | - (void)reset 91 | { 92 | self.bluetoothDevicePriorStatus = NoneRange; 93 | } 94 | 95 | - (void)changeDevice 96 | { 97 | IOBluetoothDeviceSelectorController *deviceSelector = [IOBluetoothDeviceSelectorController deviceSelector]; 98 | [deviceSelector runModal]; 99 | 100 | NSArray *results = [deviceSelector getResults]; 101 | 102 | if( !results ) 103 | { 104 | return; 105 | } 106 | 107 | _bluetoothDevice = [results firstObject]; 108 | _bluetoothDevicePriorStatus = NoneRange; 109 | 110 | NSData *deviceAsData = [NSKeyedArchiver archivedDataWithRootObject:_bluetoothDevice]; 111 | [self.userSettings saveUserSettingsWithBluetoothData:deviceAsData]; 112 | 113 | [self updateDeviceName]; 114 | } 115 | 116 | - (void)updateDeviceName 117 | { 118 | if (_bluetoothDevice) 119 | { 120 | self.bluetoothName = [_bluetoothDevice name]; 121 | } 122 | } 123 | 124 | - (BOOL)isInRange 125 | { 126 | if (_bluetoothDevice) 127 | { 128 | if ([_bluetoothDevice remoteNameRequest:nil] == kIOReturnSuccess ) 129 | { 130 | return YES; 131 | } 132 | } 133 | 134 | return NO; 135 | } 136 | 137 | - (void)handleTimer:(NSTimer *)theTimer 138 | { 139 | if (![[_queue operations] count]) 140 | { 141 | [_queue addOperationWithBlock:^ { 142 | 143 | BOOL result = [self isInRange]; 144 | 145 | if (_bluetoothDevicePriorStatus == NoneRange && self.bluetoothDevice) 146 | { 147 | self.bluetoothDevicePriorStatus = result ? InRange : OutOfRange; 148 | } 149 | 150 | if (result) 151 | { 152 | if (_bluetoothDevicePriorStatus == OutOfRange) 153 | { 154 | [self makeUnlockAction:self]; 155 | } 156 | self.bluetoothDevicePriorStatus = InRange; 157 | } 158 | else 159 | { 160 | if (_bluetoothDevicePriorStatus == InRange) 161 | { 162 | [self makeLockAction:self]; 163 | } 164 | 165 | self.bluetoothDevicePriorStatus = OutOfRange; 166 | } 167 | }]; 168 | } 169 | } 170 | 171 | - (void)setBluetoothDevicePriorStatus:(BluetoothStatus)bluetoothDevicePriorStatus 172 | { 173 | if (_bluetoothDevicePriorStatus == bluetoothDevicePriorStatus) 174 | { 175 | return; 176 | } 177 | 178 | _bluetoothDevicePriorStatus = bluetoothDevicePriorStatus; 179 | 180 | if (self.bluetoothStatusChangedBlock) 181 | { 182 | self.bluetoothStatusChangedBlock(_bluetoothDevicePriorStatus); 183 | } 184 | } 185 | 186 | @end 187 | -------------------------------------------------------------------------------- /Source/Listeners/LMNKeyListener.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNKeyListener.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNListenerManager.h" 10 | 11 | @class PTHotKey; 12 | @class SRRecorderControl; 13 | 14 | @interface LMNKeyListener : LMNListenerManager 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Source/Listeners/LMNKeyListener.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNKeyListener.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNKeyListener.h" 10 | 11 | #import 12 | #import 13 | #import 14 | 15 | extern NSString *kGlobalHotKey; 16 | 17 | @interface LMNKeyListener () 18 | 19 | @property (nonatomic, strong) IBOutlet SRRecorderControl *hotKeyControl; 20 | @property (nonatomic, strong) PTHotKey *hotKey; 21 | 22 | @end 23 | 24 | @implementation LMNKeyListener 25 | 26 | - (instancetype)initWithSettings:(IGRUserDefaults *)aSettings 27 | { 28 | if (self = [super initWithSettings:aSettings]) 29 | { 30 | [self startListen]; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)startListen 37 | { 38 | [self.hotKeyControl setCanCaptureGlobalHotKeys:YES]; 39 | 40 | [[PTHotKeyCenter sharedCenter] unregisterHotKey:self.hotKey]; 41 | PTKeyCombo *keyCombo = [[PTKeyCombo alloc] initWithPlistRepresentation:self.userSettings.keyCombo]; 42 | 43 | self.hotKey = [[PTHotKey alloc] initWithIdentifier:kGlobalHotKey 44 | keyCombo:keyCombo]; 45 | 46 | [self.hotKey setTarget: self]; 47 | [self.hotKey setAction: @selector(makeLockAction:)]; 48 | 49 | [[PTHotKeyCenter sharedCenter] registerHotKey:self.hotKey]; 50 | 51 | NSNumber *kc = @(self.hotKey.keyCombo.keyCode); 52 | NSNumber *mf = @(self.hotKey.keyCombo.modifierMask); 53 | 54 | [self.hotKeyControl setObjectValue:@{@"keyCode": kc, @"modifierFlags": mf}]; 55 | } 56 | 57 | - (void)stopListen 58 | { 59 | 60 | } 61 | 62 | - (BOOL)shortcutRecorder:(SRRecorderControl *)aRecorder isKeyCode:(NSInteger)keyCode andFlagsTaken:(NSUInteger)flags reason:(NSString **)aReason 63 | { 64 | return NO; 65 | } 66 | 67 | - (void)shortcutRecorder:(SRRecorderControl *)aRecorder keyComboDidChange:(KeyCombo)newKeyCombo 68 | { 69 | PTKeyCombo *keyCombo = [PTKeyCombo keyComboWithKeyCode:[aRecorder keyCombo].code 70 | modifiers:[aRecorder cocoaToCarbonFlags:[aRecorder keyCombo].flags]]; 71 | 72 | if (aRecorder == self.hotKeyControl) 73 | { 74 | self.hotKey.keyCombo = keyCombo; 75 | 76 | // Re-register the new hot key 77 | [[PTHotKeyCenter sharedCenter] registerHotKey:self.hotKey]; 78 | self.userSettings.keyCombo = [keyCombo plistRepresentation]; 79 | 80 | __weak typeof(self) weakSelf = self; 81 | dispatch_async(dispatch_get_main_queue(), ^{ 82 | 83 | [weakSelf.userSettings saveUserSettingsWithBluetoothData:nil]; 84 | }); 85 | } 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Source/Listeners/LMNListenerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNListenerManager.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @class IGRUserDefaults; 12 | 13 | @protocol LMNListenerManagerDelegate 14 | 15 | - (void)makeLockAction:(id)sender; 16 | - (void)makeUnlockAction:(id)sender; 17 | 18 | @end 19 | 20 | @interface LMNListenerManager : NSObject 21 | 22 | - (instancetype)init NS_UNAVAILABLE; 23 | - (instancetype)initWithSettings:(IGRUserDefaults *)aSettings; 24 | 25 | - (void)startListen; 26 | - (void)stopListen; 27 | 28 | - (void)makeLockAction:(id)sender; 29 | - (void)makeUnlockAction:(id)sender; 30 | 31 | - (void)reset; 32 | 33 | @property (nonatomic, weak ) IGRUserDefaults *userSettings; 34 | @property (nonatomic, weak ) id delegate; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Source/Listeners/LMNListenerManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNListenerManager.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNListenerManager.h" 10 | 11 | @implementation LMNListenerManager 12 | 13 | - (instancetype)initWithSettings:(IGRUserDefaults *)aSettings 14 | { 15 | if (self = [super init]) 16 | { 17 | _userSettings = aSettings; 18 | } 19 | 20 | return self; 21 | } 22 | 23 | - (void)startListen 24 | { 25 | DBNSLog(@"%s", __func__); 26 | } 27 | 28 | - (void)stopListen 29 | { 30 | DBNSLog(@"%s", __func__); 31 | } 32 | 33 | - (void)setUserSettings:(IGRUserDefaults *)userSettings 34 | { 35 | [self stopListen]; 36 | 37 | _userSettings = userSettings; 38 | 39 | [self startListen]; 40 | } 41 | 42 | - (void)makeLockAction:(id)sender 43 | { 44 | [self.delegate makeLockAction:sender]; 45 | } 46 | 47 | - (void)makeUnlockAction:(id)sender 48 | { 49 | [self.delegate makeUnlockAction:sender]; 50 | } 51 | 52 | - (void)reset 53 | { 54 | DBNSLog(@"%s", __func__); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Source/Listeners/LMNUSBListener.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNUSBListener.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNListenerManager.h" 10 | 11 | #define NUM_APPLE_MOBILE_DEVICES 22 12 | 13 | #define NUM_IPHONE_POS 0 14 | #define NUM_IPOD_POS 8 15 | #define NUM_IPAD_POS 13 16 | 17 | #define VENDOR_APPLE 0x05ac 18 | 19 | typedef struct { 20 | const char *name; 21 | uint16_t productID; 22 | } APPLE_MOBILE_DEVICE; 23 | 24 | @interface LMNUSBListener : LMNListenerManager 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Source/Listeners/LMNUSBListener.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNUSBListener.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/27/15. 6 | // 7 | // 8 | 9 | #import "LMNUSBListener.h" 10 | 11 | #import 12 | #import 13 | #import "PTUSBHub.h" 14 | 15 | @interface LMNUSBListener () 16 | 17 | @property (nonatomic) NSInteger usbDeviceID; 18 | @property (nonatomic) DeviceType currentUSBDeviceType; 19 | 20 | @property (nonatomic, copy) NSString *usbDeviceName; 21 | @property (nonatomic, copy) NSString *usbDeviceSerial; 22 | 23 | @end 24 | 25 | @implementation LMNUSBListener 26 | 27 | - (instancetype)initWithSettings:(IGRUserDefaults *)aSettings 28 | { 29 | if (self = [super initWithSettings:aSettings]) 30 | { 31 | _currentUSBDeviceType = USB_NONE; 32 | 33 | if (self.userSettings.bMonitoringUSB) 34 | { 35 | [self startListen]; 36 | } 37 | } 38 | 39 | return self; 40 | } 41 | 42 | static APPLE_MOBILE_DEVICE APPLE_MOBILE_DEVICES[NUM_APPLE_MOBILE_DEVICES] = 43 | { 44 | { "iPhone", 0x1290 }, 45 | { "iPhone 3G", 0x1292 }, 46 | { "iPhone 3G[s]", 0x1294 }, 47 | { "iPhone 4(GSM)", 0x1297 }, 48 | { "iPhone 4(CDMA)", 0x129c }, 49 | { "iPhone 4(R2)", 0x129c }, 50 | { "iPhone 4S", 0x12a0 }, 51 | { "iPhone 5 and Newer", 0x12a8 }, 52 | 53 | { "iPod touch 1G", 0x1291 }, 54 | { "iPod touch 2G", 0x1293 }, 55 | { "iPod touch 3G", 0x1299 }, 56 | { "iPod touch 4G", 0x129e }, 57 | { "iPod touch 5G and Newer",0x12aa }, 58 | 59 | { "iPad", 0x129a }, 60 | { "iPad 2(WiFi)", 0x129f }, 61 | { "iPad 2(GSM)", 0x12a2 }, 62 | { "iPad 2(CDMA)", 0x12a3 }, 63 | { "iPad 3(R2)", 0x12a9 }, 64 | { "iPad 3(WiFi)", 0x12a4 }, 65 | { "iPad 3(CDMA)", 0x12a5 }, 66 | { "iPad 3(4G)", 0x12a6 }, 67 | { "iPad 4 and Newer", 0x12ab }, 68 | }; 69 | 70 | - (void)startListen 71 | { 72 | NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; 73 | 74 | [nc addObserver:self 75 | selector:@selector(listeningAttachUSBDevice:) 76 | name:PTUSBDeviceDidAttachNotification 77 | object:PTUSBHub.sharedHub]; 78 | 79 | [nc addObserver:self 80 | selector:@selector(listeningDetachUSBDevice:) 81 | name:PTUSBDeviceDidDetachNotification 82 | object:PTUSBHub.sharedHub]; 83 | } 84 | 85 | - (void)stopListen 86 | { 87 | NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; 88 | 89 | [nc removeObserver:self 90 | name:PTUSBDeviceDidAttachNotification 91 | object:PTUSBHub.sharedHub]; 92 | 93 | [nc removeObserver:self 94 | name:PTUSBDeviceDidDetachNotification 95 | object:PTUSBHub.sharedHub]; 96 | } 97 | 98 | - (void)reset 99 | { 100 | _currentUSBDeviceType = USB_NONE; 101 | _usbDeviceSerial = nil; 102 | 103 | if (self.userSettings.bMonitoringUSB) 104 | { 105 | [self stopListen]; 106 | [self startListen]; 107 | } 108 | } 109 | 110 | - (void)listeningDetachUSBDevice:(NSNotification *)note 111 | { 112 | NSInteger _deviceID = [(note.userInfo)[@"DeviceID"] intValue]; 113 | if (_usbDeviceID == _deviceID) 114 | { 115 | DBNSLog(@"%@ is disconnected by USB", _usbDeviceName); 116 | DeviceType deviceType = [self.userSettings deviceType]; 117 | 118 | if (deviceType == _currentUSBDeviceType || deviceType == USB_ALL_DEVICES) 119 | { 120 | _usbDeviceID = 0; 121 | _usbDeviceName = nil; 122 | 123 | [self makeLockAction:self]; 124 | } 125 | } 126 | } 127 | 128 | - (void)listeningAttachUSBDevice:(NSNotification *)note 129 | { 130 | _usbDeviceID = 0; 131 | _currentUSBDeviceType = USB_NONE; 132 | 133 | uint16_t productID = [(note.userInfo)[@"Properties"][@"ProductID"] unsignedShortValue]; 134 | NSString *usbDeviceSerial = (note.userInfo)[@"Properties"][@"SerialNumber"]; 135 | 136 | if ([usbDeviceSerial isEqualToString:self.usbDeviceSerial]) { 137 | [self makeUnlockAction:self]; 138 | self.usbDeviceSerial = nil; 139 | } 140 | 141 | if (!self.usbDeviceSerial.length) 142 | { 143 | for (NSInteger i = NUM_IPHONE_POS; i < NUM_APPLE_MOBILE_DEVICES; ++i) 144 | { 145 | APPLE_MOBILE_DEVICE iOSDevice = APPLE_MOBILE_DEVICES[i]; 146 | if (productID == iOSDevice.productID) 147 | { 148 | DBNSLog(@"%s is connected by USB", iOSDevice.name); 149 | _usbDeviceID = [(note.userInfo)[@"DeviceID"] intValue]; 150 | _usbDeviceName = [[NSString alloc] initWithCString:iOSDevice.name encoding:NSUTF8StringEncoding]; 151 | _usbDeviceSerial = usbDeviceSerial; 152 | 153 | if (i < NUM_IPOD_POS) { 154 | _currentUSBDeviceType = USB_IPHONE; 155 | } 156 | else if (i < NUM_IPAD_POS) 157 | { 158 | _currentUSBDeviceType = USB_IPOD; 159 | } 160 | else 161 | { 162 | _currentUSBDeviceType = USB_IPAD; 163 | } 164 | 165 | break; 166 | } 167 | } 168 | } 169 | } 170 | 171 | @end 172 | -------------------------------------------------------------------------------- /Source/LockManager/LMNJustLock.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNJustLock.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/22/15. 6 | // 7 | // 8 | 9 | #import "LMNLockManager.h" 10 | 11 | @interface LMNJustLock : LMNLockManager 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Source/LockManager/LMNJustLock.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNJustLock.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/22/15. 6 | // 7 | // 8 | 9 | #import "LMNJustLock.h" 10 | #import "XPCScriptingProtocol.h" 11 | 12 | static NSString * const kScreensaverDidStart = @"com.apple.screensaver.didstart"; 13 | static NSString * const kScreensaverDidStop = @"com.apple.screensaver.didstop"; 14 | 15 | @implementation LMNJustLock 16 | 17 | - (instancetype)initWithConnection:(NSXPCConnection *)aConnection settings:(IGRUserDefaults *)aSettings 18 | { 19 | if (self = [super initWithConnection:aConnection settings:aSettings]) 20 | { 21 | self.useSecurity = YES; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | - (void)lock 28 | { 29 | [super lock]; 30 | 31 | if (self.isLocked) 32 | { 33 | NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"startCurrentScreensaver" ofType:@"scpt"]; 34 | 35 | [[self.scriptServiceConnection remoteObjectProxy] makeJustLock:self.userSettings.bUseCurrentScreenSaver 36 | scriptPath:scriptPath]; 37 | 38 | NSDistributedNotificationCenter* distCenter = [NSDistributedNotificationCenter defaultCenter]; 39 | [distCenter addObserver:self 40 | selector:@selector(screensaverStart:) 41 | name:kScreensaverDidStart 42 | object:nil]; 43 | 44 | [distCenter addObserver:self 45 | selector:@selector(screensaverStop:) 46 | name:kScreensaverDidStop 47 | object:nil]; 48 | } 49 | } 50 | 51 | - (void)unlockByLockManager:(BOOL)byManager 52 | { 53 | [super unlockByLockManager:byManager]; 54 | 55 | [[self.scriptServiceConnection remoteObjectProxy] makeJustUnLock]; 56 | 57 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self 58 | name:kScreensaverDidStart 59 | object:nil]; 60 | 61 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self 62 | name:kScreensaverDidStop 63 | object:nil]; 64 | } 65 | 66 | - (void)screensaverStart:(NSNotification *)aNotification 67 | { 68 | DBNSLog(@"Screensaver Start"); 69 | } 70 | 71 | - (void)screensaverStop:(NSNotification *)aNotification 72 | { 73 | DBNSLog(@"Screensaver Stop"); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Source/LockManager/LMNLockManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNLockManager.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/22/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @class IGRUserDefaults; 12 | 13 | @protocol LMNLockManagerDelegate 14 | 15 | - (void)unLockSuccess; 16 | 17 | - (void)detectedEnterPassword; 18 | - (void)detectedUnplygMagSafeAction; 19 | 20 | @end 21 | 22 | @interface LMNLockManager : NSObject 23 | 24 | - (instancetype)initWithConnection:(NSXPCConnection *)aConnection settings:(IGRUserDefaults *)aSettings; 25 | 26 | - (void)lock; 27 | - (void)unlockByLockManager:(BOOL)byManager; 28 | 29 | @property (nonatomic, weak ) NSXPCConnection *scriptServiceConnection; 30 | @property (nonatomic, weak ) IGRUserDefaults *userSettings; 31 | @property (nonatomic, assign) BOOL useSecurity; 32 | @property (nonatomic, assign) BOOL allowTerminate; 33 | 34 | @property (nonatomic, assign) BOOL isLocked; 35 | 36 | @property (nonatomic, weak) id delegate; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Source/LockManager/LMNLockManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNLockManager.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/22/15. 6 | // 7 | // 8 | 9 | #import "LMNLockManager.h" 10 | #import "XPCLogerProtocol.h" 11 | #import "XPCScreenProtocol.h" 12 | #import "XPCPowerProtocol.h" 13 | #import "XPCPreferences.h" 14 | 15 | @interface LMNLockManager () 16 | 17 | @property (nonatomic, strong) NSXPCConnection *logerServiceConnection; 18 | @property (nonatomic, strong) FoudWrongPasswordBlock foudWrongPasswordBlock; 19 | 20 | @property (nonatomic, strong) NSXPCConnection *screenServiceConnection; 21 | 22 | @property (nonatomic, strong) NSXPCConnection *powerServiceConnection; 23 | @property (nonatomic, strong) FoudChangesInPowerBlock foudChangesInPowerBlock; 24 | 25 | @property (nonatomic, assign) BOOL userUsePassword; 26 | @property (nonatomic, assign) NSNumber *passwordDelay; 27 | 28 | - (BOOL)setSecuritySetings:(BOOL)aLock; 29 | 30 | @end 31 | 32 | @implementation LMNLockManager 33 | 34 | - (instancetype)initWithConnection:(NSXPCConnection *)aConnection settings:(IGRUserDefaults *)aSettings 35 | { 36 | if (self = [super init]) 37 | { 38 | _scriptServiceConnection = aConnection; 39 | _userSettings = aSettings; 40 | _useSecurity = NO; 41 | _allowTerminate = YES; 42 | 43 | _userUsePassword = NO; 44 | _passwordDelay = @0; 45 | _isLocked = NO; 46 | 47 | _screenServiceConnection = [[NSXPCConnection alloc] initWithServiceName:XPC_SCREEN]; 48 | _screenServiceConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCScreenProtocol)]; 49 | [_screenServiceConnection resume]; 50 | } 51 | 52 | return self; 53 | } 54 | 55 | - (void)dealloc 56 | { 57 | [_screenServiceConnection invalidate]; 58 | } 59 | 60 | - (void)lock 61 | { 62 | DBNSLog(@"%s Lock", __func__); 63 | 64 | BOOL correctSettings = [self setSecuritySetings:YES]; 65 | 66 | if (correctSettings) { 67 | if (_useSecurity) 68 | { 69 | [self startCheckIncorrectPassword]; 70 | [self startCheckPowerMode]; 71 | } 72 | 73 | __weak typeof(self) weakSelf = self; 74 | [[self.screenServiceConnection remoteObjectProxy] startListenScreenUnlock:^{ 75 | 76 | [weakSelf unlockByLockManager:NO]; 77 | }]; 78 | } 79 | 80 | _isLocked = correctSettings; 81 | } 82 | 83 | - (void)unlockByLockManager:(BOOL)byManager 84 | { 85 | DBNSLog(@"%s UnLock", __func__); 86 | 87 | _isLocked = NO; 88 | 89 | [self.delegate unLockSuccess]; 90 | 91 | if (byManager) { 92 | [self unlockSecuritySetings]; 93 | } 94 | else 95 | { 96 | [self setSecuritySetings:NO]; 97 | } 98 | 99 | if (_useSecurity) 100 | { 101 | [self stopCheckIncorrectPassword]; 102 | [self stopCheckPowerMode]; 103 | } 104 | } 105 | 106 | - (BOOL)askPassword 107 | { 108 | BOOL isPassword = (BOOL)CFPreferencesGetAppBooleanValue(CFSTR(kAskForPassword), 109 | CFSTR(kSeviceName), 110 | nil); 111 | 112 | return isPassword; 113 | } 114 | 115 | - (NSNumber *)passwordDelay 116 | { 117 | NSNumber *passwordDelay = @(CFPreferencesGetAppIntegerValue(CFSTR(kAskForPasswordDelay), 118 | CFSTR(kSeviceName), 119 | nil)); 120 | 121 | return passwordDelay; 122 | } 123 | 124 | - (BOOL)unlockSecuritySetings 125 | { 126 | DBNSLog(@"Remove Security Lock by Lock Manager"); 127 | 128 | NSNumber *askPasswordVal = @NO; 129 | NSNumber *passwordDelayVal = @0; 130 | 131 | CFPreferencesSetValue(CFSTR(kAskForPassword), (__bridge CFPropertyListRef) askPasswordVal, 132 | CFSTR(kSeviceName), 133 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 134 | 135 | CFPreferencesSetValue(CFSTR(kSeviceName), (__bridge CFPropertyListRef) passwordDelayVal, 136 | CFSTR(kAskForPasswordDelay), 137 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 138 | 139 | BOOL success = CFPreferencesSynchronize(CFSTR(kSeviceName), 140 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 141 | 142 | if (!success) 143 | { 144 | DBNSLog(@"Can't sync Prefs"); 145 | } 146 | 147 | sleep(1); //Need wait 1 148 | 149 | return success; 150 | } 151 | 152 | - (BOOL)setSecuritySetings:(BOOL)aLock 153 | { 154 | NSNumber *askPasswordVal = @YES; 155 | NSNumber *passwordDelayVal = @0; 156 | 157 | if (aLock) 158 | { 159 | DBNSLog(@"Set Security Lock"); 160 | 161 | _userUsePassword = [self askPassword]; 162 | _passwordDelay = [self passwordDelay]; 163 | } 164 | else 165 | { 166 | sleep(1); //Need wait 1 167 | DBNSLog(@"Remove Security Lock by Listener"); 168 | 169 | askPasswordVal = @(_userUsePassword); 170 | passwordDelayVal = _passwordDelay; 171 | } 172 | 173 | CFPreferencesSetValue(CFSTR(kAskForPassword), (__bridge CFPropertyListRef) askPasswordVal, 174 | CFSTR(kSeviceName), 175 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 176 | 177 | CFPreferencesSetValue(CFSTR(kAskForPasswordDelay), (__bridge CFPropertyListRef) passwordDelayVal, 178 | CFSTR(kSeviceName), 179 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 180 | 181 | BOOL success = CFPreferencesSynchronize(CFSTR(kSeviceName), 182 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 183 | 184 | if (!success) 185 | { 186 | DBNSLog(@"Can't sync Prefs"); 187 | } 188 | 189 | return success; 190 | } 191 | 192 | - (void)startCheckIncorrectPassword 193 | { 194 | if (_userSettings.bMakePhotoOnIncorrectPasword || _userSettings.bSendMailOnIncorrectPasword) 195 | { 196 | self.logerServiceConnection = [[NSXPCConnection alloc] initWithServiceName:XPC_LOGER]; 197 | _logerServiceConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCLogerProtocol)]; 198 | [_logerServiceConnection resume]; 199 | 200 | __weak typeof(self) weakSelf = self; 201 | 202 | self.foudWrongPasswordBlock = ^{ 203 | 204 | dispatch_async(dispatch_get_main_queue(), ^{ 205 | 206 | [weakSelf.delegate detectedEnterPassword]; 207 | }); 208 | 209 | //Need update replay block, it called one times 210 | [[weakSelf.logerServiceConnection remoteObjectProxy] updateReplayBlock:weakSelf.foudWrongPasswordBlock]; 211 | }; 212 | 213 | [[_logerServiceConnection remoteObjectProxy] startCheckIncorrectPassword:self.foudWrongPasswordBlock]; 214 | } 215 | } 216 | 217 | - (void)stopCheckIncorrectPassword 218 | { 219 | if (_userSettings.bMakePhotoOnIncorrectPasword || _userSettings.bSendMailOnIncorrectPasword) 220 | { 221 | self.foudWrongPasswordBlock = nil; 222 | [[_logerServiceConnection remoteObjectProxy] stopCheckIncorrectPassword]; 223 | [_logerServiceConnection invalidate]; 224 | } 225 | } 226 | 227 | - (void)startCheckPowerMode 228 | { 229 | if (_userSettings.bControllMagSafe) 230 | { 231 | self.powerServiceConnection = [[NSXPCConnection alloc] initWithServiceName:XPC_POWER]; 232 | _powerServiceConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCPowerProtocol)]; 233 | [_powerServiceConnection resume]; 234 | 235 | __weak typeof(self) weakSelf = self; 236 | 237 | self.foudChangesInPowerBlock = ^{ 238 | 239 | dispatch_async(dispatch_get_main_queue(), ^{ 240 | 241 | [weakSelf.delegate detectedUnplygMagSafeAction]; 242 | }); 243 | 244 | //Need update replay block, it called one times 245 | [[weakSelf.powerServiceConnection remoteObjectProxy] updateReplayBlock:weakSelf.foudChangesInPowerBlock]; 246 | }; 247 | 248 | [[_powerServiceConnection remoteObjectProxy] startCheckPower:self.foudChangesInPowerBlock]; 249 | } 250 | } 251 | 252 | - (void)stopCheckPowerMode 253 | { 254 | if (_userSettings.bControllMagSafe) 255 | { 256 | self.foudWrongPasswordBlock = nil; 257 | [[_powerServiceConnection remoteObjectProxy] stopCheckPower]; 258 | [_powerServiceConnection invalidate]; 259 | } 260 | } 261 | 262 | @end 263 | -------------------------------------------------------------------------------- /Source/LockManager/LMNLoginWindowsLock.h: -------------------------------------------------------------------------------- 1 | // 2 | // LMNLoginWindowsLock.h 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/22/15. 6 | // 7 | // 8 | 9 | #import "LMNLockManager.h" 10 | 11 | @interface LMNLoginWindowsLock : LMNLockManager 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Source/LockManager/LMNLoginWindowsLock.m: -------------------------------------------------------------------------------- 1 | // 2 | // LMNLoginWindowsLock.m 3 | // LockMeNow 4 | // 5 | // Created by Vitalii Parovishnyk on 1/22/15. 6 | // 7 | // 8 | 9 | #import "LMNLoginWindowsLock.h" 10 | #import "XPCScriptingProtocol.h" 11 | 12 | @implementation LMNLoginWindowsLock 13 | 14 | - (instancetype)initWithConnection:(NSXPCConnection *)aConnection settings:(IGRUserDefaults *)aSettings 15 | { 16 | if (self = [super initWithConnection:aConnection settings:aSettings]) 17 | { 18 | } 19 | 20 | return self; 21 | } 22 | 23 | - (void)lock 24 | { 25 | [super lock]; 26 | 27 | #if (1) 28 | [[NSTask launchedTaskWithLaunchPath:@"/bin/bash" 29 | arguments:@[@"-c", @"exec \"/System/Library/CoreServices/Menu Extras/user.menu/Contents/Resources/CGSession\" -suspend"]] 30 | waitUntilExit]; 31 | #else 32 | [[self.scriptServiceConnection remoteObjectProxy] makeLoginWindowLock]; 33 | #endif 34 | } 35 | 36 | - (void)unlockByLockManager:(BOOL)byManager 37 | { 38 | [super unlockByLockManager:byManager]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Source/Pattern/DrawPatternLockView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DrawPatternLockView.h 3 | // AndroidLock 4 | // 5 | // Created by Vitalii Parovishnyk on 03/06/13. 6 | // Copyright (c) 2013 IGR Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DrawPatternLockView : NSView { 12 | NSValue *_trackPointValue; 13 | NSMutableArray *_dotViews; 14 | 15 | NSMutableArray* _paths; 16 | 17 | // after pattern is drawn, call this: 18 | id _target; 19 | SEL _action; 20 | } 21 | 22 | // get key from the pattern drawn 23 | - (NSString*)getKey; 24 | 25 | - (void)setTarget:(id)target withAction:(SEL)action; 26 | - (void)clearDotViews; 27 | - (void)addDotView:(NSView*)view; 28 | - (void)drawLineFromLastDotTo:(CGPoint)pt; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Source/Pattern/DrawPatternLockView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DrawPatternLockView.m 3 | // AndroidLock 4 | // 5 | // Created by Vitalii Parovishnyk on 03/06/13. 6 | // Copyright (c) 2013 IGR Software. All rights reserved. 7 | // 8 | 9 | #import "DrawPatternLockView.h" 10 | 11 | @implementation DrawPatternLockView 12 | 13 | 14 | - (id)initWithFrame:(CGRect)frame 15 | { 16 | self = [super initWithFrame:frame]; 17 | if (self) { 18 | _paths = nil; 19 | } 20 | 21 | return self; 22 | } 23 | 24 | // Only override drawRect: if you perform custom drawing. 25 | // An empty implementation adversely affects performance during animation. 26 | - (void)drawRect:(CGRect)rect 27 | { 28 | NSLog(@"drawrect..."); 29 | 30 | if (!_trackPointValue) 31 | return; 32 | 33 | CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; 34 | CGContextSetLineWidth(context, 10.0); 35 | CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); 36 | CGFloat components[] = {0.5, 0.5, 0.5, 0.8}; 37 | CGColorRef color = CGColorCreate(colorspace, components); 38 | CGContextSetStrokeColorWithColor(context, color); 39 | 40 | CGPoint from; 41 | NSView *lastDot; 42 | 43 | for (NSView *dotView in _dotViews) 44 | { 45 | from = CGPointMake(NSMidX(dotView.frame), NSMidY(dotView.frame)); 46 | NSLog(@"drwaing dotview: %@", dotView); 47 | NSLog(@"\tdrawing from: %f, %f", from.x, from.y); 48 | 49 | if (!lastDot) 50 | CGContextMoveToPoint(context, from.x, from.y); 51 | else 52 | CGContextAddLineToPoint(context, from.x, from.y); 53 | 54 | lastDot = dotView; 55 | } 56 | 57 | NSPoint pt = [_trackPointValue pointValue]; 58 | NSLog(@"\t to: %f, %f", pt.x, pt.y); 59 | CGContextAddLineToPoint(context, pt.x, pt.y); 60 | 61 | CGContextStrokePath(context); 62 | CGColorSpaceRelease(colorspace); 63 | CGColorRelease(color); 64 | 65 | _trackPointValue = nil; 66 | } 67 | 68 | 69 | - (void)clearDotViews 70 | { 71 | [_dotViews removeAllObjects]; 72 | } 73 | 74 | 75 | - (void)addDotView:(NSView *)view 76 | { 77 | if (!_dotViews) 78 | _dotViews = [NSMutableArray array]; 79 | 80 | [_dotViews addObject:view]; 81 | } 82 | 83 | 84 | - (void) drawLineFromLastDotTo:(NSPoint)pt 85 | { 86 | _trackPointValue = [NSValue valueWithPoint:pt]; 87 | [self setNeedsDisplay:YES]; 88 | } 89 | 90 | - (void)setHighlighted:(bool)yesNo imageView:(NSImageView*)imageView 91 | { 92 | NSImage *img = [NSImage imageNamed:@"dot_off"]; 93 | 94 | if (yesNo) { 95 | img = [NSImage imageNamed:@"dot_on"]; 96 | } 97 | 98 | [imageView setImage:img]; 99 | } 100 | 101 | - (void) mouseDown:(NSEvent *)theEvent 102 | { 103 | _paths = [[NSMutableArray alloc] init]; 104 | DBNSLog(@"mouseDown"); 105 | } 106 | 107 | - (void)mouseDragged:(NSEvent *) theEvent 108 | { 109 | DBNSLog(@"mouseDragged"); 110 | 111 | NSPoint pt = [[[theEvent window] contentView] convertPoint:[theEvent locationInWindow] toView:self]; 112 | NSPoint pt2 = [self convertPoint:[theEvent locationInWindow] toView:self]; 113 | 114 | [self drawLineFromLastDotTo:pt]; 115 | 116 | NSView *touched = [self hitTest:pt2]; 117 | 118 | if ([touched isKindOfClass:[NSImageView class]]) 119 | { 120 | if (touched.tag <= 0) { 121 | return; 122 | } 123 | 124 | NSLog(@"touched view tag: %ld ", (long)touched.tag); 125 | 126 | BOOL found = NO; 127 | for (NSNumber *tag in _paths) { 128 | found = (tag.integerValue == touched.tag); 129 | 130 | if (found) 131 | break; 132 | } 133 | 134 | if (found) 135 | return; 136 | 137 | [_paths addObject:@(touched.tag)]; 138 | [self addDotView:touched]; 139 | 140 | NSImageView* iv = (NSImageView*)touched; 141 | 142 | [self setHighlighted:true imageView:iv]; 143 | } 144 | } 145 | 146 | 147 | - (void) mouseUp:(NSEvent *)theEvent 148 | { 149 | DBNSLog(@"mouseUp"); 150 | // clear up hilite 151 | DrawPatternLockView *v = (DrawPatternLockView*)self; 152 | [v clearDotViews]; 153 | 154 | for (NSImageView *view in self.subviews) 155 | if ([view isKindOfClass:[NSImageView class]]) 156 | [self setHighlighted:false imageView:view]; 157 | 158 | [self setNeedsDisplay:YES]; 159 | 160 | // pass the output to target action... 161 | if (_target && _action) 162 | [_target performSelector:_action withObject:[self getKey]]; 163 | 164 | _paths = nil; 165 | } 166 | 167 | // get key from the pattern drawn 168 | // replace this method with your own key-generation algorithm 169 | - (NSString*)getKey 170 | { 171 | NSMutableString *key; 172 | key = [NSMutableString string]; 173 | 174 | // simple way to generate a key 175 | for (NSNumber *tag in _paths) { 176 | [key appendFormat:@"%02ld", (long)tag.integerValue]; 177 | } 178 | 179 | return key; 180 | } 181 | 182 | 183 | - (void)setTarget:(id)target withAction:(SEL)action { 184 | _target = target; 185 | _action = action; 186 | } 187 | 188 | @end 189 | -------------------------------------------------------------------------------- /Source/Pattern/DrawPatternLockViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1080 5 | 12D78 6 | 3084 7 | 1187.37 8 | 626.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 3084 12 | 13 | 14 | NSCustomObject 15 | NSCustomView 16 | NSImageCell 17 | NSImageView 18 | 19 | 20 | com.apple.InterfaceBuilder.CocoaPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | NSObject 29 | 30 | 31 | FirstResponder 32 | 33 | 34 | NSApplication 35 | 36 | 37 | 38 | 268 39 | 40 | 41 | 42 | 268 43 | 44 | Apple PDF pasteboard type 45 | Apple PICT pasteboard type 46 | Apple PNG pasteboard type 47 | NSFilenamesPboardType 48 | NeXT Encapsulated PostScript v1.2 pasteboard type 49 | NeXT TIFF v4.0 pasteboard type 50 | 51 | {{172, 20}, {64, 64}} 52 | 53 | 54 | _NS:9 55 | 9 56 | YES 57 | 58 | 134217728 59 | 33554432 60 | 61 | NSImage 62 | dot_off 63 | 64 | _NS:9 65 | 0 66 | 0 67 | 0 68 | NO 69 | 70 | NO 71 | YES 72 | 73 | 74 | 75 | 268 76 | 77 | Apple PDF pasteboard type 78 | Apple PICT pasteboard type 79 | Apple PNG pasteboard type 80 | NSFilenamesPboardType 81 | NeXT Encapsulated PostScript v1.2 pasteboard type 82 | NeXT TIFF v4.0 pasteboard type 83 | 84 | {{100, 20}, {64, 64}} 85 | 86 | 87 | _NS:9 88 | 8 89 | YES 90 | 91 | 134217728 92 | 33554432 93 | 94 | _NS:9 95 | 0 96 | 0 97 | 0 98 | NO 99 | 100 | NO 101 | YES 102 | 103 | 104 | 105 | 268 106 | 107 | Apple PDF pasteboard type 108 | Apple PICT pasteboard type 109 | Apple PNG pasteboard type 110 | NSFilenamesPboardType 111 | NeXT Encapsulated PostScript v1.2 pasteboard type 112 | NeXT TIFF v4.0 pasteboard type 113 | 114 | {{23, 20}, {64, 64}} 115 | 116 | 117 | _NS:9 118 | 7 119 | YES 120 | 121 | 134217728 122 | 33554432 123 | 124 | _NS:9 125 | 0 126 | 0 127 | 0 128 | NO 129 | 130 | NO 131 | YES 132 | 133 | 134 | 135 | 268 136 | 137 | Apple PDF pasteboard type 138 | Apple PICT pasteboard type 139 | Apple PNG pasteboard type 140 | NSFilenamesPboardType 141 | NeXT Encapsulated PostScript v1.2 pasteboard type 142 | NeXT TIFF v4.0 pasteboard type 143 | 144 | {{169, 92}, {64, 64}} 145 | 146 | 147 | _NS:9 148 | 6 149 | YES 150 | 151 | 134217728 152 | 33554432 153 | 154 | _NS:9 155 | 0 156 | 0 157 | 0 158 | NO 159 | 160 | NO 161 | YES 162 | 163 | 164 | 165 | 268 166 | 167 | Apple PDF pasteboard type 168 | Apple PICT pasteboard type 169 | Apple PNG pasteboard type 170 | NSFilenamesPboardType 171 | NeXT Encapsulated PostScript v1.2 pasteboard type 172 | NeXT TIFF v4.0 pasteboard type 173 | 174 | {{97, 92}, {64, 64}} 175 | 176 | 177 | _NS:9 178 | 5 179 | YES 180 | 181 | 134217728 182 | 33554432 183 | 184 | _NS:9 185 | 0 186 | 0 187 | 0 188 | NO 189 | 190 | NO 191 | YES 192 | 193 | 194 | 195 | 268 196 | 197 | Apple PDF pasteboard type 198 | Apple PICT pasteboard type 199 | Apple PNG pasteboard type 200 | NSFilenamesPboardType 201 | NeXT Encapsulated PostScript v1.2 pasteboard type 202 | NeXT TIFF v4.0 pasteboard type 203 | 204 | {{20, 92}, {64, 64}} 205 | 206 | 207 | _NS:9 208 | 4 209 | YES 210 | 211 | 134217728 212 | 33554432 213 | 214 | _NS:9 215 | 0 216 | 0 217 | 0 218 | NO 219 | 220 | NO 221 | YES 222 | 223 | 224 | 225 | 268 226 | 227 | Apple PDF pasteboard type 228 | Apple PICT pasteboard type 229 | Apple PNG pasteboard type 230 | NSFilenamesPboardType 231 | NeXT Encapsulated PostScript v1.2 pasteboard type 232 | NeXT TIFF v4.0 pasteboard type 233 | 234 | {{169, 164}, {64, 64}} 235 | 236 | 237 | _NS:9 238 | 3 239 | YES 240 | 241 | 134217728 242 | 33554432 243 | 244 | _NS:9 245 | 0 246 | 0 247 | 0 248 | NO 249 | 250 | NO 251 | YES 252 | 253 | 254 | 255 | 268 256 | 257 | Apple PDF pasteboard type 258 | Apple PICT pasteboard type 259 | Apple PNG pasteboard type 260 | NSFilenamesPboardType 261 | NeXT Encapsulated PostScript v1.2 pasteboard type 262 | NeXT TIFF v4.0 pasteboard type 263 | 264 | {{97, 164}, {64, 64}} 265 | 266 | 267 | _NS:9 268 | 2 269 | YES 270 | 271 | 134217728 272 | 33554432 273 | 274 | _NS:9 275 | 0 276 | 0 277 | 0 278 | NO 279 | 280 | NO 281 | YES 282 | 283 | 284 | 285 | 268 286 | 287 | Apple PDF pasteboard type 288 | Apple PICT pasteboard type 289 | Apple PNG pasteboard type 290 | NSFilenamesPboardType 291 | NeXT Encapsulated PostScript v1.2 pasteboard type 292 | NeXT TIFF v4.0 pasteboard type 293 | 294 | {{20, 164}, {64, 64}} 295 | 296 | 297 | _NS:9 298 | 1 299 | YES 300 | 301 | 134217728 302 | 33554432 303 | 304 | _NS:9 305 | 0 306 | 0 307 | 0 308 | NO 309 | 310 | NO 311 | YES 312 | 313 | 314 | {256, 248} 315 | 316 | 317 | DrawPatternLockView 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 0 326 | 327 | 328 | 329 | 330 | 331 | -2 332 | 333 | 334 | File's Owner 335 | 336 | 337 | -1 338 | 339 | 340 | First Responder 341 | 342 | 343 | -3 344 | 345 | 346 | Application 347 | 348 | 349 | 1 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 8 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 9 374 | 375 | 376 | 377 | 378 | 21 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 22 387 | 388 | 389 | 390 | 391 | 27 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 28 400 | 401 | 402 | 403 | 404 | 33 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 34 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 35 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 36 429 | 430 | 431 | 432 | 433 | 37 434 | 435 | 436 | 437 | 438 | 38 439 | 440 | 441 | 442 | 443 | 50 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 51 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 52 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 53 468 | 469 | 470 | 471 | 472 | 54 473 | 474 | 475 | 476 | 477 | 55 478 | 479 | 480 | 481 | 482 | 483 | 484 | com.apple.InterfaceBuilder.CocoaPlugin 485 | com.apple.InterfaceBuilder.CocoaPlugin 486 | com.apple.InterfaceBuilder.CocoaPlugin 487 | com.apple.InterfaceBuilder.CocoaPlugin 488 | com.apple.InterfaceBuilder.CocoaPlugin 489 | com.apple.InterfaceBuilder.CocoaPlugin 490 | com.apple.InterfaceBuilder.CocoaPlugin 491 | com.apple.InterfaceBuilder.CocoaPlugin 492 | com.apple.InterfaceBuilder.CocoaPlugin 493 | com.apple.InterfaceBuilder.CocoaPlugin 494 | com.apple.InterfaceBuilder.CocoaPlugin 495 | com.apple.InterfaceBuilder.CocoaPlugin 496 | com.apple.InterfaceBuilder.CocoaPlugin 497 | com.apple.InterfaceBuilder.CocoaPlugin 498 | com.apple.InterfaceBuilder.CocoaPlugin 499 | com.apple.InterfaceBuilder.CocoaPlugin 500 | com.apple.InterfaceBuilder.CocoaPlugin 501 | com.apple.InterfaceBuilder.CocoaPlugin 502 | com.apple.InterfaceBuilder.CocoaPlugin 503 | com.apple.InterfaceBuilder.CocoaPlugin 504 | com.apple.InterfaceBuilder.CocoaPlugin 505 | com.apple.InterfaceBuilder.CocoaPlugin 506 | 507 | 508 | 509 | 510 | 511 | 75 512 | 513 | 514 | 0 515 | IBCocoaFramework 516 | YES 517 | 3 518 | 519 | dot_off 520 | {64, 64} 521 | 522 | 523 | 524 | -------------------------------------------------------------------------------- /Source/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'LockMeNow' target in the 'LockMeNow' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | 9 | #include "IGRUserDefaults.h" 10 | 11 | #ifdef DEBUG 12 | #define DBNSLog NSLog 13 | #else 14 | #define DBNSLog( s, ... ) 15 | #endif 16 | 17 | #define APP_SITE @"http://www.IGRSoft.com" 18 | #define TWITTER_SITE @"http://twitter.com/#!/iKorich" 19 | 20 | #define XPC_LOGER @"com.igrsoft.XPCLoger" 21 | #define XPC_SCRIPTING @"com.igrsoft.XPCScripting" 22 | #define XPC_SCRIPTING_BRIDGE @"com.igrsoft.XPCScriptingBridge" 23 | #define XPC_SCREEN @"com.igrsoft.XPCScreen" 24 | #define XPC_POWER @"com.igrsoft.XPCPower" 25 | #define XPC_PREFERENCES @"com.igrsoft.XPCPreferences" 26 | 27 | #define IGRNotificationScreenLocked @"IGRNotificationScreenLocked" 28 | #define IGRNotificationScreenUnLocked @"IGRNotificationScreenUnLocked" 29 | -------------------------------------------------------------------------------- /Source/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Lock Me Now 4 | // 5 | // Created by Vitaly Parovishnik on 20.07.11. 6 | // Copyright 2010 IGR Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | @autoreleasepool { 14 | 15 | int retVal = NSApplicationMain(argc, (const char **) argv); 16 | return retVal; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /XPC/XPCLoger/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | XPCLoger 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | XPCService 26 | 27 | ServiceType 28 | Application 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /XPC/XPCLoger/XPCLoger.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCLoger.h 3 | // XPCLoger 4 | // 5 | // Created by Vitalii Parovishnyk on 2/28/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCLogerProtocol.h" 11 | 12 | // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. 13 | @interface XPCLoger : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /XPC/XPCLoger/XPCLoger.m: -------------------------------------------------------------------------------- 1 | // 2 | // XPCLoger.m 3 | // XPCLoger 4 | // 5 | // Created by Vitalii Parovishnyk on 2/28/15. 6 | // 7 | // 8 | 9 | #import "XPCLoger.h" 10 | 11 | #define LOG_PATH @"/private/var/log/opendirectoryd.log" 12 | 13 | @interface XPCLoger () 14 | 15 | @property (nonatomic, strong) NSFileHandle *fileHandle; 16 | @property (nonatomic, strong) NSString *lastLine; 17 | @property (nonatomic, copy ) FoudWrongPasswordBlock foudWrongPasswordBlock; 18 | @property (nonatomic, strong) NSArray *modes; 19 | @property (nonatomic, assign) BOOL taskRuning; 20 | 21 | @end 22 | 23 | @implementation XPCLoger 24 | 25 | - (void)startCheckIncorrectPassword:(FoudWrongPasswordBlock __nonnull)replyBlock 26 | { 27 | self.foudWrongPasswordBlock = [replyBlock copy]; 28 | self.lastLine = nil; 29 | 30 | NSURL *filePath = [NSURL URLWithString:LOG_PATH]; 31 | NSError *error = nil; 32 | 33 | self.fileHandle = [NSFileHandle fileHandleForReadingFromURL:filePath error:&error]; 34 | 35 | if (!error) 36 | { 37 | self.taskRuning = YES; 38 | 39 | [[NSNotificationCenter defaultCenter] addObserver:self 40 | selector:@selector(handleChannelDataAvailable:) 41 | name:NSFileHandleDataAvailableNotification 42 | object:self.fileHandle]; 43 | 44 | self.modes = @[@"XPCLoger"]; 45 | [self.fileHandle waitForDataInBackgroundAndNotifyForModes:self.modes]; 46 | 47 | [self runCustomLoop]; 48 | } 49 | } 50 | 51 | - (void)stopCheckIncorrectPassword 52 | { 53 | self.taskRuning = NO; 54 | 55 | [[NSNotificationCenter defaultCenter] removeObserver:self 56 | name:NSFileHandleDataAvailableNotification 57 | object:self.fileHandle]; 58 | 59 | self.fileHandle = nil; 60 | self.lastLine = nil; 61 | self.foudWrongPasswordBlock = nil; 62 | } 63 | 64 | - (void)updateReplayBlock:(FoudWrongPasswordBlock __nonnull)replyBlock 65 | { 66 | self.foudWrongPasswordBlock = [replyBlock copy]; 67 | } 68 | 69 | - (void)handleChannelDataAvailable:(NSNotification*)notification 70 | { 71 | NSFileHandle *fileHandle = notification.object; 72 | 73 | NSString *str = [[NSString alloc] initWithData:fileHandle.availableData 74 | encoding:NSUTF8StringEncoding]; 75 | 76 | NSString *contentForSearch = @""; 77 | 78 | BOOL skipCheck = NO; 79 | if (!self.lastLine) 80 | { 81 | self.lastLine = [str copy]; 82 | skipCheck = YES; 83 | } 84 | 85 | NSRange newChunkRange = [str rangeOfString:self.lastLine]; 86 | 87 | if (newChunkRange.location != NSNotFound) 88 | { 89 | contentForSearch = [str substringFromIndex:newChunkRange.location + newChunkRange.length - 1]; 90 | } 91 | else 92 | { 93 | contentForSearch = [str copy]; 94 | } 95 | 96 | if (!skipCheck) 97 | { 98 | NSArray *lines = [contentForSearch componentsSeparatedByString:@"\n"]; 99 | 100 | [lines enumerateObjectsUsingBlock:^(NSString *line, NSUInteger idx, BOOL * _Nonnull stop) { 101 | NSRange range = [line rangeOfString:@"Client: loginwindow"]; 102 | if (range.location != NSNotFound) 103 | { 104 | NSString *nextLine = lines[MIN(idx + 1, lines.count - 1)]; 105 | range = [nextLine rangeOfString:@"ODRecordVerifyPassword failed with error 'Invalid credentials' (5000)"]; 106 | if (range.location != NSNotFound) 107 | { 108 | if (self.foudWrongPasswordBlock) 109 | { 110 | self.foudWrongPasswordBlock(); 111 | } 112 | 113 | *stop = YES; 114 | } 115 | } 116 | }]; 117 | } 118 | 119 | NSArray *components = [str componentsSeparatedByString: @"\n"]; 120 | 121 | if (components.count) 122 | { 123 | self.lastLine = components[components.count - 2]; 124 | } 125 | 126 | [self.fileHandle waitForDataInBackgroundAndNotifyForModes:self.modes]; 127 | } 128 | 129 | - (void)runCustomLoop 130 | { 131 | NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop]; 132 | [currentRunLoop runMode:[self.modes firstObject] beforeDate:[NSDate distantFuture]]; 133 | 134 | if (_taskRuning) 135 | { 136 | __weak typeof(self) weak = self; 137 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 138 | 139 | [weak runCustomLoop]; 140 | }); 141 | } 142 | } 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /XPC/XPCLoger/XPCLogerProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCLogerProtocol.h 3 | // XPCLoger 4 | // 5 | // Created by Vitalii Parovishnyk on 2/28/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | typedef void (^FoudWrongPasswordBlock)(void); 12 | 13 | @protocol XPCLogerProtocol 14 | 15 | - (void)startCheckIncorrectPassword:(FoudWrongPasswordBlock __nonnull)replyBlock; 16 | - (void)stopCheckIncorrectPassword; 17 | - (void)updateReplayBlock:(FoudWrongPasswordBlock __nonnull)replyBlock; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /XPC/XPCLoger/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XPCLoger 4 | // 5 | // Created by Vitalii Parovishnyk on 2/28/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCLoger.h" 11 | 12 | @interface ServiceDelegate : NSObject 13 | @end 14 | 15 | @implementation ServiceDelegate 16 | 17 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 18 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 19 | 20 | // Configure the connection. 21 | // First, set the interface that the exported object implements. 22 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCLogerProtocol)]; 23 | 24 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 25 | XPCLoger *exportedObject = [XPCLoger new]; 26 | newConnection.exportedObject = exportedObject; 27 | 28 | // Resuming the connection allows the system to deliver more incoming messages. 29 | [newConnection resume]; 30 | 31 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | // Create the delegate for the service. 40 | ServiceDelegate *delegate = [ServiceDelegate new]; 41 | 42 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 43 | NSXPCListener *listener = [NSXPCListener serviceListener]; 44 | listener.delegate = delegate; 45 | 46 | // Resuming the serviceListener starts this service. This method does not return. 47 | [listener resume]; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /XPC/XPCPower/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | XPCPower 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | XPCService 26 | 27 | ServiceType 28 | Application 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /XPC/XPCPower/XPCPower.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCPower.h 3 | // XPCPower 4 | // 5 | // Created by Vitalii Parovishnyk on 12/15/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCPowerProtocol.h" 11 | 12 | typedef NS_ENUM(NSUInteger, IGRPowerMode) 13 | { 14 | IGRPowerMode_None = 0, 15 | IGRPowerMode_ACPower, 16 | IGRPowerMode_Battery 17 | }; 18 | 19 | @interface XPCPower : NSObject 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /XPC/XPCPower/XPCPower.m: -------------------------------------------------------------------------------- 1 | // 2 | // XPCPower.m 3 | // XPCPower 4 | // 5 | // Created by Vitalii Parovishnyk on 12/15/15. 6 | // 7 | // 8 | 9 | #import "XPCPower.h" 10 | 11 | #import 12 | #import 13 | #import 14 | #import 15 | 16 | @interface XPCPower () 17 | { 18 | CFRunLoopRef _runLoop; 19 | CFRunLoopSourceRef _runLoopSource; 20 | } 21 | 22 | @property (nonatomic, copy) FoudChangesInPowerBlock foudChangesInPowerBlock; 23 | @property (nonatomic, assign) IGRPowerMode powerMode; 24 | @end 25 | 26 | @implementation XPCPower 27 | 28 | - (void)startCheckPower:(FoudChangesInPowerBlock __nonnull)replyBlock 29 | { 30 | self.foudChangesInPowerBlock = [replyBlock copy]; 31 | _powerMode = IGRPowerMode_None; 32 | 33 | [self runCustomLoop]; 34 | } 35 | 36 | - (void)stopCheckPower 37 | { 38 | self.foudChangesInPowerBlock = nil; 39 | 40 | if (_runLoopSource && _runLoop) 41 | { 42 | CFRunLoopRemoveSource(_runLoop,_runLoopSource,kCFRunLoopDefaultMode); 43 | } 44 | if (_runLoopSource) 45 | { 46 | CFRelease(_runLoopSource); 47 | } 48 | } 49 | 50 | - (void)updateReplayBlock:(FoudChangesInPowerBlock __nonnull)replyBlock 51 | { 52 | self.foudChangesInPowerBlock = [replyBlock copy]; 53 | } 54 | 55 | void IGRPowerMonitorCallback(void *context) 56 | { 57 | XPCPower* xpcPower = (__bridge XPCPower *)(context); 58 | 59 | CFTypeRef powerSource = IOPSCopyPowerSourcesInfo(); 60 | CFStringRef source = IOPSGetProvidingPowerSourceType(powerSource); 61 | if (source) 62 | { 63 | NSString *sSource = (__bridge NSString *)(source); 64 | 65 | BOOL isBatteryPower = [@"Battery Power" isEqualToString:sSource]; 66 | BOOL isACPower = [@"AC Power" isEqualToString:sSource]; 67 | 68 | if (xpcPower.powerMode == IGRPowerMode_None) 69 | { 70 | xpcPower.powerMode = isBatteryPower ? IGRPowerMode_Battery : IGRPowerMode_ACPower; 71 | } 72 | else if (isBatteryPower && xpcPower.powerMode == IGRPowerMode_ACPower) 73 | { 74 | xpcPower.powerMode = IGRPowerMode_Battery; 75 | if (xpcPower.foudChangesInPowerBlock) 76 | { 77 | xpcPower.foudChangesInPowerBlock(); 78 | } 79 | } 80 | else if (isACPower && xpcPower.powerMode == IGRPowerMode_Battery) 81 | { 82 | xpcPower.powerMode = IGRPowerMode_ACPower; 83 | } 84 | } 85 | 86 | CFRelease(powerSource); 87 | } 88 | 89 | - (void)runCustomLoop 90 | { 91 | _runLoop = CFRunLoopGetCurrent(); 92 | _runLoopSource = IOPSCreateLimitedPowerNotification(IGRPowerMonitorCallback, (__bridge void *)(self)); 93 | 94 | if (_runLoop && _runLoopSource) 95 | { 96 | CFRunLoopAddSource(_runLoop, _runLoopSource, kCFRunLoopDefaultMode); 97 | } 98 | 99 | IGRPowerMonitorCallback((__bridge void *)(self)); // get current power state 100 | 101 | CFRunLoopRun(); 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /XPC/XPCPower/XPCPowerProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCPowerProtocol.h 3 | // XPCPower 4 | // 5 | // Created by Vitalii Parovishnyk on 12/15/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | typedef void (^FoudChangesInPowerBlock)(void); 12 | 13 | @protocol XPCPowerProtocol 14 | 15 | - (void)startCheckPower:(FoudChangesInPowerBlock __nonnull)replyBlock; 16 | - (void)stopCheckPower; 17 | - (void)updateReplayBlock:(FoudChangesInPowerBlock __nonnull)replyBlock; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /XPC/XPCPower/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XPCPower 4 | // 5 | // Created by Vitalii Parovishnyk on 12/15/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCPower.h" 11 | 12 | @interface ServiceDelegate : NSObject 13 | @end 14 | 15 | @implementation ServiceDelegate 16 | 17 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 18 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 19 | 20 | // Configure the connection. 21 | // First, set the interface that the exported object implements. 22 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCPowerProtocol)]; 23 | 24 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 25 | XPCPower *exportedObject = [XPCPower new]; 26 | newConnection.exportedObject = exportedObject; 27 | 28 | // Resuming the connection allows the system to deliver more incoming messages. 29 | [newConnection resume]; 30 | 31 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | // Create the delegate for the service. 40 | ServiceDelegate *delegate = [ServiceDelegate new]; 41 | 42 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 43 | NSXPCListener *listener = [NSXPCListener serviceListener]; 44 | listener.delegate = delegate; 45 | 46 | // Resuming the serviceListener starts this service. This method does not return. 47 | [listener resume]; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /XPC/XPCPreferences/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | XPCPreferences 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | NSHumanReadableCopyright 24 | Copyright © 2017 IGR Soft. All rights reserved. 25 | XPCService 26 | 27 | ServiceType 28 | Application 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /XPC/XPCPreferences/XPCPreferences.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCPreferences.h 3 | // XPCPreferences 4 | // 5 | // Created by Vitalii Parovishnyk on 1/26/17. 6 | // Copyright © 2017 IGR Soft. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XPCPreferencesProtocol.h" 11 | 12 | // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. 13 | @interface XPCPreferences : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /XPC/XPCPreferences/XPCPreferences.m: -------------------------------------------------------------------------------- 1 | // 2 | // XPCPreferences.m 3 | // XPCPreferences 4 | // 5 | // Created by Vitalii Parovishnyk on 1/26/17. 6 | // Copyright © 2017 IGR Soft. All rights reserved. 7 | // 8 | 9 | #import "XPCPreferences.h" 10 | #import 11 | 12 | @implementation XPCPreferences 13 | 14 | - (void)preferencesAskPassword:(XPCPreferencesAskPasswordBlock __nonnull)replyBlock 15 | { 16 | BOOL isPassword = (BOOL)CFPreferencesGetAppBooleanValue(CFSTR(kAskForPassword), 17 | CFSTR(kSeviceName), 18 | nil); 19 | 20 | replyBlock(isPassword); 21 | } 22 | 23 | - (void)setPreferencesAskPassword:(BOOL)askPassword replyBlock:(XPCPreferencesReplayBlock __nonnull)replyBlock 24 | { 25 | CFPreferencesSetValue(CFSTR(kAskForPassword), (__bridge CFPropertyListRef) @(askPassword), 26 | CFSTR(kSeviceName), 27 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 28 | 29 | BOOL success = CFPreferencesSynchronize(CFSTR(kSeviceName), kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 30 | 31 | replyBlock(success); 32 | } 33 | 34 | - (void)preferencesPasswordDelay:(XPCPreferencesPasswordDelayBlock __nonnull)replyBlock 35 | { 36 | NSNumber *passwordDelay = @(CFPreferencesGetAppIntegerValue(CFSTR(kAskForPasswordDelay), 37 | CFSTR(kSeviceName), 38 | nil)); 39 | 40 | replyBlock(passwordDelay); 41 | } 42 | 43 | - (void)setPreferencesPasswordDelay:(NSNumber *)passwordDelay replyBlock:(XPCPreferencesReplayBlock __nonnull)replyBlock 44 | { 45 | CFPreferencesSetValue(CFSTR(kAskForPasswordDelay), (__bridge CFPropertyListRef) passwordDelay, 46 | CFSTR(kSeviceName), 47 | kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 48 | 49 | BOOL success = CFPreferencesSynchronize(CFSTR(kSeviceName), kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); 50 | 51 | replyBlock(success); 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /XPC/XPCPreferences/XPCPreferencesProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCPreferencesProtocol.h 3 | // XPCPreferences 4 | // 5 | // Created by Vitalii Parovishnyk on 1/26/17. 6 | // Copyright © 2017 IGR Soft. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kSeviceName "com.apple.screensaver" 12 | 13 | #define kAskForPassword "askForPassword" 14 | #define kAskForPasswordDelay "askForPasswordDelay" 15 | 16 | typedef void (^XPCPreferencesReplayBlock)(BOOL); 17 | typedef void (^XPCPreferencesAskPasswordBlock)(BOOL); 18 | typedef void (^XPCPreferencesPasswordDelayBlock)(NSNumber * __nonnull); 19 | 20 | @protocol XPCPreferencesProtocol 21 | 22 | - (void)preferencesAskPassword:(XPCPreferencesAskPasswordBlock __nonnull)replyBlock; 23 | - (void)setPreferencesAskPassword:(BOOL)askPassword 24 | replyBlock:(XPCPreferencesReplayBlock __nonnull)replyBlock; 25 | 26 | - (void)preferencesPasswordDelay:(XPCPreferencesPasswordDelayBlock __nonnull)replyBlock; 27 | - (void)setPreferencesPasswordDelay:(NSNumber * __nonnull)passwordDelay 28 | replyBlock:(XPCPreferencesReplayBlock __nonnull)replyBlock; 29 | 30 | @end 31 | 32 | -------------------------------------------------------------------------------- /XPC/XPCPreferences/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XPCPreferences 4 | // 5 | // Created by Vitalii Parovishnyk on 1/26/17. 6 | // Copyright © 2017 IGR Soft. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XPCPreferences.h" 11 | 12 | @interface ServiceDelegate : NSObject 13 | @end 14 | 15 | @implementation ServiceDelegate 16 | 17 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 18 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 19 | 20 | // Configure the connection. 21 | // First, set the interface that the exported object implements. 22 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCPreferencesProtocol)]; 23 | 24 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 25 | XPCPreferences *exportedObject = [XPCPreferences new]; 26 | newConnection.exportedObject = exportedObject; 27 | 28 | // Resuming the connection allows the system to deliver more incoming messages. 29 | [newConnection resume]; 30 | 31 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | // Create the delegate for the service. 40 | ServiceDelegate *delegate = [ServiceDelegate new]; 41 | 42 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 43 | NSXPCListener *listener = [NSXPCListener serviceListener]; 44 | listener.delegate = delegate; 45 | 46 | // Resuming the serviceListener starts this service. This method does not return. 47 | [listener resume]; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /XPC/XPCScreen/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | XPCScreen 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | XPCService 26 | 27 | RunLoopType 28 | NSRunLoop 29 | ServiceType 30 | Application 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /XPC/XPCScreen/XPCScreen.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScreen.h 3 | // XPCScreen 4 | // 5 | // Created by Vitalii Parovishnyk on 3/1/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCScreenProtocol.h" 11 | 12 | // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. 13 | @interface XPCScreen : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /XPC/XPCScreen/XPCScreen.m: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScreen.m 3 | // XPCScreen 4 | // 5 | // Created by Vitalii Parovishnyk on 3/1/15. 6 | // 7 | // 8 | 9 | #import "XPCScreen.h" 10 | 11 | @interface XPCScreen () 12 | 13 | @property (nonatomic, copy) DetectedUnlockBlock detectedUnlockBlock; 14 | 15 | @end 16 | 17 | @implementation XPCScreen 18 | 19 | - (void)startListenScreenUnlock:(DetectedUnlockBlock __nonnull)replyBlock 20 | { 21 | self.detectedUnlockBlock = [replyBlock copy]; 22 | 23 | NSDistributedNotificationCenter* distCenter = [NSDistributedNotificationCenter defaultCenter]; 24 | [distCenter addObserver:self 25 | selector:@selector(screenIsLocked:) 26 | name:@"IGRNotificationScreenLocked" 27 | object:nil]; 28 | 29 | [distCenter addObserver:self 30 | selector:@selector(screenIsUnlocked:) 31 | name:@"IGRNotificationScreenUnLocked" 32 | object:nil]; 33 | } 34 | 35 | - (void)stopListenScreenUnlock 36 | { 37 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 38 | } 39 | 40 | #pragma mark - NSDistributedNotificationCenter 41 | 42 | - (void)screenIsLocked:(NSNotification *)aNotification 43 | { 44 | NSLog(@"Screen Lock"); 45 | } 46 | 47 | - (void)screenIsUnlocked:(NSNotification *)aNotification 48 | { 49 | NSLog(@"Screen Unlock"); 50 | 51 | [self stopListenScreenUnlock]; 52 | 53 | if (self.detectedUnlockBlock) 54 | { 55 | self.detectedUnlockBlock(); 56 | } 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /XPC/XPCScreen/XPCScreenProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScreenProtocol.h 3 | // XPCScreen 4 | // 5 | // Created by Vitalii Parovishnyk on 3/1/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | typedef void (^DetectedUnlockBlock)(void); 12 | 13 | @protocol XPCScreenProtocol 14 | 15 | - (void)startListenScreenUnlock:(DetectedUnlockBlock __nonnull)reply; 16 | - (void)stopListenScreenUnlock; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /XPC/XPCScreen/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XPCScreen 4 | // 5 | // Created by Vitalii Parovishnyk on 3/1/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCScreen.h" 11 | 12 | @interface ServiceDelegate : NSObject 13 | @end 14 | 15 | @implementation ServiceDelegate 16 | 17 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 18 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 19 | 20 | // Configure the connection. 21 | // First, set the interface that the exported object implements. 22 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCScreenProtocol)]; 23 | 24 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 25 | XPCScreen *exportedObject = [XPCScreen new]; 26 | newConnection.exportedObject = exportedObject; 27 | 28 | // Resuming the connection allows the system to deliver more incoming messages. 29 | [newConnection resume]; 30 | 31 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | // Create the delegate for the service. 40 | ServiceDelegate *delegate = [ServiceDelegate new]; 41 | 42 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 43 | NSXPCListener *listener = [NSXPCListener serviceListener]; 44 | listener.delegate = delegate; 45 | 46 | // Resuming the serviceListener starts this service. This method does not return. 47 | [listener resume]; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /XPC/XPCScripting/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | XPCScripting 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | XPCService 26 | 27 | ServiceType 28 | Application 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /XPC/XPCScripting/XPCScripting.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScripting.h 3 | // XPCScripting 4 | // 5 | // Created by Vitalii Parovishnyk on 2/27/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCScriptingProtocol.h" 11 | 12 | // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. 13 | @interface XPCScripting : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /XPC/XPCScripting/XPCScripting.m: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScripting.m 3 | // XPCScripting 4 | // 5 | // Created by Vitalii Parovishnyk on 2/27/15. 6 | // 7 | // 8 | 9 | #import "XPCScripting.h" 10 | 11 | @implementation XPCScripting 12 | 13 | - (void)makeLoginWindowLock 14 | { 15 | NSTask *task; 16 | NSMutableArray *arguments = [NSMutableArray arrayWithObject:@"-suspend"]; 17 | 18 | task = [[NSTask alloc] init]; 19 | [task setArguments: arguments]; 20 | [task setLaunchPath: @"/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession"]; 21 | [task launch]; 22 | } 23 | 24 | - (void)makeJustLock:(BOOL)useCurrentScrrenSaver scriptPath:(NSString *)scriptPath 25 | { 26 | BOOL runnedCurrentScreenSaver = NO; 27 | if (useCurrentScrrenSaver) 28 | { 29 | NSDictionary *error = nil; 30 | NSURL *path = [NSURL fileURLWithPath:scriptPath]; 31 | NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:path 32 | error:&error]; 33 | if (!error.count) 34 | { 35 | [appleScript executeAndReturnError:&error]; 36 | } 37 | 38 | runnedCurrentScreenSaver = (error.count == 0); 39 | } 40 | 41 | if (!runnedCurrentScreenSaver) 42 | { 43 | io_registry_entry_t r = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler"); 44 | if(!r) return; 45 | IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"), kCFBooleanTrue); 46 | IOObjectRelease(r); 47 | } 48 | } 49 | 50 | - (void)makeJustUnLock 51 | { 52 | io_registry_entry_t r = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler"); 53 | if(!r) return; 54 | IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"), kCFBooleanFalse); 55 | IOObjectRelease(r); 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /XPC/XPCScripting/XPCScriptingProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScriptingProtocol.h 3 | // XPCScripting 4 | // 5 | // Created by Vitalii Parovishnyk on 2/27/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | // The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service. 12 | @protocol XPCScriptingProtocol 13 | 14 | - (void)makeLoginWindowLock; 15 | 16 | - (void)makeJustLock:(BOOL)useCurrentScrrenSaver scriptPath:(NSString *)scriptPath; 17 | - (void)makeJustUnLock; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /XPC/XPCScripting/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XPCScripting 4 | // 5 | // Created by Vitalii Parovishnyk on 2/27/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCScripting.h" 11 | 12 | @interface ServiceDelegate : NSObject 13 | @end 14 | 15 | @implementation ServiceDelegate 16 | 17 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 18 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 19 | 20 | // Configure the connection. 21 | // First, set the interface that the exported object implements. 22 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCScriptingProtocol)]; 23 | 24 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 25 | XPCScripting *exportedObject = [XPCScripting new]; 26 | newConnection.exportedObject = exportedObject; 27 | 28 | // Resuming the connection allows the system to deliver more incoming messages. 29 | [newConnection resume]; 30 | 31 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | // Create the delegate for the service. 40 | ServiceDelegate *delegate = [ServiceDelegate new]; 41 | 42 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 43 | NSXPCListener *listener = [NSXPCListener serviceListener]; 44 | listener.delegate = delegate; 45 | 46 | // Resuming the serviceListener starts this service. This method does not return. 47 | [listener resume]; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /XPC/XPCScriptingBridge/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | XPCScriptingBridge 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | XPCService 26 | 27 | ServiceType 28 | Application 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /XPC/XPCScriptingBridge/XPCScriptingBridge.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScriptingBridge.h 3 | // XPCScriptingBridge 4 | // 5 | // Created by Vitalii Parovishnyk on 3/3/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCScriptingBridgeProtocol.h" 11 | 12 | // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. 13 | @interface XPCScriptingBridge : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /XPC/XPCScriptingBridge/XPCScriptingBridge.m: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScriptingBridge.m 3 | // XPCScriptingBridge 4 | // 5 | // Created by Vitalii Parovishnyk on 3/3/15. 6 | // 7 | // 8 | 9 | #import "XPCScriptingBridge.h" 10 | #import 11 | #import "iTunes.h" 12 | 13 | #import "Mail.h" 14 | 15 | @interface XPCScriptingBridge () 16 | 17 | @property (nonatomic, copy) NSMutableArray *photoPaths; 18 | @property (nonatomic, copy) NSString *mailAddres; 19 | @property (nonatomic) NSString *messageContent; 20 | @property (nonatomic) NSUInteger actionType; 21 | 22 | @end 23 | 24 | @implementation XPCScriptingBridge 25 | 26 | static NSString * const kiTunesID = @"com.apple.iTunes"; 27 | static NSString * const kPasswordDefaultText = @"Someone has entered an incorrect password\n\n"; 28 | static NSString * const kMagSafeDefaultText = @"Someone has unpluged MagSafe!\n\n"; 29 | 30 | #pragma mark - iTunes 31 | 32 | - (BOOL)isItunesRuning 33 | { 34 | iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:kiTunesID]; 35 | 36 | return iTunes.isRunning; 37 | } 38 | 39 | - (void)isMusicPlaingWithReply:(void (^ _Nonnull)(BOOL))reply 40 | { 41 | if (![self isItunesRuning]) 42 | { 43 | reply(NO); 44 | 45 | return; 46 | } 47 | 48 | iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:kiTunesID]; 49 | 50 | reply([iTunes playerState] == iTunesEPlSPlaying); 51 | } 52 | 53 | - (void)isMusicPausedWithReply:(void (^ _Nonnull)(BOOL))reply 54 | { 55 | if (![self isItunesRuning]) 56 | { 57 | reply(NO); 58 | 59 | return; 60 | } 61 | 62 | iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:kiTunesID]; 63 | 64 | reply([iTunes playerState] == iTunesEPlSPaused || [iTunes playerState] == iTunesEPlSStopped); 65 | } 66 | 67 | - (void)playPauseMusic 68 | { 69 | if (![self isItunesRuning]) 70 | { 71 | return; 72 | } 73 | 74 | iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:kiTunesID]; 75 | [iTunes playpause]; 76 | } 77 | 78 | #pragma mark - Mail 79 | 80 | - (void)setupMailAddres:(NSString * _Nonnull)aMail userPhoto:(NSString * _Nullable)photoPath type:(NSUInteger)type 81 | { 82 | _mailAddres = aMail; 83 | _photoPaths = photoPath ? [NSMutableArray arrayWithObject:photoPath] : nil; 84 | _actionType = type; 85 | } 86 | 87 | - (void)sendDefaultMessageAddLocation:(NSString * _Nullable)aLocation 88 | { 89 | self.messageContent = self.actionType == 0 ? kPasswordDefaultText : kMagSafeDefaultText; 90 | if (aLocation) 91 | { 92 | self.messageContent = [self.messageContent stringByAppendingFormat:@"Location: %@\n\n", aLocation]; 93 | } 94 | 95 | [self sendMail]; 96 | } 97 | 98 | - (void)sendMail 99 | { 100 | /* create a Scripting Bridge object for talking to the Mail application */ 101 | MailApplication *mail = [SBApplication applicationWithBundleIdentifier:@"com.apple.Mail"]; 102 | 103 | /* update message */ 104 | NSDateFormatter *formatter; 105 | NSString *dateString; 106 | 107 | formatter = [[NSDateFormatter alloc] init]; 108 | [formatter setDateFormat:@"dd/MM/yyyy HH:mm:ss"]; 109 | 110 | dateString = [formatter stringFromDate:[NSDate date]]; 111 | 112 | _messageContent = [_messageContent stringByAppendingFormat:@"Time: %@\n\n", dateString]; 113 | 114 | _messageContent = [_messageContent stringByAppendingString:@"--\n"]; 115 | _messageContent = [_messageContent stringByAppendingString:@"Lock Me Now\n"]; 116 | _messageContent = [_messageContent stringByAppendingFormat:@"%@\n\n", @"http://www.IGRSoft.com"]; 117 | 118 | /* create a new outgoing message object */ 119 | MailOutgoingMessage *emailMessage = [[NSClassFromString(@"MailOutgoingMessage") alloc] initWithProperties: 120 | @{@"subject": @"Lock Me Now Security Warning", 121 | @"content" : _messageContent}]; 122 | 123 | /* add the object to the mail app */ 124 | [[mail outgoingMessages] addObject: emailMessage]; 125 | 126 | /* set the sender, show the message */ 127 | emailMessage.visible = NO; 128 | 129 | /* Test for errors */ 130 | if ( [mail lastError] != nil ) 131 | return; 132 | 133 | /* create a new recipient and add it to the recipients list */ 134 | MailToRecipient *theRecipient = [[NSClassFromString(@"MailToRecipient") alloc] initWithProperties: 135 | @{@"address": _mailAddres}]; 136 | [emailMessage.toRecipients addObject: theRecipient]; 137 | 138 | /* Test for errors */ 139 | if ( [mail lastError] != nil ) 140 | return; 141 | 142 | /* add an attachment, if one was specified */ 143 | for (NSString *attachmentFilePath in _photoPaths) 144 | { 145 | MailAttachment *theAttachment = [[NSClassFromString(@"MailAttachment") alloc] initWithProperties: 146 | @{@"fileName": [NSURL URLWithString:attachmentFilePath]}]; 147 | 148 | /* add it to the list of attachments */ 149 | [[emailMessage.content attachments] addObject:theAttachment]; 150 | } 151 | 152 | sleep(1); //Need wait 1 sec for 10.11 153 | 154 | /* Test for errors */ 155 | if ( [mail lastError] != nil ) 156 | return; 157 | 158 | /* send the message */ 159 | [emailMessage send]; 160 | } 161 | 162 | @end 163 | -------------------------------------------------------------------------------- /XPC/XPCScriptingBridge/XPCScriptingBridgeProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XPCScriptingBridgeProtocol.h 3 | // XPCScriptingBridge 4 | // 5 | // Created by Vitalii Parovishnyk on 3/3/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | // The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service. 12 | @protocol XPCScriptingBridgeProtocol 13 | 14 | #pragma mark - iTunes 15 | 16 | - (void)isMusicPlaingWithReply:(void (^ _Nonnull)(BOOL))reply; 17 | - (void)isMusicPausedWithReply:(void (^ _Nonnull)(BOOL))reply; 18 | - (void)playPauseMusic; 19 | 20 | #pragma mark - Mail 21 | 22 | - (void)setupMailAddres:(NSString * _Nonnull)aMail userPhoto:(NSString * _Nullable)photoPath type:(NSUInteger)type; 23 | - (void)sendDefaultMessageAddLocation:(NSString * _Nullable)aLocation; 24 | 25 | @end 26 | 27 | /* 28 | To use the service from an application or other process, use NSXPCConnection to establish a connection to the service by doing something like this: 29 | 30 | _connectionToService = [[NSXPCConnection alloc] initWithServiceName:@"XPCScriptingBridge"]; 31 | _connectionToService.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(StringModifing)]; 32 | [_connectionToService resume]; 33 | 34 | Once you have a connection to the service, you can use it like this: 35 | 36 | [[_connectionToService remoteObjectProxy] upperCaseString:@"hello" withReply:^(NSString *aString) { 37 | // We have received a response. Update our text field, but do it on the main thread. 38 | NSLog(@"Result string was: %@", aString); 39 | }]; 40 | 41 | And, when you are finished with the service, clean up the connection like this: 42 | 43 | [_connectionToService invalidate]; 44 | */ 45 | -------------------------------------------------------------------------------- /XPC/XPCScriptingBridge/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XPCScriptingBridge 4 | // 5 | // Created by Vitalii Parovishnyk on 3/3/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "XPCScriptingBridge.h" 11 | 12 | @interface ServiceDelegate : NSObject 13 | @end 14 | 15 | @implementation ServiceDelegate 16 | 17 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 18 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 19 | 20 | // Configure the connection. 21 | // First, set the interface that the exported object implements. 22 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCScriptingBridgeProtocol)]; 23 | 24 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 25 | XPCScriptingBridge *exportedObject = [XPCScriptingBridge new]; 26 | newConnection.exportedObject = exportedObject; 27 | 28 | // Resuming the connection allows the system to deliver more incoming messages. 29 | [newConnection resume]; 30 | 31 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | // Create the delegate for the service. 40 | ServiceDelegate *delegate = [ServiceDelegate new]; 41 | 42 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 43 | NSXPCListener *listener = [NSXPCListener serviceListener]; 44 | listener.delegate = delegate; 45 | 46 | // Resuming the serviceListener starts this service. This method does not return. 47 | [listener resume]; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /img/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/img/menu.png -------------------------------------------------------------------------------- /img/prefs_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/img/prefs_bluetooth.png -------------------------------------------------------------------------------- /img/prefs_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/img/prefs_main.png -------------------------------------------------------------------------------- /img/prefs_security.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/img/prefs_security.png -------------------------------------------------------------------------------- /img/prefs_usb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IGRSoft/LockMeNow/07aed331deb5c42189d5dc2e22b89975f6f8fbc0/img/prefs_usb.png -------------------------------------------------------------------------------- /keys/dsa_pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBtjCCASsGByqGSM44BAEwggEeAoGBAIaOmmrd10k/3X+ykt/ekBoCOGvNKV1I 3 | Elu3mbj47hdYsOqs+IZq8A2qmMTUK5VtT2E76p4cIQLuetPhawDiJ+8FlcQBu8Yx 4 | AqNXBQFnMw2xtTqF5qO/FPhOuq74g1jkWr5+q3+Mj364EabWxOmzHDRGOOfZG9bx 5 | lU/sP2C7mu3rAhUAj5mc+HPnNl/7UxtgvtZvULipgIcCgYBDJS0u0Lc+0mBsNPWZ 6 | SP9m/Wh0JPcCoyCnXz/HEzNDEh55U7/HhuIPMVJ9Y3zQnrfA3CGemb1x3QeS9Jhl 7 | cEY0XELODwnAZRnEWElF1ZEfE8Oo1Itxgdwst6jMA8iZ/1qUeZJqUQCOQ7DME/aN 8 | PtyVufrLP1OYEwh7SFdedOkVtwOBhAACgYBPN1NcSkMmhxZT+eSFSDf10IASIYh8 9 | eu+liJjIsk1Fw8+rOCBSQ7jniVzgvo38OBGM7oQ3DvKmpltFzlLsR3pC0q1ZWmPn 10 | 1tNuqDlw5pLzivAT9OCUH7EfVxt6sPsAVu9cHWsneaWPTePXHkYWvt9Gb1m65Zxa 11 | whbme5dsoWvcXQ== 12 | -----END PUBLIC KEY----- 13 | -------------------------------------------------------------------------------- /keys/generate_info.command: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o errexit 3 | 4 | ABSOLUTE_PATH=$(cd ${0%/*} && pwd -P) 5 | 6 | APPLICATION_NAME="LockMeNow" 7 | DOWNLOAD_BASE_URL="http://downloads.igrsoft.com/lockmenow/" 8 | RELEASENOTES_BASE_URL="http://igrsoft.com/wp-content/lockmenow/info" 9 | 10 | VERSION=$(/usr/libexec/plistbuddy -c Print:CFBundleShortVersionString: "$APPLICATION_NAME".app/Contents/Info.plist) 11 | VERSION_SHORT=$(/usr/libexec/plistbuddy -c Print:CFBundleVersion: "$APPLICATION_NAME".app/Contents/Info.plist) 12 | 13 | UNDERSCORE="_" 14 | ARCHIVE_FILENAME="$APPLICATION_NAME$UNDERSCORE$VERSION_SHORT.zip" 15 | DOWNLOAD_URL="$DOWNLOAD_BASE_URL$ARCHIVE_FILENAME" 16 | RELEASENOTES_URL="$RELEASENOTES_BASE_URL$UNDERSCORE$VERSION_SHORT.html" 17 | 18 | WD=$PWD 19 | rm -f "$ABSOLUTE_PATH/$ARCHIVE_FILENAME" 20 | ditto -ck --keepParent "$ABSOLUTE_PATH/$APPLICATION_NAME.app" "$ABSOLUTE_PATH/$ARCHIVE_FILENAME" 21 | BUILD=$(git rev-parse HEAD) 22 | SIZE=$(stat -f %z "$ABSOLUTE_PATH/$ARCHIVE_FILENAME") 23 | PUBDATE=$(date +"%a, %d %b %G %T %z") 24 | 25 | SIGNATURE=$(ruby "$ABSOLUTE_PATH/sign_update.rb" "$ABSOLUTE_PATH/$ARCHIVE_FILENAME" "$ABSOLUTE_PATH/dsa_priv.pem") 26 | 27 | clear 28 | 29 | cat < 31 | Version $VERSION, Build $BUILD 32 | $VERSION 33 | $RELEASENOTES_URL 34 | $PUBDATE 35 | 36 | 37 | EOF -------------------------------------------------------------------------------- /keys/generate_keys.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | ["dsaparam.pem", "dsa_priv.pem", "dsa_pub.pem"].each do |file| 3 | if File.exist? file 4 | puts "There's already a #{file} here! Move it aside or be more careful!" 5 | exit 6 | end 7 | end 8 | openssl = "/usr/bin/openssl" 9 | `#{openssl} dsaparam 1024 < /dev/urandom > dsaparam.pem` 10 | `#{openssl} gendsa dsaparam.pem -out dsa_priv.pem` 11 | `#{openssl} dsa -in dsa_priv.pem -pubout -out dsa_pub.pem` 12 | `rm dsaparam.pem` 13 | puts "\nGenerated private and public keys: dsa_priv.pem and dsa_pub.pem.\n 14 | BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!\n 15 | If you lose it, your users will be unable to upgrade!\n" 16 | -------------------------------------------------------------------------------- /keys/info_122.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.2.2 Version 6 | 7 | 8 |

Whats new in v1.2.2:

9 |
    10 |
  • Added photo quality option.
  • 11 |
  • Added Updater.
  • 12 |
13 |
14 | Thanks!
15 | IGR Software
16 | Korich
17 | 18 | -------------------------------------------------------------------------------- /keys/info_130.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.3.0 Version 6 | 7 | 8 |

Whats new in v1.3.0:

9 |
    10 |
  • Added Alert on Unplug MagSafe;
  • 11 |
  • Fixed send photo via Email;
  • 12 |
  • Updated a list of USB devices.
  • 13 |
14 |
15 | Thanks!
16 | IGR Software
17 | Korich
18 | 19 | -------------------------------------------------------------------------------- /keys/info_131.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.3.1 Version 6 | 7 | 8 |

Whats new in v1.3.1:

9 |
    10 |
  • http -> https.
  • 11 |
12 |
13 | Thanks!
14 | IGR Software
15 | Korich
16 | 17 | -------------------------------------------------------------------------------- /keys/info_132.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.3.2 Version 6 | 7 | 8 |

Whats new in v1.3.2:

9 |
    10 |
  • Minor fixes.
  • 11 |
12 |
13 | Thanks!
14 | IGR Software
15 | Korich
16 | 17 | -------------------------------------------------------------------------------- /keys/info_133.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.3.3 Version 6 | 7 | 8 |

Whats new in v1.3.3:

9 |
    10 |
  • Fixed iTunes launch,
  • 11 |
  • Fixed current screensaver launch.
  • 12 |
  • Updated Signed Certificate.
  • 13 |
14 |
15 | Download manually 16 |
17 |
18 |
19 | Thanks!
20 | IGR Software
21 | Korich
22 | 23 | -------------------------------------------------------------------------------- /keys/info_134.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.3.4 Version 6 | 7 | 8 |

Whats new in v1.3.4:

9 |
    10 |
  • Fixed app launch on macOS 10.12,
  • 11 |
12 |
13 |

Known Issues:

14 |
    15 |
  • Not work a wrong password detector on macOS 10.12,
  • 16 |
17 |
18 | Download manually 19 |
20 |
21 |
22 | Thanks!
23 | IGR Software
24 | Korich
25 | 26 | 27 | -------------------------------------------------------------------------------- /keys/info_140.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.4.0 Version 6 | 7 | 8 |

Whats new in v1.4.0:

9 |
    10 |
  • Fixed Security for macOS 10.12,
  • 11 |
  • Improved USB Lock,
  • 12 |
  • Improved Bluetooth Lock,
  • 13 |
  • Enabled Sandbox.
  • 14 |
15 |
16 | Download manually 17 |
18 |
19 |
20 | Thanks!
21 | IGR Software
22 | Korich
23 | 24 | 25 | -------------------------------------------------------------------------------- /keys/info_141.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.4.1 Version 6 | 7 | 8 |

Whats new in v1.4.1:

9 |
    10 |
  • Returned a Login Window lock,
  • 11 |
  • Disabled Sandbox.
  • 12 |
13 |
14 | Download manually 15 |
16 |
17 |
18 | Thanks!
19 | IGR Software
20 | Korich
21 | 22 | 23 | -------------------------------------------------------------------------------- /keys/sign_update.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | if ARGV.length < 2 3 | puts "Usage: ruby sign_update.rb update_archive private_key" 4 | exit 5 | end 6 | openssl = "/usr/bin/openssl" 7 | puts `#{openssl} dgst -sha1 -binary < "#{ARGV[0]}" | openssl dgst -dss1 -sign "#{ARGV[1]}" | openssl enc -base64` -------------------------------------------------------------------------------- /keys/update.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lock Me Now Changelog 5 | en 6 | 7 | Version 1.2.2, Build d1e18ed311812d2c5c269f31016e8a2abac21351 8 | 1.2.2 9 | http://igrsoft.com/wp-content/lockmenow/info_122.html 10 | Fri, 11 Dec 2015 17:26:43 +0200 11 | 12 | 13 | 14 | Version 1.3.0, Build 2869d11d4043281bca01f3ad1096da12cd97fc46 15 | 1.3.0 16 | http://igrsoft.com/wp-content/lockmenow/info_130.html 17 | Thu, 31 Dec 2015 11:16:28 +0200 18 | 19 | 20 | 21 | Version 1.3.1, Build be48840610adc4eaff8e57f4324aa850ddf7d665 22 | 1.3.1 23 | http://igrsoft.com/wp-content/lockmenow/info_131.html 24 | Tue, 09 Feb 2016 14:43:51 +0200 25 | 26 | 27 | 28 | Version 1.3.2, Build 0566ceef00b5ebb50e7cc8e25884a66edc782110 29 | 1.3.2 30 | http://igrsoft.com/wp-content/lockmenow/info_132.html 31 | Tue, 26 Apr 2016 12:09:34 +0300 32 | 33 | 34 | 35 | Version 1.3.3, Build 1877d53d6aa75d791d7c9144b7c697e35b41af6e 36 | 1.3.3 37 | http://igrsoft.com/wp-content/lockmenow/info_133.html 38 | Fri, 29 Jul 2016 13:02:56 +0300 39 | 40 | 41 | 42 | Version 1.3.4, Build 3a354aa3217d97b38a9a7d007537f25740023f1f 43 | 1.3.4 44 | http://igrsoft.com/wp-content/lockmenow/info_134.html 45 | Thu, 06 Oct 2016 15:09:08 +0300 46 | 47 | 48 | 49 | Version 1.4.0, Build 8cc5d54151c872e2768cf27b85dabad11cb3ad12 50 | 1.4.0 51 | http://igrsoft.com/wp-content/lockmenow/info_140.html 52 | Thu, 09 Mar 2017 10:43:25 +0800 53 | 54 | 55 | 56 | Version 1.4.1, Build 2b6f9dc5b38ba34bb986b933c33c113ab219011a 57 | 1.4.1 58 | http://igrsoft.com/wp-content/lockmenow/info_141.html 59 | Sun, 12 Mar 2017 21:37:19 +0800 60 | 61 | 62 | 63 | 64 | --------------------------------------------------------------------------------