Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to WorkPlot. Newest first.
### Changed
- 🛠️ Every screen is now English only, and status/error messages render properly instead of placeholder strings like "Common Failprefix".
- 📱 Device Spoof: tapping the card expands the wheel picker inline, matching the subtype tweak configuration style.
- 📱 Device Spoof now lives in the tweak catalog as a tile — tap to toggle, wheel picker inline, applied with the staged batch (full identity blast unchanged).
- 🧾 Credits trimmed: dropped the 3105 entry after its feature was removed; FilzaSlop is now credited as class-13 research only.

### Removed
Expand Down
83 changes: 0 additions & 83 deletions WorkPlot/Features/Gestalt/DeviceSpoofingManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,46 +109,6 @@ enum DeviceSpoofingManager {
"j9Th5smJpdztHwc+i39zIg"
]

/// Number of CacheExtra keys this target would change on the given
/// plist (artwork subkeys count individually). Used for the UI summary.
static func changedKeyCount(in plist: [String: Any], target: SpoofTarget) -> Int {
guard let cacheExtra = plist["CacheExtra"] as? [String: Any] else { return 0 }
var count = 0

func countsChange(_ key: String, _ value: String) {
if cacheExtra[key] as? String != value { count += 1 }
}

for key in productTypeKeys { countsChange(key, target.productType) }
for key in hwModelKeys { countsChange(key, target.hwModel) }
for key in deviceNameKeys where cacheExtra[key] != nil {
countsChange(key, target.marketingName)
}

if let artwork = cacheExtra[GestaltArtwork.artworkKey] as? [String: Any] {
if artwork["CompatibleDeviceFallback"] as? String != target.productType { count += 1 }
if artwork["ArtworkDeviceProductDescription"] as? String != target.marketingName { count += 1 }
}

return count
}

/// Real hardware identity from sysctl, deliberately ignoring any
/// spoofed CacheExtra ProductType.
static var realMachineIdentifier: String {
DeviceCapability.machineIdentifier
}

/// Returns the currently spoofed target by matching any ProductType key,
/// or nil when no ProductType matches a known spoof entry.
static func currentTarget(in plist: [String: Any]) -> SpoofTarget? {
let cacheExtra = plist["CacheExtra"] as? [String: Any] ?? [:]
let values = Set(
productTypeKeys.compactMap { cacheExtra[$0] as? String }
)
return targets.first { values.contains($0.productType) }
}

/// Rewrites every model-related key to the target device at once.
/// Owner rule (enforced by Support/check-feature.ps1): the ArtworkDevice
/// dictionary must already exist - a device without it cannot render the
Expand Down Expand Up @@ -186,47 +146,4 @@ enum DeviceSpoofingManager {

plist["CacheExtra"] = cacheExtra
}

/// Read-back verification: how many of the spoof's identity keys now
/// carry exactly the target value on disk. Distinguishes a write the
/// system dropped from one that genuinely landed (the OS may still
/// choose to ignore CacheExtra on builds where CacheData is authoritative).
static func verify(target: SpoofTarget, in plist: [String: Any]) -> (matched: Int, total: Int) {
guard let cacheExtra = plist["CacheExtra"] as? [String: Any] else { return (0, 0) }
var matched = 0
var total = 0

func counts(_ key: String, _ value: String) {
total += 1
if cacheExtra[key] as? String == value { matched += 1 }
}

for key in productTypeKeys { counts(key, target.productType) }
for key in hwModelKeys { counts(key, target.hwModel) }
for key in deviceNameKeys where cacheExtra[key] != nil {
counts(key, target.marketingName)
}

if let artwork = cacheExtra[GestaltArtwork.artworkKey] as? [String: Any] {
counts("CompatibleDeviceFallback-artwork", "")
total -= 1
if artwork["CompatibleDeviceFallback"] as? String == target.productType { matched += 1 }
total += 1
if artwork["ArtworkDeviceProductDescription"] as? String == target.marketingName { matched += 1 }
}

return (matched, total)
}

