Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-tamago authored Jan 19, 2023
1 parent 0e848d2 commit 9d991f0
Show file tree
Hide file tree
Showing 58 changed files with 2,566 additions and 0 deletions.
408 changes: 408 additions & 0 deletions FileSwitcherX.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "20518119-5C4F-4C7F-A027-CEF5557A96E5"
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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>SchemeUserState</key>
<dict>
<key>FileSwitcherX.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"}]}
901 changes: 901 additions & 0 deletions FileSwitcherX/ContentView.swift

Large diffs are not rendered by default.

151 changes: 151 additions & 0 deletions FileSwitcherX/FileManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
//
// FileManager.swift
// FileSwitcherX
//
// Created by mini on 2023/01/10.
//

import Foundation

struct FileOperator {
private let fileManager = FileManager.default
private let rootDirectory = NSHomeDirectory() + "/Documents"

init() {
// ルートディレクトリを作成する
createDirectory(atPath: "")
}

private func convertPath(_ path: String) -> String {
if path.hasPrefix("/") {
return rootDirectory + path
}
return rootDirectory + "/" + path
}

/// ディレクトリを作成する
/// - Parameter path: 対象パス
func createDirectory(atPath path: String) {
if fileExists(atPath: path) {
return
}
do {
try fileManager.createDirectory(atPath: convertPath(path), withIntermediateDirectories: false, attributes: nil)
} catch let error {
print(error.localizedDescription)
}
}

/// ファイルを作成する
/// - Parameters:
/// - path: 保存先ファイルパス
/// - contents: コンテンツ
func createFile(atPath path: String, contents: Data?) {
// 同名ファイルがある場合は上書きされるので判定いるかも?
// if fileExists(atPath: path) {
// print("already exists file: \(NSString(string: path).lastPathComponent)")
// return
// }
if !fileManager.createFile(atPath: convertPath(path), contents: contents, attributes: nil) {
print("Create file error")
}
}

/// ファイルがあるか確認する
/// - Parameter path: 対象ファイルパス
/// - Returns: ファイルがあるかどうか
func fileExists(atPath path: String) -> Bool {
return fileManager.fileExists(atPath: convertPath(path))
}

/// 対象パスがディレクトリか確認する
/// - Parameter path: 対象パス
/// - Returns:ディレクトリかどうか(存在しない場合もfalse)
func isDirectory(atPath path: String) -> Bool {
var isDirectory: ObjCBool = false
fileManager.fileExists(atPath: convertPath(path), isDirectory: &isDirectory)
return isDirectory.boolValue
}

/// ファイルを移動する
/// - Parameters:
/// - srcPath: 移動元ファイルパス
/// - dstPath: 移動先ファイルパス
func moveItem(atPath srcPath: String, toPath dstPath: String) {
// 移動先に同名ファイルが存在する場合はエラー
do {
try fileManager.moveItem(atPath: convertPath(srcPath), toPath: convertPath(dstPath))
} catch let error {
print(error.localizedDescription)
}
}

/// ファイルをコピーする
/// - Parameters:
/// - srcPath: コピー元ファイルパス
/// - dstPath: コピー先ファイルパス
func copyItem(atPath srcPath: String, toPath dstPath: String) {
// コピー先に同名ファイルが存在する場合はエラー
do {
try fileManager.copyItem(atPath: convertPath(srcPath), toPath: convertPath(dstPath))
} catch let error {
print(error.localizedDescription)
}
}

/// ファイルを削除する
/// - Parameter path: 対象ファイルパス
func removeItem(atPath path: String) {
do {
try fileManager.removeItem(atPath: convertPath(path))
} catch let error {
print(error.localizedDescription)
}
}

/// ファイルをリネームする
/// - Parameters:
/// - path: 対象ファイルパス
/// - newName: 変更後のファイル名
func renameItem(atPath path: String, to newName: String) {
let srcPath = path
let dstPath = NSString(string: NSString(string: srcPath).deletingLastPathComponent).appendingPathComponent(newName)
moveItem(atPath: srcPath, toPath: dstPath)
}

// ディレクトリ内のアイテムのパスを取得する
/// - Parameter path: 対象ディレクトリパス
/// - Returns:対象ディレクトリ内のアイテムのパス一覧
func contentsOfDirectory(atPath path: String) -> [String] {
do {
return try fileManager.contentsOfDirectory(atPath: convertPath(path))
} catch let error {
print(error.localizedDescription)
return []
}
}

/// ディレクトリ内のアイテムのパスを再帰的に取得する
/// - Parameter path: 対象ディレクトリパス
/// - Returns:対象ディレクトリ内のアイテムのパス一覧
func subpathsOfDirectory(atPath path: String) -> [String] {
do {
return try fileManager.subpathsOfDirectory(atPath: convertPath(path))
} catch let error {
print(error.localizedDescription)
return []
}
}

/// ファイル情報を取得する
/// - Parameter path: 対象ファイルパス
/// - Returns: 対象ファイルの情報(作成日など)
func attributesOfItem(atPath path: String) -> [FileAttributeKey : Any] {
do {
return try fileManager.attributesOfItem(atPath: convertPath(path))
} catch let error {
print(error.localizedDescription)
return [:]
}
}
}
6 changes: 6 additions & 0 deletions FileSwitcherX/FileSwitcherX-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "vm_unaligned_copy_switch_race.h"
#import "poc.h"
63 changes: 63 additions & 0 deletions FileSwitcherX/FileSwitcherXApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//
// FileSwitcherXApp.swift
// FileSwitcherX
//
// Created by mini on 2023/01/06.
//

