Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions RyukSign/Backend/Observable/OptionsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ struct Options: Codable, Equatable {
var injectFolder: InjectFolder
/// Random string appended to the app identifier
var ppqString: String
/// Basic protection against PPQ
var ppqProtection: Bool
/// Protection mode against PPQ
var ppqProtection: PPQProtection
/// (Better) protection against PPQ
var dynamicProtection: Bool
/// App identifiers list which matches and replaces
Expand Down Expand Up @@ -119,7 +119,7 @@ struct Options: Codable, Equatable {
var post_installAppAfterSigned: Bool
/// This will delete your imported application after signing, to save on using unneeded space.
var post_deleteAppAfterSigned: Bool

// MARK: - Defaults
static let defaultOptions = Options(

Expand All @@ -134,7 +134,7 @@ struct Options: Codable, Equatable {
injectPath: .executable_path,
injectFolder: .frameworks,
ppqString: "AN0X1",
ppqProtection: true,
ppqProtection: .ryuk,
dynamicProtection: false,
identifiers: [:],
displayNames: [:],
Expand Down Expand Up @@ -220,6 +220,20 @@ struct Options: Codable, Equatable {
case root = "/"
case frameworks = "/Frameworks/"
}

enum PPQProtection: String, Codable, CaseIterable, LocalizedDescribable {
/// Keep the original bundle identifier (no transformation)
case `default`
/// Ryuk method: prefix with "ryuk", replace known keywords, append ppqString
case ryuk = "Ryuk"

var localizedDescription: String {
switch self {
case .default: .localized("Original")
case .ryuk: "Ryuk"
}
}
}

/// Default random value for `ppqString`
static func randomString() -> String {
Expand All @@ -244,7 +258,7 @@ extension Options {
injectPath = try c.decodeIfPresent(InjectPath.self, forKey: .injectPath) ?? d.injectPath
injectFolder = try c.decodeIfPresent(InjectFolder.self, forKey: .injectFolder) ?? d.injectFolder
ppqString = try c.decodeIfPresent(String.self, forKey: .ppqString) ?? d.ppqString
ppqProtection = try c.decodeIfPresent(Bool.self, forKey: .ppqProtection) ?? d.ppqProtection
ppqProtection = (try? c.decode(PPQProtection.self, forKey: .ppqProtection)) ?? d.ppqProtection
dynamicProtection = try c.decodeIfPresent(Bool.self, forKey: .dynamicProtection) ?? d.dynamicProtection
identifiers = try c.decodeIfPresent([String: String].self, forKey: .identifiers) ?? d.identifiers
displayNames = try c.decodeIfPresent([String: String].self, forKey: .displayNames) ?? d.displayNames
Expand Down
8 changes: 4 additions & 4 deletions RyukSign/Views/Signing/Shared/SigningOptionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ struct SigningOptionsView: View {
var body: some View {
if (temporaryOptions == nil) {
NBSection(.localized("Protection")) {
_toggle(
Self.picker(
.localized("PPQ Protection"),
systemImage: "shield",
isOn: $options.ppqProtection,
temporaryValue: temporaryOptions?.ppqProtection
selection: $options.ppqProtection,
values: Options.PPQProtection.allCases
)
} footer: {
Text(.localized("Enabling any protection will append a random string to the bundleidentifiers of the apps you sign, this is to ensure your Apple ID does not get flagged by Apple. However, when using a signing service you can ignore this."))
Text(.localized("Default keeps the original bundle identifier unchanged. Ryuk transforms it (ryuk prefix, keyword replacement, PPQ suffix) to help prevent your Apple ID from being flagged by Apple. When using a signing service you can ignore this."))
}
}

Expand Down
6 changes: 2 additions & 4 deletions RyukSign/Views/Signing/SigningView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ struct SigningView: View {

// ppq protection
if
_optionsManager.options.ppqProtection,
let identifier = app.identifier,
let cert = _selectedCert(),
cert.ppQCheck
_optionsManager.options.ppqProtection == .ryuk,
let identifier = app.identifier
{
var modifiedId = identifier
.replacingOccurrences(of: "google", with: "ryu", options: .caseInsensitive)
Expand Down