/// Restoring the genuine identity requires a pre-spoof backup — restore
/// it from the Backups tab and every key above reverts atomically with
/// the whole plist. This helper only clears the spoofed name overrides,
/// leaving identifier keys untouched.
@discardableResult
static func clearDeviceNames(in plist: inout [String: Any]) -> Bool {
guard var cacheExtra = plist["CacheExtra"] as? [String: Any] else { return false }
for key in deviceNameKeys { cacheExtra.removeValue(forKey: key) }
plist["CacheExtra"] = cacheExtra
return true
}
}
59 changes: 16 additions & 43 deletions WorkPlot/Models/GestaltStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ final class GestaltStore: ObservableObject {
var applied = 0
var warnings: [String] = []

for tweak in tweaks where tweak.isEnabled && (ids == nil || ids!.contains(tweak.id)) {
for tweak in tweaks where tweak.isEnabled && (ids == nil || ids!.contains(tweak.id)) && tweak.id != Tweak.deviceSpoofTweakID {
do {
var mods = tweak.modifications
if let detail = tweak.detail {
Expand Down Expand Up @@ -329,6 +329,21 @@ final class GestaltStore: ObservableObject {

plist["CacheExtra"] = cacheExtra

// Full-identity device spoof — runs after the generic pass above so
// its CacheExtra writes aren't clobbered by the stale local copy.
// Index 0 ("None") is a no-op; the manager refuses loudly (throws)
// when CacheExtra/ArtworkDevice is missing, aborting before any
// disk write happens.
for tweak in tweaks where tweak.isEnabled && (ids == nil || ids!.contains(tweak.id)) && tweak.id == Tweak.deviceSpoofTweakID {
let index = tweak.selectedIndex
guard index > 0, index - 1 < DeviceSpoofingManager.targets.count else {
warnings.append("\(tweak.title): invalid picker selection, skipped.")
continue
}
try DeviceSpoofingManager.apply(DeviceSpoofingManager.targets[index - 1], to: &plist)
applied += 1
}

// Optional binary patch (iPadOS).
var binaryPatch = false
if tweaks.contains(where: { $0.isEnabled && $0.requiresCacheDataPatch && (ids == nil || ids!.contains($0.id)) }) {
Expand Down Expand Up @@ -475,48 +490,6 @@ final class GestaltStore: ObservableObject {
return result
}

/// Spoof seluruh identitas perangkat (ProductType, HWModel, CPU, nama
/// pemasaran) ke target terpilih melalui `DeviceSpoofingManager`, pakai
/// engine baca/tulis/backup yang sama dengan `apply()`.
func applyDeviceSpoof(_ target: SpoofTarget) async throws {
guard !isBusy else { throw ApplyError.busy }
isBusy = true
defer { isBusy = false }

let access = MobileGestaltAccess()
guard (try? access.activate()) != nil else { throw ApplyError.activationFailed }
defer { access.deactivate() }
guard let path = access.mobileGestaltPath else { throw ApplyError.missingPath }
let url = URL(fileURLWithPath: path)

let current = try Data(contentsOf: url)
let hadBackup = backup.hasBackup
try backup.ensureBackup(from: current)
guard var plist = try PropertyListSerialization.propertyList(
from: current, format: nil) as? [String: Any]
else { throw ApplyError.badPlist }

try DeviceSpoofingManager.apply(target, to: &plist)

let newData = try PropertyListSerialization.data(
fromPropertyList: plist, format: .binary, options: 0)
do {
try newData.write(to: url, options: [])
} catch {
try? backup.restoreData().write(to: url, options: [])
throw ApplyError.writeFailed
}
guard let readback = try? Data(contentsOf: url), readback == newData else {
try? backup.restoreData().write(to: url, options: [])
throw ApplyError.writeVerificationFailed
}
isDeviceSpoofed = true
lastApply = ApplyResult(
appliedCount: 1, warnings: [], binaryPatchApplied: false,
backedUpFirstTime: !hadBackup)
lastError = nil
}

/// Reverses whatever `applyAIRegion()` changed — restores every AI
/// region key to the value `snapshotAIRegionKeyIfNeeded` saved before
/// WorkPlot first touched it (removing keys that didn't exist before),
Expand Down
3 changes: 3 additions & 0 deletions WorkPlot/Models/Tweak.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ enum TextFieldKind: Equatable {
// MARK: - Tweak

struct Tweak: Identifiable, Equatable {
/// Applied via DeviceSpoofingManager instead of plain modifications.
static let deviceSpoofTweakID = "devicespoof"

let id: String
let title: String
let subtitle: String
Expand Down
34 changes: 11 additions & 23 deletions WorkPlot/Models/Tweaks/DeviceTweaks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,21 @@ enum DeviceTweaks {
value: .keepCurrent, isPicker: true)
]
),
// Full-identity spoof routed through DeviceSpoofingManager in
// GestaltStore.apply() — its write-set spans ~20 CacheExtra keys and
// name keys that only overwrite when already cached, which plain
// GestaltModifications can't express.
Tweak(
id: "product-type",
title: "Device Spoof (ProductType)",
id: Tweak.deviceSpoofTweakID,
title: "Device Spoof",
subtitle: "Spoof the reported model for Apple Intelligence eligibility.",
category: .device,
symbol: "cpu",
symbol: "iphone.and.arrow.forward",
isRisky: true,
notes: "Spoof to an AI-capable model, back, then to your final model — the AI icon appears in Settings. Don't re-enter Apple Intelligence & Siri settings after un-spoofing. May break Face ID if you keep the spoof.",
detail: .picker(options: [
"Default (real model)",
"iPhone 15 Pro",
"iPhone 15 Pro Max",
"iPhone 16",
"iPhone 16 Plus",
"iPhone 16 Pro",
"iPhone 16 Pro Max",
"iPhone 17",
"iPhone 17 Pro",
"iPhone 17 Pro Max",
"iPhone Air",
]),
pickerValues: [.remove, .string("iPhone16,1"), .string("iPhone16,2"), .string("iPhone17,3"), .string("iPhone17,4"), .string("iPhone17,1"), .string("iPhone17,2"), .string("iPhone18,3"), .string("iPhone18,1"), .string("iPhone18,2"), .string("iPhone18,4")],
modifications: [
GestaltModification(key: "h9jDsbgj7xIVeIQ8S3/X3Q",
subkey: nil,
value: .remove, isPicker: true)
]
notes: "Spoofs every model-identity key at once (ProductType, board, marketing name). May break Face ID until reverted — restore the pristine backup to undo. 'None' keeps your real identity.",
detail: .picker(options:
["None (Real Identity)"] + DeviceSpoofingManager.targets.map(\.marketingName)),
modifications: []
),
]
}
126 changes: 0 additions & 126 deletions WorkPlot/UI/DeviceSpoofingView.swift

This file was deleted.

5 changes: 2 additions & 3 deletions WorkPlot/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct HomeView: View {
/// "All" selected: one flat sequential list — tweaks and tools interleaved,
/// no category grouping.
private var flatCatalog: some View {
let tweaks = store.tweaks.filter { $0.id != "product-type" && $0.category != .ai && matchesSearch($0.title) }
let tweaks = store.tweaks.filter { $0.category != .ai && matchesSearch($0.title) }
let tools = toolDefs.filter { $0.id != "respring" && matchesSearch($0.title) }
var cells: [FlatCell] = []
var ti = 0, to = 0
Expand Down Expand Up @@ -172,7 +172,7 @@ struct HomeView: View {
}

private func categorySection(_ cat: TweakCategory) -> some View {
let tweaks = store.tweaks.filter { $0.category == cat && $0.id != "product-type" && matchesSearch($0.title) }
let tweaks = store.tweaks.filter { $0.category == cat && matchesSearch($0.title) }
let tools = toolDefs.filter { $0.category == cat && $0.id != "respring" && matchesSearch($0.title) }
// Tools flow into the last half-empty tweak row instead of starting
// their own group, so an odd tweak count leaves no gap mid-catalog.
Expand Down Expand Up @@ -214,7 +214,6 @@ struct HomeView: View {
ToolDef(id: "carplay", title: "CarPlay Wallpaper", subtitle: "Change the CarPlay wallpaper", symbol: "car", category: .display, destination: { AnyView(CarPlayWallpaperView()) }),
ToolDef(id: "rdarfix", title: "RDARFix", subtitle: "Edit screen resolution via the canvas exploit", symbol: "wand.and.stars", category: .display, destination: { AnyView(RDARFixView()) }),
ToolDef(id: "respring", title: "Respring", subtitle: "Restart SpringBoard without rebooting", symbol: "arrow.clockwise", category: .system, action: { RespringHelper.shared.trigger() }),
ToolDef(id: "devicespoof", title: "Device Spoof", subtitle: "Spoof the device identity", symbol: "iphone.and.arrow.forward", category: .system, destination: { AnyView(DeviceSpoofingView()) }),
ToolDef(id: "gestalteditor", title: "Gestalt Field Editor", subtitle: "Edit cache MobileGestalt", symbol: "slider.horizontal.3", category: .gestalt, destination: { AnyView(GestaltFieldEditorView()) }),
ToolDef(id: "presetlab", title: "Preset Lab", subtitle: "Build & save Gestalt presets", symbol: "flask", category: .gestalt, destination: { AnyView(PresetLabView()) }),
ToolDef(id: "sessionlog", title: "Session Log", subtitle: "View exploit session debug logs", symbol: "doc.plaintext", category: .info, destination: { AnyView(SessionLogView()) }),
Expand Down
Loading