Skip to content

Commit

Permalink
4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-tamago committed Dec 29, 2022
1 parent 5d4960f commit a07ac65
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 40 deletions.
8 changes: 6 additions & 2 deletions NoCameraSound/NoCameraSound.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
3D16394B295C4ABF006D31D8 /* vm_unaligned_copy_switch_race.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D16394A295C4ABF006D31D8 /* vm_unaligned_copy_switch_race.c */; };
3D163953295C7029006D31D8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D163955295C7029006D31D8 /* Localizable.strings */; };
3D163959295C7810006D31D8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D163958295C7810006D31D8 /* Assets.xcassets */; };
3D2342AB295D31BD00A6E40D /* plist in Resources */ = {isa = PBXBuildFile; fileRef = 3D2342AA295D31BD00A6E40D /* plist */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -28,6 +29,7 @@
3D16394A295C4ABF006D31D8 /* vm_unaligned_copy_switch_race.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vm_unaligned_copy_switch_race.c; sourceTree = "<group>"; };
3D163954295C7029006D31D8 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
3D163958295C7810006D31D8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3D2342AA295D31BD00A6E40D /* plist */ = {isa = PBXFileReference; lastKnownFileType = folder; path = plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -69,6 +71,7 @@
3D163917295B520E006D31D8 /* NoCameraSound.swift */,
3D163919295B5227006D31D8 /* NoCameraSound-Bridging-Header.h */,
3D163958295C7810006D31D8 /* Assets.xcassets */,
3D2342AA295D31BD00A6E40D /* plist */,
3D16390D295B51DB006D31D8 /* Preview Content */,
);
path = NoCameraSound;
Expand Down Expand Up @@ -143,6 +146,7 @@
buildActionMask = 2147483647;
files = (
3D163953295C7029006D31D8 /* Localizable.strings in Resources */,
3D2342AB295D31BD00A6E40D /* plist in Resources */,
3D163959295C7810006D31D8 /* Assets.xcassets in Resources */,
3D16390F295B51DB006D31D8 /* Preview Assets.xcassets in Resources */,
);
Expand Down Expand Up @@ -313,7 +317,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.5;
MARKETING_VERSION = 4.6;
PRODUCT_BUNDLE_IDENTIFIER = "com.straight-tamago.NoCameraSound";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -347,7 +351,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.5;
MARKETING_VERSION = 4.6;
PRODUCT_BUNDLE_IDENTIFIER = "com.straight-tamago.NoCameraSound";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Binary file not shown.
108 changes: 72 additions & 36 deletions NoCameraSound/NoCameraSound/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ import SwiftUI

struct ContentView: View {
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
@State private var message = ""
@State private var showingAlert = false
@State private var LogMessage = ""
@State private var LogText = ""
@State private var ViewLog = false
@State private var SettingsShowing = false
@State private var ios14Warning = false
var body: some View {
VStack {
Text("NoCameraSound").font(.largeTitle).fontWeight(.bold)
Text("NoCameraSound").font(.largeTitle).fontWeight(.bold)
HStack {
Button("Disable Shutter Sound") {
LogText = ""
ac()
ac()
ac()
Expand All @@ -29,20 +33,25 @@ struct ContentView: View {
.shadow(color: Color.purple, radius: 15, x: 0, y: 5)

Button {
showingAlert = true
if #available(iOS 15.0, *) {
SettingsShowing = true
}
else {
ios14Warning = true
}
} label: {
Image(systemName: "info.circle")
.padding()
.accentColor(Color.white)
.background(Color.blue)
.cornerRadius(26)
.shadow(color: Color.purple, radius: 15, x: 0, y: 5)
}.actionSheet(isPresented: $showingAlert) {
}.actionSheet(isPresented: $SettingsShowing) {
ActionSheet(title: Text("NoCameraSound v\(version)"), message: Text("by straight-tamago"), buttons: [
.default(Text("Source Code")) {
if let url = URL(string: "https://github.com/straight-tamago/NoCameraSound") {
UIApplication.shared.open(url)
}
if let url = URL(string: "https://github.com/straight-tamago/NoCameraSound") {
UIApplication.shared.open(url)
}
},
.default(Text("MacDirtyCowDemo (Exploit)")) {
if let url = URL(string: "https://github.com/zhuowei/MacDirtyCowDemo") {
Expand All @@ -56,6 +65,16 @@ struct ContentView: View {
UserDefaults.standard.set(true, forKey: "AutoRun")
}
},
.default(Text("\(NSLocalizedString("View Log (Status: ", comment: ""))"+String(UserDefaults.standard.bool(forKey: "ViewLog"))+")")) {
if UserDefaults.standard.bool(forKey: "ViewLog") == true {
UserDefaults.standard.set(false, forKey: "ViewLog")
ViewLog = false
}else {
UserDefaults.standard.set(true, forKey: "ViewLog")
ViewLog = true

}
},
.default(Text("\(NSLocalizedString("Camera silent + English notation (JP Only) (Status: ", comment: ""))"+String(UserDefaults.standard.bool(forKey: "Visibility"))+")")) {
if Locale.preferredLanguages.first! == "ja-JP" {
if UserDefaults.standard.bool(forKey: "Visibility") == true {
Expand All @@ -67,48 +86,65 @@ struct ContentView: View {
},
.cancel()
])
}.alert(isPresented: $ios14Warning) {
Alert(title: Text("IOS14 Warning"),
message: Text("In iOS14, once executed, it will not revert."),
dismissButton: .default(Text("Run"))
)
}
}
Text(message).padding(16)
if ViewLog {
TextEditor(text: $LogText)
.frame(width: 300, height: 200)
.border(Color.black, width: 1)
.padding()
.transition(.slide)
}else {
Text(LogMessage)
}
}.onAppear {
if UserDefaults.standard.bool(forKey: "AutoRun") == true {
LogText = "(AutoRun)"+"\n"
ac()
ac()
ac()
ac()
ac()
}
if UserDefaults.standard.bool(forKey: "ViewLog") == true {
ViewLog = true
}
}
}
func ac() {
message = "photoShutter.caf"
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/photoShutter.caf") {
message = $0
}
message = "begin_record.caf"
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/begin_record.caf") {
message = $0
}
message = "end_record.caf"
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/end_record.caf") {
message = $0
}
message = "camera_shutter_burst.caf"
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst.caf") {
message = $0
}
message = "camera_shutter_burst_begin.caf"
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_begin.caf") {
message = $0
}
message = "camera_shutter_burst_end.caf"
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_end.caf") {
message = $0
}
if UserDefaults.standard.bool(forKey: "Visibility") == true && Locale.preferredLanguages.first! == "ja-JP" {
message = "CameraUI.strings"
overwriteAsync(TargetFilePath: "/System/Library/PrivateFrameworks/CameraUI.framework/ja.lproj/CameraUI.strings") {
message = $0
LogText += "photoShutter.caf - "+$0+"\n"
LogMessage = $0
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/begin_record.caf") {
LogText += "begin_record.caf - "+$0+"\n"
LogMessage = $0
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/end_record.caf") {
LogText += "end_record.caf - "+$0+"\n"
LogMessage = $0
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst.caf") {
LogText += "camera_shutter_burst.caf - "+$0+"\n"
LogMessage = $0
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_begin.caf") {
LogText += "camera_shutter_burst_begin.caf - "+$0+"\n"
LogMessage = $0
overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_end.caf") {
LogText += "camera_shutter_burst_end.caf - "+$0+"\n"
LogMessage = $0
if UserDefaults.standard.bool(forKey: "Visibility") == true && Locale.preferredLanguages.first! == "ja-JP" {
overwriteAsync(TargetFilePath: "/System/Library/PrivateFrameworks/CameraUI.framework/ja.lproj/CameraUI.strings") {
LogText += "CameraUI.strings - "+$0+"\n"
LogMessage = $0
}
}
}
}
}
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion NoCameraSound/NoCameraSound/NoCameraSound.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ func overwriteAsync(TargetFilePath: String, completion: @escaping (String) -> Vo
}

func overwrite(TargetFilePath: String) -> Bool {
let OverwriteFileData = "xxx".data(using: .utf8)!
// let OverwriteFileData = "xxx".data(using: .utf8)!
guard let OverwriteFileURL = Bundle.main.url(forResource: "Info.plist", withExtension: nil, subdirectory: "plist") else {
fatalError("ファイルが見つからない")
}
let OverwriteFileData = try! Data(contentsOf: OverwriteFileURL)
let fd = open(TargetFilePath, O_RDONLY | O_CLOEXEC)
defer { close(fd) }
let Map = mmap(nil, OverwriteFileData.count, PROT_READ, MAP_SHARED, fd, 0)
Expand Down
3 changes: 2 additions & 1 deletion NoCameraSound/NoCameraSound/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

"by straight-tamago" = "by すとれーとたまご★";
"Auto run when the app starts (Status: " = "アプリ起動時に無音化自動実行 (状態: ";
"Camera silent + English notation (JP Only) (Status: " = "(視認性) 無音時にカメラを英語表記にする (状態: ";
"Camera silent + English notation (JP Only) (Status: " = "(書き換えに成功したか) 無音化時にカメラを英語表記にする (状態: ";
"View Log (Status: " = "ログを表示 (状態: ";
Binary file added NoCameraSound/NoCameraSound/plist/Info.plist
Binary file not shown.

0 comments on commit a07ac65

Please sign in to comment.