├── .gitignore ├── Killer.xcodeproj └── project.pbxproj ├── Killer ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── headstone.imageset │ │ ├── Contents.json │ │ ├── headstone.png │ │ ├── headstone@2x.png │ │ └── headstone@3x.png │ └── key.imageset │ │ ├── Contents.json │ │ ├── key.png │ │ ├── key@2x.png │ │ └── key@3x.png ├── Base.lproj │ └── MainMenu.xib ├── Info.plist ├── Killer-Bridging-Header.h ├── MenuExtraController.swift ├── SHKiller.h ├── SHKiller.m ├── SHPrivilegedKiller.h ├── SHPrivilegedKiller.m └── Shinigami.swift ├── LICENSE ├── README.md └── screenshots └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | __MACOSX 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | DerivedData 17 | .idea/ 18 | Crashlytics.sh 19 | generatechangelog.sh 20 | Podfile.lock 21 | Pods/ -------------------------------------------------------------------------------- /Killer.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DD7B535F1C703481007C777D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD7B535E1C703481007C777D /* AppDelegate.swift */; }; 11 | DD7B53611C703481007C777D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD7B53601C703481007C777D /* Assets.xcassets */; }; 12 | DD7B53641C703481007C777D /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = DD7B53621C703481007C777D /* MainMenu.xib */; }; 13 | DD7B536E1C7034D8007C777D /* SHPrivilegedKiller.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7B536D1C7034D8007C777D /* SHPrivilegedKiller.m */; settings = {COMPILER_FLAGS = "-w"; }; }; 14 | DD7B53721C70397D007C777D /* SHKiller.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7B53711C70397D007C777D /* SHKiller.m */; }; 15 | DD7B53751C703A84007C777D /* Shinigami.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD7B53741C703A84007C777D /* Shinigami.swift */; }; 16 | DD7B537B1C703CBB007C777D /* MenuExtraController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD7B537A1C703CBB007C777D /* MenuExtraController.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | DD7B535B1C703481007C777D /* Killer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Killer.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | DD7B535E1C703481007C777D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | DD7B53601C703481007C777D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | DD7B53631C703481007C777D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 24 | DD7B53651C703481007C777D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | DD7B536B1C7034D8007C777D /* Killer-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Killer-Bridging-Header.h"; sourceTree = ""; }; 26 | DD7B536C1C7034D8007C777D /* SHPrivilegedKiller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHPrivilegedKiller.h; sourceTree = ""; }; 27 | DD7B536D1C7034D8007C777D /* SHPrivilegedKiller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SHPrivilegedKiller.m; sourceTree = ""; }; 28 | DD7B53701C70397D007C777D /* SHKiller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHKiller.h; sourceTree = ""; }; 29 | DD7B53711C70397D007C777D /* SHKiller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SHKiller.m; sourceTree = ""; }; 30 | DD7B53741C703A84007C777D /* Shinigami.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Shinigami.swift; sourceTree = ""; }; 31 | DD7B537A1C703CBB007C777D /* MenuExtraController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuExtraController.swift; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | DD7B53581C703481007C777D /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | DD7B53521C703481007C777D = { 46 | isa = PBXGroup; 47 | children = ( 48 | DD7B535D1C703481007C777D /* Killer */, 49 | DD7B535C1C703481007C777D /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | DD7B535C1C703481007C777D /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | DD7B535B1C703481007C777D /* Killer.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | DD7B535D1C703481007C777D /* Killer */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | DD7B53791C703C9B007C777D /* Controllers */, 65 | DD7B53731C703A79007C777D /* Model */, 66 | DD7B536F1C7036E0007C777D /* Core */, 67 | DD7B53781C703C77007C777D /* Resources */, 68 | DD7B535E1C703481007C777D /* AppDelegate.swift */, 69 | ); 70 | path = Killer; 71 | sourceTree = ""; 72 | }; 73 | DD7B536F1C7036E0007C777D /* Core */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | DD7B536B1C7034D8007C777D /* Killer-Bridging-Header.h */, 77 | DD7B53701C70397D007C777D /* SHKiller.h */, 78 | DD7B53711C70397D007C777D /* SHKiller.m */, 79 | DD7B536C1C7034D8007C777D /* SHPrivilegedKiller.h */, 80 | DD7B536D1C7034D8007C777D /* SHPrivilegedKiller.m */, 81 | ); 82 | name = Core; 83 | sourceTree = ""; 84 | }; 85 | DD7B53731C703A79007C777D /* Model */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | DD7B53741C703A84007C777D /* Shinigami.swift */, 89 | ); 90 | name = Model; 91 | sourceTree = ""; 92 | }; 93 | DD7B53781C703C77007C777D /* Resources */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | DD7B53601C703481007C777D /* Assets.xcassets */, 97 | DD7B53621C703481007C777D /* MainMenu.xib */, 98 | DD7B53651C703481007C777D /* Info.plist */, 99 | ); 100 | name = Resources; 101 | sourceTree = ""; 102 | }; 103 | DD7B53791C703C9B007C777D /* Controllers */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | DD7B537A1C703CBB007C777D /* MenuExtraController.swift */, 107 | ); 108 | name = Controllers; 109 | sourceTree = ""; 110 | }; 111 | /* End PBXGroup section */ 112 | 113 | /* Begin PBXNativeTarget section */ 114 | DD7B535A1C703481007C777D /* Killer */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = DD7B53681C703481007C777D /* Build configuration list for PBXNativeTarget "Killer" */; 117 | buildPhases = ( 118 | DD7B53571C703481007C777D /* Sources */, 119 | DD7B53581C703481007C777D /* Frameworks */, 120 | DD7B53591C703481007C777D /* Resources */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = Killer; 127 | productName = Killer; 128 | productReference = DD7B535B1C703481007C777D /* Killer.app */; 129 | productType = "com.apple.product-type.application"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | DD7B53531C703481007C777D /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | LastSwiftUpdateCheck = 0720; 138 | LastUpgradeCheck = 0720; 139 | ORGANIZATIONNAME = "Guilherme Rambo"; 140 | TargetAttributes = { 141 | DD7B535A1C703481007C777D = { 142 | CreatedOnToolsVersion = 7.2.1; 143 | }; 144 | }; 145 | }; 146 | buildConfigurationList = DD7B53561C703481007C777D /* Build configuration list for PBXProject "Killer" */; 147 | compatibilityVersion = "Xcode 3.2"; 148 | developmentRegion = English; 149 | hasScannedForEncodings = 0; 150 | knownRegions = ( 151 | en, 152 | Base, 153 | ); 154 | mainGroup = DD7B53521C703481007C777D; 155 | productRefGroup = DD7B535C1C703481007C777D /* Products */; 156 | projectDirPath = ""; 157 | projectRoot = ""; 158 | targets = ( 159 | DD7B535A1C703481007C777D /* Killer */, 160 | ); 161 | }; 162 | /* End PBXProject section */ 163 | 164 | /* Begin PBXResourcesBuildPhase section */ 165 | DD7B53591C703481007C777D /* Resources */ = { 166 | isa = PBXResourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | DD7B53611C703481007C777D /* Assets.xcassets in Resources */, 170 | DD7B53641C703481007C777D /* MainMenu.xib in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXSourcesBuildPhase section */ 177 | DD7B53571C703481007C777D /* Sources */ = { 178 | isa = PBXSourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | DD7B53721C70397D007C777D /* SHKiller.m in Sources */, 182 | DD7B536E1C7034D8007C777D /* SHPrivilegedKiller.m in Sources */, 183 | DD7B535F1C703481007C777D /* AppDelegate.swift in Sources */, 184 | DD7B53751C703A84007C777D /* Shinigami.swift in Sources */, 185 | DD7B537B1C703CBB007C777D /* MenuExtraController.swift in Sources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXSourcesBuildPhase section */ 190 | 191 | /* Begin PBXVariantGroup section */ 192 | DD7B53621C703481007C777D /* MainMenu.xib */ = { 193 | isa = PBXVariantGroup; 194 | children = ( 195 | DD7B53631C703481007C777D /* Base */, 196 | ); 197 | name = MainMenu.xib; 198 | sourceTree = ""; 199 | }; 200 | /* End PBXVariantGroup section */ 201 | 202 | /* Begin XCBuildConfiguration section */ 203 | DD7B53661C703481007C777D /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | ALWAYS_SEARCH_USER_PATHS = NO; 207 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 208 | CLANG_CXX_LIBRARY = "libc++"; 209 | CLANG_ENABLE_MODULES = YES; 210 | CLANG_ENABLE_OBJC_ARC = YES; 211 | CLANG_WARN_BOOL_CONVERSION = YES; 212 | CLANG_WARN_CONSTANT_CONVERSION = YES; 213 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INT_CONVERSION = YES; 217 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 218 | CLANG_WARN_UNREACHABLE_CODE = YES; 219 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 220 | CODE_SIGN_IDENTITY = "-"; 221 | COPY_PHASE_STRIP = NO; 222 | DEBUG_INFORMATION_FORMAT = dwarf; 223 | ENABLE_STRICT_OBJC_MSGSEND = YES; 224 | ENABLE_TESTABILITY = YES; 225 | GCC_C_LANGUAGE_STANDARD = gnu99; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_NO_COMMON_BLOCKS = YES; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | MACOSX_DEPLOYMENT_TARGET = 10.11; 240 | MTL_ENABLE_DEBUG_INFO = YES; 241 | ONLY_ACTIVE_ARCH = YES; 242 | SDKROOT = macosx; 243 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 244 | }; 245 | name = Debug; 246 | }; 247 | DD7B53671C703481007C777D /* Release */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ALWAYS_SEARCH_USER_PATHS = NO; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_CONSTANT_CONVERSION = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INT_CONVERSION = YES; 261 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 262 | CLANG_WARN_UNREACHABLE_CODE = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | CODE_SIGN_IDENTITY = "-"; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | MACOSX_DEPLOYMENT_TARGET = 10.11; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | SDKROOT = macosx; 280 | }; 281 | name = Release; 282 | }; 283 | DD7B53691C703481007C777D /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | CLANG_ENABLE_MODULES = YES; 288 | COMBINE_HIDPI_IMAGES = YES; 289 | INFOPLIST_FILE = Killer/Info.plist; 290 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 291 | PRODUCT_BUNDLE_IDENTIFIER = br.com.guilhermerambo.Killer; 292 | PRODUCT_NAME = "$(TARGET_NAME)"; 293 | SWIFT_OBJC_BRIDGING_HEADER = "Killer/Killer-Bridging-Header.h"; 294 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 295 | }; 296 | name = Debug; 297 | }; 298 | DD7B536A1C703481007C777D /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 302 | CLANG_ENABLE_MODULES = YES; 303 | COMBINE_HIDPI_IMAGES = YES; 304 | INFOPLIST_FILE = Killer/Info.plist; 305 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 306 | PRODUCT_BUNDLE_IDENTIFIER = br.com.guilhermerambo.Killer; 307 | PRODUCT_NAME = "$(TARGET_NAME)"; 308 | SWIFT_OBJC_BRIDGING_HEADER = "Killer/Killer-Bridging-Header.h"; 309 | }; 310 | name = Release; 311 | }; 312 | /* End XCBuildConfiguration section */ 313 | 314 | /* Begin XCConfigurationList section */ 315 | DD7B53561C703481007C777D /* Build configuration list for PBXProject "Killer" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | DD7B53661C703481007C777D /* Debug */, 319 | DD7B53671C703481007C777D /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | DD7B53681C703481007C777D /* Build configuration list for PBXNativeTarget "Killer" */ = { 325 | isa = XCConfigurationList; 326 | buildConfigurations = ( 327 | DD7B53691C703481007C777D /* Debug */, 328 | DD7B536A1C703481007C777D /* Release */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | }; 332 | /* End XCConfigurationList section */ 333 | }; 334 | rootObject = DD7B53531C703481007C777D /* Project object */; 335 | } 336 | -------------------------------------------------------------------------------- /Killer/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | private var menuController: MenuExtraController! 15 | 16 | func applicationDidFinishLaunching(aNotification: NSNotification) { 17 | let builtinShinigamis = [ 18 | Shinigami(displayName: "Restart the Dock", processName: "Dock"), 19 | Shinigami(displayName: "Restart Finder", processName: "Finder"), 20 | Shinigami(displayName: "Flush Preferences", processName: "cfprefsd", requiresAdminPrivileges: true), 21 | Shinigami(displayName: "Fix AppStore Glitch", processName: "storeaccountd") 22 | ] 23 | 24 | menuController = MenuExtraController(shinigamis: builtinShinigamis) 25 | } 26 | 27 | 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Killer/Assets.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 | } -------------------------------------------------------------------------------- /Killer/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Killer/Assets.xcassets/headstone.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "headstone.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "headstone@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "headstone@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | }, 23 | "properties" : { 24 | "template-rendering-intent" : "template" 25 | } 26 | } -------------------------------------------------------------------------------- /Killer/Assets.xcassets/headstone.imageset/headstone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/Killer/Assets.xcassets/headstone.imageset/headstone.png -------------------------------------------------------------------------------- /Killer/Assets.xcassets/headstone.imageset/headstone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/Killer/Assets.xcassets/headstone.imageset/headstone@2x.png -------------------------------------------------------------------------------- /Killer/Assets.xcassets/headstone.imageset/headstone@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/Killer/Assets.xcassets/headstone.imageset/headstone@3x.png -------------------------------------------------------------------------------- /Killer/Assets.xcassets/key.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "key.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "key@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "key@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Killer/Assets.xcassets/key.imageset/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/Killer/Assets.xcassets/key.imageset/key.png -------------------------------------------------------------------------------- /Killer/Assets.xcassets/key.imageset/key@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/Killer/Assets.xcassets/key.imageset/key@2x.png -------------------------------------------------------------------------------- /Killer/Assets.xcassets/key.imageset/key@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/Killer/Assets.xcassets/key.imageset/key@3x.png -------------------------------------------------------------------------------- /Killer/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | Default 536 | 537 | 538 | 539 | 540 | 541 | 542 | Left to Right 543 | 544 | 545 | 546 | 547 | 548 | 549 | Right to Left 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | Default 561 | 562 | 563 | 564 | 565 | 566 | 567 | Left to Right 568 | 569 | 570 | 571 | 572 | 573 | 574 | Right to Left 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | -------------------------------------------------------------------------------- /Killer/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 | NSHumanReadableCopyright 30 | Copyright © 2016 Guilherme Rambo. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /Killer/Killer-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "SHKiller.h" 6 | #import "SHPrivilegedKiller.h" -------------------------------------------------------------------------------- /Killer/MenuExtraController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MenuExtraController.swift 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class MenuExtraController: NSObject { 12 | 13 | private let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(NSSquareStatusItemLength) 14 | private let menu = NSMenu() 15 | 16 | var shinigamis: [Shinigami]? { 17 | didSet { 18 | configureMenu() 19 | } 20 | } 21 | 22 | init(shinigamis: [Shinigami]?) { 23 | self.shinigamis = shinigamis 24 | 25 | super.init() 26 | 27 | statusItem.button?.image = NSImage(named: "headstone") 28 | 29 | configureMenu() 30 | } 31 | 32 | private func configureMenu() { 33 | guard let shinigamis = shinigamis else { return } 34 | 35 | for shinigami in shinigamis { 36 | let item = NSMenuItem(title: shinigami.displayName, action: Selector("shinigamiMenuItemAction:"), keyEquivalent: "") 37 | if shinigami.requiresAdminPrivileges { 38 | item.image = NSImage(named: "key") 39 | } 40 | item.target = self 41 | item.representedObject = shinigami 42 | menu.addItem(item) 43 | } 44 | 45 | menu.addItem(NSMenuItem.separatorItem()) 46 | 47 | let quitItem = NSMenuItem(title: "Quit", action: Selector("terminate:"), keyEquivalent: "") 48 | quitItem.target = NSApp 49 | menu.addItem(quitItem) 50 | 51 | statusItem.menu = menu 52 | } 53 | 54 | func shinigamiMenuItemAction(sender: NSMenuItem) { 55 | guard let shinigami = sender.representedObject as? Shinigami else { return } 56 | 57 | if shinigami.requiresAdminPrivileges { 58 | if !runPrivilegedShinigami(shinigami) { NSLog("Shinigami \(shinigami.displayName) failed to execute") } 59 | } else { 60 | if !runShinigami(shinigami) { NSLog("Shinigami \(shinigami.displayName) failed to execute") } 61 | } 62 | } 63 | 64 | private func runPrivilegedShinigami(shinigami: Shinigami) -> Bool { 65 | let killer = SHPrivilegedKiller() 66 | 67 | guard killer.requestAuthorization() else { 68 | NSLog("Failed to authorize to run shinigami \(shinigami.displayName)") 69 | return false 70 | } 71 | 72 | return killer.killProcessNamed(shinigami.processName) 73 | } 74 | 75 | private func runShinigami(shinigami: Shinigami) -> Bool { 76 | let killer = SHKiller() 77 | 78 | return killer.killProcessNamed(shinigami.processName) 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /Killer/SHKiller.h: -------------------------------------------------------------------------------- 1 | // 2 | // SHKiller.h 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol SHKillerProtocol 12 | 13 | - (BOOL)killProcessNamed:(NSString *__nonnull)processName; 14 | 15 | @optional 16 | - (BOOL)requestAuthorization; 17 | 18 | @end 19 | 20 | @interface SHKiller : NSObject 21 | @end 22 | -------------------------------------------------------------------------------- /Killer/SHKiller.m: -------------------------------------------------------------------------------- 1 | // 2 | // SHKiller.m 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import "SHKiller.h" 10 | 11 | @implementation SHKiller 12 | 13 | - (BOOL)killProcessNamed:(NSString *__nonnull)processName 14 | { 15 | NSTask *task = [[NSTask alloc] init]; 16 | task.launchPath = @"/usr/bin/killall"; 17 | task.arguments = @[@"-HUP", processName]; 18 | task.standardError = [NSPipe pipe]; 19 | task.standardOutput = [NSPipe pipe]; 20 | [task launch]; 21 | [task waitUntilExit]; 22 | 23 | return (task.terminationStatus == 0); 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Killer/SHPrivilegedKiller.h: -------------------------------------------------------------------------------- 1 | // 2 | // SHPrivilegedKiller.h 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "SHKiller.h" 12 | 13 | @interface SHPrivilegedKiller : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /Killer/SHPrivilegedKiller.m: -------------------------------------------------------------------------------- 1 | // 2 | // SHPrivilegedKiller.m 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import "SHPrivilegedKiller.h" 10 | 11 | @implementation SHPrivilegedKiller 12 | { 13 | AuthorizationRef _authorization; 14 | } 15 | 16 | - (BOOL)requestAuthorization 17 | { 18 | // Create authorization reference 19 | OSStatus status; 20 | 21 | // AuthorizationCreate and pass NULL as the initial 22 | // AuthorizationRights set so that the AuthorizationRef gets created 23 | // successfully, and then later call AuthorizationCopyRights to 24 | // determine or extend the allowable rights. 25 | // http://developer.apple.com/qa/qa2001/qa1172.html 26 | status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &_authorization); 27 | if (status != errAuthorizationSuccess) 28 | { 29 | NSLog(@"Error Creating Initial Authorization: %d", status); 30 | return NO; 31 | } 32 | 33 | // kAuthorizationRightExecute == "system.privilege.admin" 34 | AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0}; 35 | AuthorizationRights rights = {1, &right}; 36 | AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | 37 | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights; 38 | 39 | // Call AuthorizationCopyRights to determine or extend the allowable rights. 40 | status = AuthorizationCopyRights(_authorization, &rights, NULL, flags, NULL); 41 | if (status != errAuthorizationSuccess) 42 | { 43 | NSLog(@"Copy Rights Unsuccessful: %d", status); 44 | return NO; 45 | } 46 | 47 | return YES; 48 | } 49 | 50 | - (BOOL)killProcessNamed:(NSString *__nonnull)processName 51 | { 52 | OSStatus status; 53 | 54 | char *tool = "/usr/bin/killall"; 55 | char *argv[] = {"-HUP", (char *)[processName UTF8String]}; 56 | FILE *pipe = NULL; 57 | 58 | status = AuthorizationExecuteWithPrivileges(_authorization, tool, kAuthorizationFlagDefaults, argv, &pipe); 59 | if (status != errAuthorizationSuccess) 60 | { 61 | NSLog(@"Error: %d", status); 62 | return NO; 63 | } 64 | 65 | return YES; 66 | } 67 | 68 | - (void)dealloc 69 | { 70 | // The only way to guarantee that a credential acquired when you 71 | // request a right is not shared with other authorization instances is 72 | // to destroy the credential. To do so, call the AuthorizationFree 73 | // function with the flag kAuthorizationFlagDestroyRights. 74 | // http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/02authconcepts/chapter_2_section_7.html 75 | AuthorizationFree(_authorization, kAuthorizationFlagDestroyRights); 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Killer/Shinigami.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Shinigami.swift 3 | // Killer 4 | // 5 | // Created by Guilherme Rambo on 14/02/16. 6 | // Copyright © 2016 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Shinigami: NSObject, NSSecureCoding { 12 | 13 | var displayName: String 14 | var processName: String 15 | var requiresAdminPrivileges: Bool 16 | 17 | init(displayName: String, processName: String, requiresAdminPrivileges: Bool = false) { 18 | self.displayName = displayName 19 | self.processName = processName 20 | self.requiresAdminPrivileges = requiresAdminPrivileges 21 | 22 | super.init() 23 | } 24 | 25 | // MARK: - NSCoding 26 | 27 | private struct Keys { 28 | static let displayName = "displayName" 29 | static let processName = "processName" 30 | static let requiresAdminPrivileges = "requiresAdminPrivileges" 31 | } 32 | 33 | func encodeWithCoder(aCoder: NSCoder) { 34 | aCoder.encodeObject(displayName, forKey: Keys.displayName) 35 | aCoder.encodeObject(processName, forKey: Keys.processName) 36 | aCoder.encodeBool(requiresAdminPrivileges, forKey: Keys.requiresAdminPrivileges) 37 | } 38 | 39 | required init?(coder aDecoder: NSCoder) { 40 | self.displayName = aDecoder.decodeObjectForKey(Keys.displayName) as! String 41 | self.processName = aDecoder.decodeObjectForKey(Keys.processName) as! String 42 | self.requiresAdminPrivileges = aDecoder.decodeBoolForKey(Keys.requiresAdminPrivileges) 43 | } 44 | 45 | static func supportsSecureCoding() -> Bool { 46 | return true 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Guilherme Rambo 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Killer App 2 | 3 | Handy helper to quickly restart stuff on OS X. 4 | 5 | Currently supports: 6 | 7 | * Dock 8 | * Finder 9 | * cfprefsd (to clear preferences after deleting .plist) 10 | * storeaccountd (to fix AppStore login issues) 11 | 12 | This is **WORK IN PROGRESS**: I have plenty of features I plan on implementing but this is what I had the time to do for now. Feel free to send me pull requests :) 13 | 14 | ![screenshot](https://raw.githubusercontent.com/insidegui/Killerapp/master/screenshots/screenshot.png) -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/killerapp/d11f3015c89680089cf46c0011563fc872c52fd4/screenshots/screenshot.png --------------------------------------------------------------------------------