mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[AltServer] Installs/uninstalls Mail.app plug-in
This commit is contained in:
@@ -12,6 +12,25 @@ import UserNotifications
|
||||
import AltSign
|
||||
|
||||
import LaunchAtLogin
|
||||
import STPrivilegedTask
|
||||
|
||||
enum PluginError: LocalizedError
|
||||
{
|
||||
case installationScriptNotFound
|
||||
case failedToRun(Int)
|
||||
case scriptError(String)
|
||||
|
||||
var errorDescription: String? {
|
||||
switch self
|
||||
{
|
||||
case .installationScriptNotFound: return NSLocalizedString("The installation script could not be found.", comment: "")
|
||||
case .failedToRun(let errorCode): return String(format: NSLocalizedString("The installation script could not be run. (%@)", comment: ""), NSNumber(value: errorCode))
|
||||
case .scriptError(let output): return output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private let pluginURL = URL(fileURLWithPath: "/Library/Mail/Bundles/AltPlugin.mailbundle")
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@@ -25,10 +44,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@IBOutlet private var appMenu: NSMenu!
|
||||
@IBOutlet private var connectedDevicesMenu: NSMenu!
|
||||
@IBOutlet private var launchAtLoginMenuItem: NSMenuItem!
|
||||
@IBOutlet private var installMailPluginMenuItem: NSMenuItem!
|
||||
|
||||
private weak var authenticationAppleIDTextField: NSTextField?
|
||||
private weak var authenticationPasswordTextField: NSSecureTextField?
|
||||
|
||||
|
||||
private var isMailPluginInstalled: Bool {
|
||||
let isMailPluginInstalled = FileManager.default.fileExists(atPath: pluginURL.path)
|
||||
return isMailPluginInstalled
|
||||
}
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification)
|
||||
{
|
||||
UserDefaults.standard.registerDefaults()
|
||||
@@ -81,6 +106,18 @@ private extension AppDelegate
|
||||
self.launchAtLoginMenuItem.state = LaunchAtLogin.isEnabled ? .on : .off
|
||||
self.launchAtLoginMenuItem.action = #selector(AppDelegate.toggleLaunchAtLogin(_:))
|
||||
|
||||
if FileManager.default.fileExists(atPath: pluginURL.path)
|
||||
{
|
||||
self.installMailPluginMenuItem.title = NSLocalizedString("Uninstall Mail Plug-in", comment: "")
|
||||
}
|
||||
else
|
||||
{
|
||||
self.installMailPluginMenuItem.title = NSLocalizedString("Install Mail Plug-in", comment: "")
|
||||
}
|
||||
|
||||
self.installMailPluginMenuItem.target = self
|
||||
self.installMailPluginMenuItem.action = #selector(AppDelegate.handleInstallMailPluginMenuItem(_:))
|
||||
|
||||
let x = button.frame.origin.x
|
||||
let y = button.frame.origin.y - 5
|
||||
|
||||
@@ -142,6 +179,13 @@ private extension AppDelegate
|
||||
let password = passwordTextField.stringValue
|
||||
|
||||
let device = self.connectedDevices[index]
|
||||
|
||||
if !self.isMailPluginInstalled
|
||||
{
|
||||
let result = self.installMailPlugin()
|
||||
guard result else { return }
|
||||
}
|
||||
|
||||
ALTDeviceManager.shared.installAltStore(to: device, appleID: username, password: password) { (result) in
|
||||
switch result
|
||||
{
|
||||
@@ -192,6 +236,74 @@ private extension AppDelegate
|
||||
|
||||
LaunchAtLogin.isEnabled.toggle()
|
||||
}
|
||||
|
||||
@objc func handleInstallMailPluginMenuItem(_ item: NSMenuItem)
|
||||
{
|
||||
installMailPlugin()
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func installMailPlugin() -> Bool
|
||||
{
|
||||
do
|
||||
{
|
||||
let previouslyInstalled = self.isMailPluginInstalled
|
||||
|
||||
if !previouslyInstalled
|
||||
{
|
||||
let alert = NSAlert()
|
||||
alert.messageText = NSLocalizedString("Install Mail Plug-in", comment: "")
|
||||
alert.informativeText = NSLocalizedString("AltServer requires a Mail plug-in in order to retrieve necessary information about your Apple ID. Would you like to install it now?", comment: "")
|
||||
|
||||
alert.addButton(withTitle: NSLocalizedString("Install Plug-in", comment: ""))
|
||||
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
||||
|
||||
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
|
||||
|
||||
let response = alert.runModal()
|
||||
guard response == .alertFirstButtonReturn else { return false }
|
||||
}
|
||||
|
||||
guard let scriptURL = Bundle.main.url(forResource: self.isMailPluginInstalled ? "UninstallPlugin" : "InstallPlugin", withExtension: "sh") else { throw PluginError.installationScriptNotFound }
|
||||
|
||||
try FileManager.default.setAttributes([.posixPermissions: 0o777], ofItemAtPath: scriptURL.path)
|
||||
|
||||
let task = STPrivilegedTask()
|
||||
task.setLaunchPath(scriptURL.path)
|
||||
task.setCurrentDirectoryPath(scriptURL.deletingLastPathComponent().path)
|
||||
|
||||
let errorCode = task.launch()
|
||||
guard errorCode == 0 else { throw PluginError.failedToRun(Int(errorCode)) }
|
||||
|
||||
task.waitUntilExit()
|
||||
|
||||
if
|
||||
let outputData = task.outputFileHandle()?.readDataToEndOfFile(),
|
||||
let outputString = String(data: outputData, encoding: .utf8), !outputString.isEmpty
|
||||
{
|
||||
throw PluginError.scriptError(outputString)
|
||||
}
|
||||
|
||||
if !previouslyInstalled && self.isMailPluginInstalled
|
||||
{
|
||||
let alert = NSAlert()
|
||||
alert.messageText = NSLocalizedString("Mail Plug-in Installed", comment: "")
|
||||
alert.informativeText = NSLocalizedString("Please restart Mail and enable AltPlugin in Mail's Preferences. Mail must be running when installing or refreshing apps with AltServer.", comment: "")
|
||||
alert.runModal()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
catch
|
||||
{
|
||||
let alert = NSAlert()
|
||||
alert.messageText = self.isMailPluginInstalled ? NSLocalizedString("Failed to Uninstall Mail Plug-in", comment: "") : NSLocalizedString("Failed to Install Mail Plug-in", comment: "")
|
||||
alert.informativeText = error.localizedDescription
|
||||
alert.runModal()
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDelegate: NSMenuDelegate
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15504"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -10,11 +11,11 @@
|
||||
<objects>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<stackView distribution="fill" orientation="vertical" alignment="leading" spacing="4" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" id="urc-xw-Dhc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="300" height="48"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="300" height="46"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zLd-d8-ghZ">
|
||||
<rect key="frame" x="0.0" y="26" width="300" height="22"/>
|
||||
<rect key="frame" x="0.0" y="25" width="300" height="21"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Apple ID" drawsBackground="YES" id="BXa-Re-rs3">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -26,7 +27,7 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9rp-Vx-rvB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="300" height="22"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="300" height="21"/>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Password" drawsBackground="YES" usesSingleLineMode="YES" id="xqJ-wt-DlP">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -61,6 +62,7 @@
|
||||
<outlet property="authenticationAppleIDTextField" destination="zLd-d8-ghZ" id="wW5-0J-zdq"/>
|
||||
<outlet property="authenticationPasswordTextField" destination="9rp-Vx-rvB" id="ZoC-DI-jzQ"/>
|
||||
<outlet property="connectedDevicesMenu" destination="KJ9-WY-pW1" id="Mcv-64-iFU"/>
|
||||
<outlet property="installMailPluginMenuItem" destination="3CM-gV-X2G" id="lio-ha-z0S"/>
|
||||
<outlet property="launchAtLoginMenuItem" destination="IyR-FQ-upe" id="Fxn-EP-hwH"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@@ -98,6 +100,9 @@
|
||||
<menuItem title="Launch at Login" id="IyR-FQ-upe" userLabel="Launch At Login">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem title="Install Mail Plug-in" id="3CM-gV-X2G" userLabel="Mail Plug-in">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="mVM-Nm-Zi9"/>
|
||||
<menuItem title="Quit AltServer" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2</string>
|
||||
<string>3</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>LSUIElement</key>
|
||||
|
||||
11
AltServer/InstallPlugin.sh
Normal file
11
AltServer/InstallPlugin.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# InstallAltPlugin.sh
|
||||
# AltStore
|
||||
#
|
||||
# Created by Riley Testut on 11/16/19.
|
||||
# Copyright © 2019 Riley Testut. All rights reserved.
|
||||
|
||||
mkdir -p /Library/Mail/Bundles
|
||||
cp -r AltPlugin.mailbundle /Library/Mail/Bundles
|
||||
defaults write "/Library/Preferences/com.apple.mail" EnableBundles 1
|
||||
9
AltServer/UninstallPlugin.sh
Normal file
9
AltServer/UninstallPlugin.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# UninstallPlugin.sh
|
||||
# AltStore
|
||||
#
|
||||
# Created by Riley Testut on 11/16/19.
|
||||
# Copyright © 2019 Riley Testut. All rights reserved.
|
||||
|
||||
rm -rf /Library/Mail/Bundles/AltPlugin.mailbundle
|
||||
@@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
A8BCEBEAC0620CF80A2FD26D /* Pods_AltServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC3822AB1C4CF1D4CDF7445D /* Pods_AltServer.framework */; };
|
||||
BF0201BA22C2EFA3000B93E4 /* AltSign.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF5AB3A72285FE6C00DC914B /* AltSign.framework */; };
|
||||
BF0201BB22C2EFA3000B93E4 /* AltSign.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF5AB3A72285FE6C00DC914B /* AltSign.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
BF0201BD22C2EFBC000B93E4 /* openssl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4713A422976CFC00784A2F /* openssl.framework */; };
|
||||
@@ -113,6 +114,8 @@
|
||||
BF4588882298DD3F00BD7491 /* libxml2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4588872298DD3F00BD7491 /* libxml2.tbd */; };
|
||||
BF4713A522976D1E00784A2F /* openssl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4713A422976CFC00784A2F /* openssl.framework */; };
|
||||
BF4713A622976D1E00784A2F /* openssl.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF4713A422976CFC00784A2F /* openssl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
BF4C7F2523801F0800B2556E /* AltSign.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9B63C5229DD44D002F0A62 /* AltSign.framework */; };
|
||||
BF4C7F27238086EB00B2556E /* InstallPlugin.sh in Resources */ = {isa = PBXBuildFile; fileRef = BF4C7F26238086EB00B2556E /* InstallPlugin.sh */; };
|
||||
BF54E8212315EF0D000AE0D8 /* ALTPatreonBenefitType.m in Sources */ = {isa = PBXBuildFile; fileRef = BF54E8202315EF0D000AE0D8 /* ALTPatreonBenefitType.m */; };
|
||||
BF5AB3A82285FE7500DC914B /* AltSign.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF5AB3A72285FE6C00DC914B /* AltSign.framework */; };
|
||||
BF5AB3A92285FE7500DC914B /* AltSign.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF5AB3A72285FE6C00DC914B /* AltSign.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
@@ -195,6 +198,7 @@
|
||||
BFD5D6F4230DDB0A007955AB /* Campaign.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD5D6F3230DDB0A007955AB /* Campaign.swift */; };
|
||||
BFD5D6F6230DDB12007955AB /* Tier.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD5D6F5230DDB12007955AB /* Tier.swift */; };
|
||||
BFD6B03322DFF20800B86064 /* MyAppsComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD6B03222DFF20800B86064 /* MyAppsComponents.swift */; };
|
||||
BFD80D572380C0F700B9C227 /* UninstallPlugin.sh in Resources */ = {isa = PBXBuildFile; fileRef = BFD80D562380C0F700B9C227 /* UninstallPlugin.sh */; };
|
||||
BFDB5B1622EE90D300F74113 /* Date+RelativeDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDB5B1522EE90D300F74113 /* Date+RelativeDate.swift */; };
|
||||
BFDB5B2622EFBBEA00F74113 /* BrowseCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BFDB5B2522EFBBEA00F74113 /* BrowseCollectionViewCell.xib */; };
|
||||
BFDB6A0522A9AFB2007EA6D6 /* Fetchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDB6A0422A9AFB2007EA6D6 /* Fetchable.swift */; };
|
||||
@@ -305,6 +309,8 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1039C07E517311FC499A0B64 /* Pods_AltStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AltStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
11611D46F8A7C8B928E8156B /* Pods-AltServer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AltServer.debug.xcconfig"; path = "Target Support Files/Pods-AltServer/Pods-AltServer.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
589BA531D903B28F292063E5 /* Pods-AltServer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AltServer.release.xcconfig"; path = "Target Support Files/Pods-AltServer/Pods-AltServer.release.xcconfig"; sourceTree = "<group>"; };
|
||||
A136EE677716B80768E9F0A2 /* Pods-AltStore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AltStore.release.xcconfig"; path = "Target Support Files/Pods-AltStore/Pods-AltStore.release.xcconfig"; sourceTree = "<group>"; };
|
||||
BF02419322F2156E00129732 /* RefreshAttempt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshAttempt.swift; sourceTree = "<group>"; };
|
||||
BF02419522F2199300129732 /* RefreshAttemptsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshAttemptsViewController.swift; sourceTree = "<group>"; };
|
||||
@@ -417,6 +423,7 @@
|
||||
BF4588872298DD3F00BD7491 /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libxml2.tbd; sourceTree = DEVELOPER_DIR; };
|
||||
BF4588962298DE6E00BD7491 /* libzip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = libzip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BF4713A422976CFC00784A2F /* openssl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = openssl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BF4C7F26238086EB00B2556E /* InstallPlugin.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = InstallPlugin.sh; sourceTree = "<group>"; };
|
||||
BF54E81F2315EF0D000AE0D8 /* ALTPatreonBenefitType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ALTPatreonBenefitType.h; sourceTree = "<group>"; };
|
||||
BF54E8202315EF0D000AE0D8 /* ALTPatreonBenefitType.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ALTPatreonBenefitType.m; sourceTree = "<group>"; };
|
||||
BF5AB3A72285FE6C00DC914B /* AltSign.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AltSign.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -507,6 +514,7 @@
|
||||
BFD5D6F3230DDB0A007955AB /* Campaign.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Campaign.swift; sourceTree = "<group>"; };
|
||||
BFD5D6F5230DDB12007955AB /* Tier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tier.swift; sourceTree = "<group>"; };
|
||||
BFD6B03222DFF20800B86064 /* MyAppsComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyAppsComponents.swift; sourceTree = "<group>"; };
|
||||
BFD80D562380C0F700B9C227 /* UninstallPlugin.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = UninstallPlugin.sh; sourceTree = "<group>"; };
|
||||
BFDB5B1522EE90D300F74113 /* Date+RelativeDate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+RelativeDate.swift"; sourceTree = "<group>"; };
|
||||
BFDB5B2522EFBBEA00F74113 /* BrowseCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BrowseCollectionViewCell.xib; sourceTree = "<group>"; };
|
||||
BFDB6A0422A9AFB2007EA6D6 /* Fetchable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fetchable.swift; sourceTree = "<group>"; };
|
||||
@@ -550,6 +558,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BF4C7F2523801F0800B2556E /* AltSign.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -563,6 +572,14 @@
|
||||
BF4588472298D4B000BD7491 /* libimobiledevice.a in Frameworks */,
|
||||
BF0201BD22C2EFBC000B93E4 /* openssl.framework in Frameworks */,
|
||||
BF0201BA22C2EFA3000B93E4 /* AltSign.framework in Frameworks */,
|
||||
A8BCEBEAC0620CF80A2FD26D /* Pods_AltServer.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BF5C5FC2237DF5AE00EDD0C6 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -586,6 +603,8 @@
|
||||
children = (
|
||||
EA79A60285C6AF5848AA16E9 /* Pods-AltStore.debug.xcconfig */,
|
||||
A136EE677716B80768E9F0A2 /* Pods-AltStore.release.xcconfig */,
|
||||
11611D46F8A7C8B928E8156B /* Pods-AltServer.debug.xcconfig */,
|
||||
589BA531D903B28F292063E5 /* Pods-AltServer.release.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
@@ -831,6 +850,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BF458693229872EA00BD7491 /* Assets.xcassets */,
|
||||
BF4C7F26238086EB00B2556E /* InstallPlugin.sh */,
|
||||
BFD80D562380C0F700B9C227 /* UninstallPlugin.sh */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
@@ -1194,15 +1215,18 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BF45869A229872EA00BD7491 /* Build configuration list for PBXNativeTarget "AltServer" */;
|
||||
buildPhases = (
|
||||
FACBF95CCAAAB7121E1D92C8 /* [CP] Check Pods Manifest.lock */,
|
||||
BF458689229872EA00BD7491 /* Sources */,
|
||||
BF45868B229872EA00BD7491 /* Resources */,
|
||||
BF4588462298D4AA00BD7491 /* Frameworks */,
|
||||
BF0201BC22C2EFA3000B93E4 /* Embed Frameworks */,
|
||||
BF7FDA2C23203B6B00B5D3A4 /* Copy Launcher App */,
|
||||
98BF22D155DBAEA97544E3E6 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
BFBFFB272380C72F00993A4A /* PBXTargetDependency */,
|
||||
BF1E315E22A0621F00370A3C /* PBXTargetDependency */,
|
||||
BF4588452298D48B00BD7491 /* PBXTargetDependency */,
|
||||
);
|
||||
@@ -1341,8 +1365,17 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BFBFFB252380C71600993A4A /* AltPlugin.mailbundle in Resources */,
|
||||
BFD80D572380C0F700B9C227 /* UninstallPlugin.sh in Resources */,
|
||||
BF458694229872EA00BD7491 /* Assets.xcassets in Resources */,
|
||||
BF458697229872EA00BD7491 /* Main.storyboard in Resources */,
|
||||
BF4C7F27238086EB00B2556E /* InstallPlugin.sh in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BF5C5FC3237DF5AE00EDD0C6 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1368,6 +1401,28 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
98BF22D155DBAEA97544E3E6 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-AltServer/Pods-AltServer-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/STPrivilegedTask/STPrivilegedTask.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/STPrivilegedTask.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AltServer/Pods-AltServer-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
B8F37E08B55D2C9C4E2B1B4E /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1410,6 +1465,28 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh\"\n";
|
||||
};
|
||||
FACBF95CCAAAB7121E1D92C8 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-AltServer-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FFB93342C7EB2021A1FFFB6A /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1705,9 +1782,11 @@
|
||||
};
|
||||
BF45869B229872EA00BD7491 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 11611D46F8A7C8B928E8156B /* Pods-AltServer.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = AltServer/AltServer.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
@@ -1755,9 +1834,11 @@
|
||||
};
|
||||
BF45869C229872EA00BD7491 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 589BA531D903B28F292063E5 /* Pods-AltServer.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = AltServer/AltServer.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
|
||||
10
Podfile
10
Podfile
@@ -10,3 +10,13 @@ target 'AltStore' do
|
||||
pod 'Nuke', '~> 7.0'
|
||||
|
||||
end
|
||||
|
||||
target 'AltServer' do
|
||||
platform :macos, '10.14'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
# Pods for AltServer
|
||||
pod 'STPrivilegedTask'
|
||||
|
||||
end
|
||||
@@ -1,20 +1,24 @@
|
||||
PODS:
|
||||
- KeychainAccess (3.2.0)
|
||||
- Nuke (7.6.3)
|
||||
- STPrivilegedTask (1.0.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- KeychainAccess (~> 3.2.0)
|
||||
- Nuke (~> 7.0)
|
||||
- STPrivilegedTask
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- KeychainAccess
|
||||
- Nuke
|
||||
- STPrivilegedTask
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
KeychainAccess: 3b1bf8a77eb4c6ea1ce9404c292e48f948954c6b
|
||||
Nuke: 44130e95e09463f8773ae4b96b90de1eba6b3350
|
||||
STPrivilegedTask: 103f97827454e786074640cf89d303be344498c7
|
||||
|
||||
PODFILE CHECKSUM: 4ad739b1f5db7e51cf8ffbc410963811f20b9b17
|
||||
PODFILE CHECKSUM: 53094cc13ea2b40dac4885cca874406388e86f5b
|
||||
|
||||
COCOAPODS: 1.6.1
|
||||
|
||||
6
Pods/Manifest.lock
generated
6
Pods/Manifest.lock
generated
@@ -1,20 +1,24 @@
|
||||
PODS:
|
||||
- KeychainAccess (3.2.0)
|
||||
- Nuke (7.6.3)
|
||||
- STPrivilegedTask (1.0.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- KeychainAccess (~> 3.2.0)
|
||||
- Nuke (~> 7.0)
|
||||
- STPrivilegedTask
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- KeychainAccess
|
||||
- Nuke
|
||||
- STPrivilegedTask
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
KeychainAccess: 3b1bf8a77eb4c6ea1ce9404c292e48f948954c6b
|
||||
Nuke: 44130e95e09463f8773ae4b96b90de1eba6b3350
|
||||
STPrivilegedTask: 103f97827454e786074640cf89d303be344498c7
|
||||
|
||||
PODFILE CHECKSUM: 4ad739b1f5db7e51cf8ffbc410963811f20b9b17
|
||||
PODFILE CHECKSUM: 53094cc13ea2b40dac4885cca874406388e86f5b
|
||||
|
||||
COCOAPODS: 1.6.1
|
||||
|
||||
1448
Pods/Pods.xcodeproj/project.pbxproj
generated
1448
Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
22
Pods/STPrivilegedTask/LICENSE.txt
generated
Normal file
22
Pods/STPrivilegedTask/LICENSE.txt
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
# BSD License
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Sveinbjorn Thordarson nor that of any other
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
58
Pods/STPrivilegedTask/README.md
generated
Normal file
58
Pods/STPrivilegedTask/README.md
generated
Normal file
@@ -0,0 +1,58 @@
|
||||
# STPrivilegedTask - Objective C class
|
||||
|
||||
An NSTask-like wrapper around AuthorizationExecuteWithPrivileges() in the Security API to run shell commands with root privileges in Mac OS X.
|
||||
|
||||
Example of usage:
|
||||
|
||||
```objective-c
|
||||
STPrivilegedTask *privilegedTask = [[STPrivilegedTask alloc] init];
|
||||
|
||||
[privilegedTask setLaunchPath:@"/usr/bin/touch"];
|
||||
NSArray *args = [NSArray arrayWithObject:@"/etc/my_test_file"];
|
||||
[privilegedTask setArguments:args];
|
||||
[privilegedTask setCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]];
|
||||
|
||||
//set it off
|
||||
OSStatus err = [privilegedTask launch];
|
||||
if (err != errAuthorizationSuccess) {
|
||||
if (err == errAuthorizationCanceled) {
|
||||
NSLog(@"User cancelled");
|
||||
} else {
|
||||
NSLog(@"Something went wrong");
|
||||
}
|
||||
}
|
||||
|
||||
// Read output file handle for data
|
||||
NSFileHandle *readHandle = [privilegedTask outputFileHandle];
|
||||
NSData *outputData = [readHandle readDataToEndOfFile];
|
||||
NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];
|
||||
|
||||
```
|
||||
|
||||
# BSD License
|
||||
|
||||
```
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Sveinbjorn Thordarson nor that of any other
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
```
|
||||
81
Pods/STPrivilegedTask/STPrivilegedTask.h
generated
Normal file
81
Pods/STPrivilegedTask/STPrivilegedTask.h
generated
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
#
|
||||
# STPrivilegedTask - NSTask-like wrapper around AuthorizationExecuteWithPrivileges
|
||||
# Copyright (C) 2009-2015 Sveinbjorn Thordarson <sveinbjornt@gmail.com>
|
||||
#
|
||||
# BSD License
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Sveinbjorn Thordarson nor that of any other
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <Security/Authorization.h>
|
||||
#import <Security/AuthorizationTags.h>
|
||||
|
||||
#define STPrivilegedTaskDidTerminateNotification @"STPrivilegedTaskDidTerminateNotification"
|
||||
//#define TMP_STDERR_TEMPLATE @".authStderr.XXXXXX"
|
||||
|
||||
// Defines error value for when AuthorizationExecuteWithPrivilleges no longer
|
||||
// exists anyplace. Rather than defining a new enum, we just create a global
|
||||
// constant
|
||||
extern const OSStatus errAuthorizationFnNoLongerExists;
|
||||
|
||||
@interface STPrivilegedTask : NSObject
|
||||
{
|
||||
NSArray *arguments;
|
||||
NSString *cwd;
|
||||
NSString *launchPath;
|
||||
BOOL isRunning;
|
||||
pid_t pid;
|
||||
int terminationStatus;
|
||||
NSFileHandle *outputFileHandle;
|
||||
NSTimer *checkStatusTimer;
|
||||
}
|
||||
-(id)initWithLaunchPath:(NSString *)path;
|
||||
-(id)initWithLaunchPath:(NSString *)path arguments: (NSArray *)args;
|
||||
+(STPrivilegedTask *)launchedPrivilegedTaskWithLaunchPath:(NSString *)path;
|
||||
+(STPrivilegedTask *)launchedPrivilegedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments;
|
||||
-(NSArray *)arguments;
|
||||
-(NSString *)currentDirectoryPath;
|
||||
-(BOOL)isRunning;
|
||||
-(int)launch;
|
||||
-(NSString *)launchPath;
|
||||
-(int)processIdentifier;
|
||||
-(void)setArguments:(NSArray *)arguments;
|
||||
-(void)setCurrentDirectoryPath:(NSString *)path;
|
||||
-(void)setLaunchPath:(NSString *)path;
|
||||
-(NSFileHandle *)outputFileHandle;
|
||||
-(void)terminate; // doesn't work
|
||||
-(int)terminationStatus;
|
||||
-(void)_checkTaskStatus;
|
||||
-(void)waitUntilExit;
|
||||
@end
|
||||
/*static OSStatus AuthorizationExecuteWithPrivilegesStdErrAndPid (
|
||||
AuthorizationRef authorization,
|
||||
const char *pathToTool,
|
||||
AuthorizationFlags options,
|
||||
char * const *arguments,
|
||||
FILE **communicationsPipe,
|
||||
FILE **errPipe,
|
||||
pid_t* processid
|
||||
);*/
|
||||
461
Pods/STPrivilegedTask/STPrivilegedTask.m
generated
Normal file
461
Pods/STPrivilegedTask/STPrivilegedTask.m
generated
Normal file
@@ -0,0 +1,461 @@
|
||||
/*
|
||||
#
|
||||
# STPrivilegedTask - NSTask-like wrapper around AuthorizationExecuteWithPrivileges
|
||||
# Copyright (C) 2009-2015 Sveinbjorn Thordarson <sveinbjornt@gmail.com>
|
||||
#
|
||||
# BSD License
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Sveinbjorn Thordarson nor that of any other
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "STPrivilegedTask.h"
|
||||
#import <stdio.h>
|
||||
#import <unistd.h>
|
||||
#import <dlfcn.h>
|
||||
|
||||
/* New error code denoting that AuthorizationExecuteWithPrivileges no longer exists */
|
||||
OSStatus const errAuthorizationFnNoLongerExists = -70001;
|
||||
|
||||
@implementation STPrivilegedTask
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
launchPath = @"";
|
||||
cwd = [[NSString alloc] initWithString:[[NSFileManager defaultManager] currentDirectoryPath]];
|
||||
arguments = [[NSArray alloc] init];
|
||||
isRunning = NO;
|
||||
outputFileHandle = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
#if !__has_feature(objc_arc)
|
||||
[launchPath release];
|
||||
[arguments release];
|
||||
[cwd release];
|
||||
|
||||
if (outputFileHandle != nil) {
|
||||
[outputFileHandle release];
|
||||
}
|
||||
[super dealloc];
|
||||
#endif
|
||||
}
|
||||
|
||||
-(id)initWithLaunchPath:(NSString *)path arguments:(NSArray *)args
|
||||
{
|
||||
if ((self = [self initWithLaunchPath:path])) {
|
||||
[self setArguments:args];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id)initWithLaunchPath:(NSString *)path
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
[self setLaunchPath:path];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
+(STPrivilegedTask *)launchedPrivilegedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)args
|
||||
{
|
||||
STPrivilegedTask *task = [[STPrivilegedTask alloc] initWithLaunchPath:path arguments:args];
|
||||
#if !__has_feature(objc_arc)
|
||||
[task autorelease];
|
||||
#endif
|
||||
|
||||
[task launch];
|
||||
[task waitUntilExit];
|
||||
return task;
|
||||
}
|
||||
|
||||
+(STPrivilegedTask *)launchedPrivilegedTaskWithLaunchPath:(NSString *)path
|
||||
{
|
||||
STPrivilegedTask *task = [[STPrivilegedTask alloc] initWithLaunchPath:path];
|
||||
#if !__has_feature(objc_arc)
|
||||
[task autorelease];
|
||||
#endif
|
||||
[task launch];
|
||||
[task waitUntilExit];
|
||||
return task;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (NSArray *)arguments
|
||||
{
|
||||
return arguments;
|
||||
}
|
||||
|
||||
- (NSString *)currentDirectoryPath;
|
||||
{
|
||||
return cwd;
|
||||
}
|
||||
|
||||
- (BOOL)isRunning
|
||||
{
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
- (NSString *)launchPath
|
||||
{
|
||||
return launchPath;
|
||||
}
|
||||
|
||||
- (int)processIdentifier
|
||||
{
|
||||
return pid;
|
||||
}
|
||||
|
||||
- (int)terminationStatus
|
||||
{
|
||||
return terminationStatus;
|
||||
}
|
||||
|
||||
- (NSFileHandle *)outputFileHandle;
|
||||
{
|
||||
return outputFileHandle;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
-(void)setArguments:(NSArray *)args
|
||||
{
|
||||
#if !__has_feature(objc_arc)
|
||||
[arguments release];
|
||||
[args retain];
|
||||
#endif
|
||||
arguments = args;
|
||||
}
|
||||
|
||||
-(void)setCurrentDirectoryPath:(NSString *)path
|
||||
{
|
||||
#if !__has_feature(objc_arc)
|
||||
[cwd release];
|
||||
[path retain];
|
||||
#endif
|
||||
cwd = path;
|
||||
}
|
||||
|
||||
-(void)setLaunchPath:(NSString *)path
|
||||
{
|
||||
#if !__has_feature(objc_arc)
|
||||
[launchPath release];
|
||||
[path retain];
|
||||
#endif
|
||||
launchPath = path;
|
||||
}
|
||||
|
||||
# pragma mark -
|
||||
|
||||
// return 0 for success
|
||||
-(int)launch
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
const char *toolPath = [launchPath fileSystemRepresentation];
|
||||
|
||||
AuthorizationRef authorizationRef;
|
||||
AuthorizationItem myItems = {kAuthorizationRightExecute, strlen(toolPath), &toolPath, 0};
|
||||
AuthorizationRights myRights = {1, &myItems};
|
||||
AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights;
|
||||
|
||||
NSUInteger numberOfArguments = [arguments count];
|
||||
char *args[numberOfArguments + 1];
|
||||
FILE *outputFile;
|
||||
|
||||
// Create fn pointer to AuthorizationExecuteWithPrivileges in case it doesn't exist
|
||||
// in this version of MacOS
|
||||
static OSStatus (*_AuthExecuteWithPrivsFn)(
|
||||
AuthorizationRef authorization, const char *pathToTool, AuthorizationFlags options,
|
||||
char * const *arguments, FILE **communicationsPipe) = NULL;
|
||||
|
||||
// Check to see if we have the correct function in our loaded libraries
|
||||
if (!_AuthExecuteWithPrivsFn) {
|
||||
// On 10.7, AuthorizationExecuteWithPrivileges is deprecated. We want
|
||||
// to still use it since there's no good alternative (without requiring
|
||||
// code signing). We'll look up the function through dyld and fail if
|
||||
// it is no longer accessible. If Apple removes the function entirely
|
||||
// this will fail gracefully. If they keep the function and throw some
|
||||
// sort of exception, this won't fail gracefully, but that's a risk
|
||||
// we'll have to take for now.
|
||||
// Pattern by Andy Kim from Potion Factory LLC
|
||||
_AuthExecuteWithPrivsFn = dlsym(RTLD_DEFAULT, "AuthorizationExecuteWithPrivileges");
|
||||
if (!_AuthExecuteWithPrivsFn) {
|
||||
// This version of OS X has finally removed this function. Exit with an error.
|
||||
err = errAuthorizationFnNoLongerExists;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
// Use Apple's Authentication Manager APIs to get an Authorization Reference
|
||||
// These Apple APIs are quite possibly the most horrible of the Mac OS X APIs
|
||||
|
||||
// create authorization reference
|
||||
err = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef);
|
||||
if (err != errAuthorizationSuccess) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// pre-authorize the privileged operation
|
||||
err = AuthorizationCopyRights(authorizationRef, &myRights, kAuthorizationEmptyEnvironment, flags, NULL);
|
||||
if (err != errAuthorizationSuccess) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// OK, at this point we have received authorization for the task.
|
||||
// Let's prepare to launch it
|
||||
|
||||
// first, construct an array of c strings from NSArray w. arguments
|
||||
for (int i = 0; i < numberOfArguments; i++) {
|
||||
NSString *argString = arguments[i];
|
||||
NSUInteger stringLength = [argString length];
|
||||
|
||||
args[i] = malloc((stringLength + 1) * sizeof(char));
|
||||
snprintf(args[i], stringLength + 1, "%s", [argString fileSystemRepresentation]);
|
||||
}
|
||||
args[numberOfArguments] = NULL;
|
||||
|
||||
// change to the current dir specified
|
||||
char *prevCwd = (char *)getcwd(nil, 0);
|
||||
chdir([cwd fileSystemRepresentation]);
|
||||
|
||||
//use Authorization Reference to execute script with privileges
|
||||
err = _AuthExecuteWithPrivsFn(authorizationRef, [launchPath fileSystemRepresentation], kAuthorizationFlagDefaults, args, &outputFile);
|
||||
|
||||
// OK, now we're done executing, let's change back to old dir
|
||||
chdir(prevCwd);
|
||||
|
||||
// free the malloc'd argument strings
|
||||
for (int i = 0; i < numberOfArguments; i++) {
|
||||
free(args[i]);
|
||||
}
|
||||
|
||||
// free the auth ref
|
||||
AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults);
|
||||
|
||||
// we return err if execution failed
|
||||
if (err != errAuthorizationSuccess) {
|
||||
return err;
|
||||
} else {
|
||||
isRunning = YES;
|
||||
}
|
||||
|
||||
// get file handle for the command output
|
||||
outputFileHandle = [[NSFileHandle alloc] initWithFileDescriptor:fileno(outputFile) closeOnDealloc:YES];
|
||||
pid = fcntl(fileno(outputFile), F_GETOWN, 0);
|
||||
|
||||
// start monitoring task
|
||||
checkStatusTimer = [NSTimer scheduledTimerWithTimeInterval:0.10 target:self selector:@selector(_checkTaskStatus) userInfo:nil repeats:YES];
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
- (void)terminate
|
||||
{
|
||||
// This doesn't work without a PID, and we can't get one. Stupid Security API
|
||||
/* int ret = kill(pid, SIGKILL);
|
||||
|
||||
if (ret != 0)
|
||||
NSLog(@"Error %d", errno);*/
|
||||
}
|
||||
|
||||
// hang until task is done
|
||||
- (void)waitUntilExit
|
||||
{
|
||||
waitpid([self processIdentifier], &terminationStatus, 0);
|
||||
isRunning = NO;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// check if privileged task is still running
|
||||
- (void)_checkTaskStatus
|
||||
{
|
||||
// see if task has terminated
|
||||
int mypid = waitpid([self processIdentifier], &terminationStatus, WNOHANG);
|
||||
if (mypid != 0) {
|
||||
isRunning = NO;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:STPrivilegedTaskDidTerminateNotification object:self];
|
||||
[checkStatusTimer invalidate];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
NSArray *args = [self arguments];
|
||||
NSString *cmd = [[self launchPath] copy];
|
||||
|
||||
for (int i = 0; i < [args count]; i++) {
|
||||
cmd = [cmd stringByAppendingFormat:@" %@", args[i]];
|
||||
}
|
||||
|
||||
return [[super description] stringByAppendingFormat:@" %@", cmd];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
*
|
||||
* Add the Standard err Pipe and Pid support to AuthorizationExecuteWithPrivileges()
|
||||
* method
|
||||
*
|
||||
* @Author: Miklós Fazekas
|
||||
* Modified Aug 10 2010 by Sveinbjorn Thordarson
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*static OSStatus AuthorizationExecuteWithPrivilegesStdErrAndPid (
|
||||
AuthorizationRef authorization,
|
||||
const char *pathToTool,
|
||||
AuthorizationFlags options,
|
||||
char * const *arguments,
|
||||
FILE **communicationsPipe,
|
||||
FILE **errPipe,
|
||||
pid_t* processid
|
||||
)
|
||||
{
|
||||
// get the Apple-approved secure temp directory
|
||||
NSString *tempFileTemplate = [NSTemporaryDirectory() stringByAppendingPathComponent: TMP_STDERR_TEMPLATE];
|
||||
|
||||
// copy it into a C string
|
||||
const char *tempFileTemplateCString = [tempFileTemplate fileSystemRepresentation];
|
||||
char *stderrpath = (char *)malloc(strlen(tempFileTemplateCString) + 1);
|
||||
strcpy(stderrpath, tempFileTemplateCString);
|
||||
|
||||
printf("%s\n", stderrpath);
|
||||
|
||||
// this is the command, it echoes pid and directs stderr output to pipe before running the tool w. args
|
||||
const char *commandtemplate = "echo $$; \"$@\" 2>%s";
|
||||
|
||||
if (communicationsPipe == errPipe)
|
||||
commandtemplate = "echo $$; \"$@\" 2>1";
|
||||
else if (errPipe == 0)
|
||||
commandtemplate = "echo $$; \"$@\"";
|
||||
|
||||
char command[1024];
|
||||
char **args;
|
||||
OSStatus result;
|
||||
int argcount = 0;
|
||||
int i;
|
||||
int stderrfd = 0;
|
||||
FILE *commPipe = 0;
|
||||
|
||||
// First, create temporary file for stderr
|
||||
if (errPipe)
|
||||
{
|
||||
// create temp file
|
||||
stderrfd = mkstemp(stderrpath);
|
||||
|
||||
// close and remove it
|
||||
close(stderrfd);
|
||||
unlink(stderrpath);
|
||||
|
||||
// create a pipe on the path of the temp file
|
||||
if (mkfifo(stderrpath,S_IRWXU | S_IRWXG) != 0)
|
||||
{
|
||||
fprintf(stderr,"Error mkfifo:%d\n", errno);
|
||||
return errAuthorizationInternal;
|
||||
}
|
||||
|
||||
if (stderrfd < 0)
|
||||
return errAuthorizationInternal;
|
||||
}
|
||||
|
||||
// Create command to be executed
|
||||
for (argcount = 0; arguments[argcount] != 0; ++argcount) {}
|
||||
args = (char**)malloc (sizeof(char*)*(argcount + 5));
|
||||
args[0] = "-c";
|
||||
snprintf (command, sizeof (command), commandtemplate, stderrpath);
|
||||
args[1] = command;
|
||||
args[2] = "";
|
||||
args[3] = (char*)pathToTool;
|
||||
for (i = 0; i < argcount; ++i) {
|
||||
args[i+4] = arguments[i];
|
||||
}
|
||||
args[argcount+4] = 0;
|
||||
|
||||
// for debugging: log the executed command
|
||||
printf ("Exec:\n%s", "/bin/sh"); for (i = 0; args[i] != 0; ++i) { printf (" \"%s\"", args[i]); } printf ("\n");
|
||||
|
||||
// Execute command
|
||||
result = AuthorizationExecuteWithPrivileges(authorization, "/bin/sh", options, args, &commPipe );
|
||||
if (result != noErr)
|
||||
{
|
||||
unlink (stderrpath);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Read the first line of stdout => it's the pid
|
||||
{
|
||||
int stdoutfd = fileno (commPipe);
|
||||
char pidnum[1024];
|
||||
pid_t pid = 0;
|
||||
int i = 0;
|
||||
char ch = 0;
|
||||
|
||||
while ((read(stdoutfd, &ch, sizeof(ch)) == 1) && (ch != '\n') && (i < sizeof(pidnum)))
|
||||
{
|
||||
pidnum[i++] = ch;
|
||||
}
|
||||
pidnum[i] = 0;
|
||||
|
||||
if (ch != '\n')
|
||||
{
|
||||
// we shouldn't get there
|
||||
unlink (stderrpath);
|
||||
return errAuthorizationInternal;
|
||||
}
|
||||
sscanf(pidnum, "%d", &pid);
|
||||
if (processid)
|
||||
{
|
||||
*processid = pid;
|
||||
}
|
||||
NSLog(@"Have PID %d", pid);
|
||||
}
|
||||
|
||||
//
|
||||
if (errPipe) {
|
||||
stderrfd = open(stderrpath, O_RDONLY, 0);
|
||||
// *errPipe = fdopen(stderrfd, "r");
|
||||
//Now it's safe to unlink the stderr file, as the opened handle will be still valid
|
||||
unlink (stderrpath);
|
||||
} else {
|
||||
unlink(stderrpath);
|
||||
}
|
||||
|
||||
if (communicationsPipe)
|
||||
*communicationsPipe = commPipe;
|
||||
else
|
||||
fclose (commPipe);
|
||||
|
||||
NSLog(@"AuthExecNew function over");
|
||||
|
||||
return noErr;
|
||||
}*/
|
||||
26
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-Info.plist
generated
Normal file
26
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-Info.plist
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
29
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-acknowledgements.markdown
generated
Normal file
29
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-acknowledgements.markdown
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## STPrivilegedTask
|
||||
|
||||
# BSD License
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Sveinbjorn Thordarson nor that of any other
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Generated by CocoaPods - https://cocoapods.org
|
||||
61
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-acknowledgements.plist
generated
Normal file
61
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-acknowledgements.plist
generated
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>This application makes use of the following third party libraries:</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string> # BSD License
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Sveinbjorn Thordarson nor that of any other
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</string>
|
||||
<key>License</key>
|
||||
<string>BSD</string>
|
||||
<key>Title</key>
|
||||
<string>STPrivilegedTask</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Generated by CocoaPods - https://cocoapods.org</string>
|
||||
<key>Title</key>
|
||||
<string></string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
</dict>
|
||||
</plist>
|
||||
5
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-dummy.m
generated
Normal file
5
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-dummy.m
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Pods_AltServer : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Pods_AltServer
|
||||
@end
|
||||
163
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-frameworks.sh
generated
Executable file
163
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-frameworks.sh
generated
Executable file
@@ -0,0 +1,163 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
function on_error {
|
||||
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
||||
}
|
||||
trap 'on_error $LINENO' ERR
|
||||
|
||||
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
|
||||
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
|
||||
# frameworks to, so exit 0 (signalling the script phase was successful).
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
||||
STRIP_BINARY_RETVAL=0
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
# Copies and strips a vendored framework
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$1"
|
||||
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
||||
elif [ -r "$1" ]; then
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# Use filter instead of exclude so missing patterns don't throw errors.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
binary="${destination}/${basename}.framework/${basename}"
|
||||
|
||||
if ! [ -r "$binary" ]; then
|
||||
binary="${destination}/${basename}"
|
||||
elif [ -L "${binary}" ]; then
|
||||
echo "Destination binary is symlinked..."
|
||||
dirname="$(dirname "${binary}")"
|
||||
binary="${dirname}/$(readlink "${binary}")"
|
||||
fi
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
# Resign the code if required by the build settings to avoid unstable apps
|
||||
code_sign_if_enabled "${destination}/$(basename "$1")"
|
||||
|
||||
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
|
||||
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
|
||||
local swift_runtime_libs
|
||||
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
|
||||
for lib in $swift_runtime_libs; do
|
||||
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
|
||||
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
||||
code_sign_if_enabled "${destination}/${lib}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies and strips a vendored dSYM
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
if [ -r "$source" ]; then
|
||||
# Copy the dSYM into a the targets temp dir.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework.dSYM "$source")"
|
||||
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
|
||||
# Move the stripped file into its final destination.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
else
|
||||
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
||||
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
# Use the current code_sign_identity
|
||||
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
|
||||
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
|
||||
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
code_sign_cmd="$code_sign_cmd &"
|
||||
fi
|
||||
echo "$code_sign_cmd"
|
||||
eval "$code_sign_cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
# Get architectures for current target binary
|
||||
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
||||
# Intersect them with the architectures we are building for
|
||||
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
|
||||
# If there are no archs supported by this binary then warn the user
|
||||
if [[ -z "$intersected_archs" ]]; then
|
||||
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
||||
STRIP_BINARY_RETVAL=0
|
||||
return
|
||||
fi
|
||||
stripped=""
|
||||
for arch in $binary_archs; do
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary"
|
||||
stripped="$stripped $arch"
|
||||
fi
|
||||
done
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
STRIP_BINARY_RETVAL=1
|
||||
}
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/STPrivilegedTask/STPrivilegedTask.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/STPrivilegedTask/STPrivilegedTask.framework"
|
||||
fi
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
wait
|
||||
fi
|
||||
16
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-umbrella.h
generated
Normal file
16
Pods/Target Support Files/Pods-AltServer/Pods-AltServer-umbrella.h
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double Pods_AltServerVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char Pods_AltServerVersionString[];
|
||||
|
||||
11
Pods/Target Support Files/Pods-AltServer/Pods-AltServer.debug.xcconfig
generated
Normal file
11
Pods/Target Support Files/Pods-AltServer/Pods-AltServer.debug.xcconfig
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
CODE_SIGN_IDENTITY =
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask/STPrivilegedTask.framework/Headers"
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask/STPrivilegedTask.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "STPrivilegedTask" -framework "Security"
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
6
Pods/Target Support Files/Pods-AltServer/Pods-AltServer.modulemap
generated
Normal file
6
Pods/Target Support Files/Pods-AltServer/Pods-AltServer.modulemap
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
framework module Pods_AltServer {
|
||||
umbrella header "Pods-AltServer-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
11
Pods/Target Support Files/Pods-AltServer/Pods-AltServer.release.xcconfig
generated
Normal file
11
Pods/Target Support Files/Pods-AltServer/Pods-AltServer.release.xcconfig
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
CODE_SIGN_IDENTITY =
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask/STPrivilegedTask.framework/Headers"
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask/STPrivilegedTask.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "STPrivilegedTask" -framework "Security"
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
@@ -160,14 +160,6 @@ if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/KeychainAccess/KeychainAccess.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Nuke/Nuke.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Debug-Beta" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/KeychainAccess/KeychainAccess.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Nuke/Nuke.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release-Beta" ]]; then
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/KeychainAccess/KeychainAccess.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Nuke/Nuke.framework"
|
||||
fi
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
wait
|
||||
fi
|
||||
|
||||
26
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-Info.plist
generated
Normal file
26
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-Info.plist
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
5
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-dummy.m
generated
Normal file
5
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-dummy.m
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_STPrivilegedTask : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_STPrivilegedTask
|
||||
@end
|
||||
12
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-prefix.pch
generated
Normal file
12
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-prefix.pch
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
17
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-umbrella.h
generated
Normal file
17
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask-umbrella.h
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "STPrivilegedTask.h"
|
||||
|
||||
FOUNDATION_EXPORT double STPrivilegedTaskVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char STPrivilegedTaskVersionString[];
|
||||
|
||||
6
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask.modulemap
generated
Normal file
6
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask.modulemap
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
framework module STPrivilegedTask {
|
||||
umbrella header "STPrivilegedTask-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
10
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask.xcconfig
generated
Normal file
10
Pods/Target Support Files/STPrivilegedTask/STPrivilegedTask.xcconfig
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
CODE_SIGN_IDENTITY =
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/STPrivilegedTask
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Security"
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/STPrivilegedTask
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
Reference in New Issue
Block a user