import SwiftUI
import CoreLocation
import UserNotifications

@main
struct FileSwitcherXApp: App {
//AppDelegateを設定できるようにする
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

var body: some Scene {
WindowGroup {
ContentView()
}
}
}


class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
var locationManager: CLLocationManager!

// アプリの起動時
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {

let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.willResignActiveNotification, object: nil)

return true
}

@objc func appMovedToBackground() {
print("App moved to background!")
if UserDefaults.standard.bool(forKey: "Location") == true {
locationManager = CLLocationManager()
locationManager.requestAlwaysAuthorization()
locationManager.showsBackgroundLocationIndicator = UserDefaults.standard.bool(forKey: "Location_Indicator")
locationManager.distanceFilter = 1
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.allowsBackgroundLocationUpdates = true //バックグラウンド処理を可能にする
locationManager.pausesLocationUpdatesAutomatically = false //ポーズしても位置取得を続ける
locationManager.delegate = self

locationManager.startMonitoringSignificantLocationChanges()
locationManager.startUpdatingLocation()
}
}
@objc func appMovedToForeground() {
print("App moved to foreground!")
locationManager.stopMonitoringSignificantLocationChanges()
locationManager.stopUpdatingLocation()
}

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
print("OK")
}
}
12 changes: 12 additions & 0 deletions FileSwitcherX/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
26 changes: 26 additions & 0 deletions FileSwitcherX/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Localizable.strings
FileSwitcherX

Created by mini on 2023/01/11.

*/
"Update Check" = "Update Check";
"Update available" = "Update available";
"Do you want to download the update from the Github ?" = "Do you want to download the update from the Github ?";
"OK" = "OK";
"Cancel" = "Cancel";
"No Update" = "No Update";
"Apply" = "Apply";
"Settings" = "Settings";
"File disabled?:" = "File disabled?:";
"To Disable" = "To Disable";
"To Enable" = "To Enable";
"Auto run when the app starts (Status: " = "Auto run when the app starts (Status: ";
"by straight-tamago" = "by straight-tamago";
"Path:" = "Path:";
"Replace OFF" = "Replace OFF";
"Replace ON" = "Replace ON";
"Run in background (Status: " = "Run in background (Status: ";
"\n[Location service required]" = "\n[Location service required]";
"Location Indicator (Status: " = "Location Indicator (Status: ";
14 changes: 14 additions & 0 deletions FileSwitcherX/exploit/poc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// poc.h
// POCTester
//
// Created by Анохин Юрий on 20.12.2022.
//

#ifndef poc_h
#define poc_h

#include <stdio.h>
@import Foundation;
void overwriteFileS(NSData *data, NSString *path);
#endif /* poc_h */
Loading

0 comments on commit 9d991f0

Please sign in to comment.