25-3/18/1
155
ios/Runner/AppDelegate.swift
Normal file → Executable file
@@ -2,61 +2,158 @@ import UIKit
|
||||
import Flutter
|
||||
import FirebaseCore
|
||||
import GoogleMaps
|
||||
import CoreLocation // ✅ استيراد CoreLocation لتحديث الموقع
|
||||
import CoreLocation
|
||||
|
||||
@main
|
||||
@objc class AppDelegate: FlutterAppDelegate, CLLocationManagerDelegate {
|
||||
var locationManager: CLLocationManager?
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
|
||||
let locationManager = CLLocationManager()
|
||||
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GMSServices.provideAPIKey(Constants.googleMapsAPIKey)
|
||||
|
||||
// تحميل Google Maps API Key في خيط خلفي
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
if let config = self.loadConfig(), let apiKey = config["APIKey"] as? String {
|
||||
DispatchQueue.main.async {
|
||||
GMSServices.provideAPIKey(apiKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// تهيئة Firebase
|
||||
FirebaseApp.configure()
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
|
||||
if JailbreakDetection.isJailbroken() {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
self.showJailbreakAlert()
|
||||
}
|
||||
// التأكد من أن الجهاز غير مخترق قبل تشغيل التطبيق
|
||||
if SecurityChecks.isDeviceCompromised() {
|
||||
showSecurityAlert()
|
||||
return false
|
||||
}
|
||||
|
||||
// ✅ تفعيل تحديث الموقع فور تشغيل التطبيق
|
||||
// startLocationUpdates()
|
||||
// تهيئة قنوات الاتصال مع Flutter
|
||||
setupMethodChannel()
|
||||
|
||||
// ضبط مدير الموقع لمتابعة تغييرات الأذونات
|
||||
locationManager.delegate = self
|
||||
locationManager.requestWhenInUseAuthorization() // طلب الأذونات فقط عند الحاجة
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
func startLocationUpdates() {
|
||||
locationManager = CLLocationManager()
|
||||
locationManager?.delegate = self
|
||||
locationManager?.desiredAccuracy = kCLLocationAccuracyBest
|
||||
locationManager?.allowsBackgroundLocationUpdates = true
|
||||
locationManager?.pausesLocationUpdatesAutomatically = false
|
||||
// MARK: - تهيئة القناة بين Swift و Flutter
|
||||
func setupMethodChannel() {
|
||||
guard let controller = window?.rootViewController as? FlutterViewController else {
|
||||
return
|
||||
}
|
||||
|
||||
locationManager?.requestAlwaysAuthorization() // ✅ طلب إذن الموقع
|
||||
locationManager?.startUpdatingLocation() // ✅ بدء التحديث
|
||||
let channel = FlutterMethodChannel(name: "com.sefer_driver/security",
|
||||
binaryMessenger: controller.binaryMessenger)
|
||||
channel.setMethodCallHandler { call, result in
|
||||
switch call.method {
|
||||
case "isNativeRooted":
|
||||
result(SecurityChecks.isDeviceCompromised())
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
||||
guard let location = locations.last else { return }
|
||||
print("📍 Location updated: \(location.coordinate.latitude), \(location.coordinate.longitude)")
|
||||
}
|
||||
|
||||
func showJailbreakAlert() {
|
||||
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else { return }
|
||||
// MARK: - عرض تنبيه عند اكتشاف جهاز مخترق
|
||||
func showSecurityAlert() {
|
||||
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else {
|
||||
exit(0)
|
||||
}
|
||||
|
||||
let alert = UIAlertController(
|
||||
title: "تحذير أمني",
|
||||
message: "تم اكتشاف أن جهازك يحتوي على جيلبريك. لا يمكن تشغيل التطبيق على هذا الجهاز.",
|
||||
title: "Security Warning".localized,
|
||||
message: "Compromised device detected. Exiting.".localized,
|
||||
preferredStyle: .alert
|
||||
)
|
||||
|
||||
alert.addAction(UIAlertAction(title: "إنهاء التطبيق", style: .destructive) { _ in
|
||||
exit(0)
|
||||
alert.addAction(UIAlertAction(title: "OK".localized, style: .destructive) { _ in
|
||||
self.obfuscatedExit()
|
||||
})
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
alert.popoverPresentationController?.sourceView = rootVC.view
|
||||
alert.popoverPresentationController?.sourceRect = CGRect(x: rootVC.view.bounds.midX, y: rootVC.view.bounds.midY, width: 0, height: 0)
|
||||
alert.popoverPresentationController?.permittedArrowDirections = []
|
||||
alert.presentationController?.delegate = self
|
||||
|
||||
if let presentationController = alert.presentationController as? UISheetPresentationController {
|
||||
presentationController.detents = [.medium()]
|
||||
presentationController.preferredCornerRadius = 20
|
||||
presentationController.prefersEdgeAttachedInCompactHeight = true
|
||||
presentationController.prefersGrabberVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
rootVC.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
// MARK: - إخفاء عملية الخروج بطريقة مشفرة
|
||||
func obfuscatedExit() {
|
||||
let selector = NSSelectorFromString(String(format: "%@%@", "ex", "it:"))
|
||||
if responds(to: selector) {
|
||||
perform(selector, with: 0)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - تحميل مفاتيح API بطريقة آمنة
|
||||
func loadConfig() -> [String: Any]? {
|
||||
guard let path = Bundle.main.path(forResource: "Config", ofType: "plist"),
|
||||
let config = NSDictionary(contentsOfFile: path) as? [String: Any] else {
|
||||
return nil
|
||||
}
|
||||
return config
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - التعامل مع أذونات الموقع بطريقة آمنة
|
||||
extension AppDelegate: CLLocationManagerDelegate {
|
||||
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
|
||||
if #available(iOS 14.0, *) {
|
||||
let status = manager.authorizationStatus
|
||||
switch status {
|
||||
case .authorizedWhenInUse, .authorizedAlways:
|
||||
print("Authorization granted")
|
||||
case .denied, .restricted:
|
||||
print("Authorization denied")
|
||||
case .notDetermined:
|
||||
manager.requestWhenInUseAuthorization()
|
||||
@unknown default:
|
||||
break
|
||||
}
|
||||
} else {
|
||||
// لنظام iOS 13 وما قبله، نستخدم الطريقة القديمة
|
||||
let status = CLLocationManager.authorizationStatus()
|
||||
switch status {
|
||||
case .authorizedWhenInUse, .authorizedAlways:
|
||||
print("Authorization granted")
|
||||
case .denied, .restricted:
|
||||
print("Authorization denied")
|
||||
case .notDetermined:
|
||||
manager.requestWhenInUseAuthorization()
|
||||
@unknown default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - منع إغلاق التنبيهات الأمنية
|
||||
extension AppDelegate: UIAdaptivePresentationControllerDelegate {
|
||||
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - دعم الترجمة للنصوص
|
||||
extension String {
|
||||
var localized: String {
|
||||
return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: "")
|
||||
}
|
||||
}
|
||||
|
||||
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png
Normal file → Executable file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png
Normal file → Executable file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png
Normal file → Executable file
|
Before Width: | Height: | Size: 467 KiB After Width: | Height: | Size: 467 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/108.png
Normal file → Executable file
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png
Normal file → Executable file
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png
Normal file → Executable file
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png
Normal file → Executable file
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png
Normal file → Executable file
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png
Normal file → Executable file
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png
Normal file → Executable file
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png
Normal file → Executable file
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png
Normal file → Executable file
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png
Normal file → Executable file
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png
Normal file → Executable file
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png
Normal file → Executable file
|
Before Width: | Height: | Size: 833 B After Width: | Height: | Size: 833 B |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png
Normal file → Executable file
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/234.png
Normal file → Executable file
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png
Normal file → Executable file
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/258.png
Normal file → Executable file
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png
Normal file → Executable file
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png
Normal file → Executable file
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png
Normal file → Executable file
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png
Normal file → Executable file
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png
Normal file → Executable file
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png
Normal file → Executable file
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png
Normal file → Executable file
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png
Normal file → Executable file
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png
Normal file → Executable file
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file → Executable file
0
ios/Runner/Base.lproj/LaunchScreen.storyboard
Normal file → Executable file
0
ios/Runner/Base.lproj/Main.storyboard
Normal file → Executable file
12
ios/Runner/Config.plist
Normal file → Executable file
@@ -1,12 +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">
|
||||
<!--
|
||||
Config.plist
|
||||
Runner
|
||||
|
||||
Created by Hamza Aleghwairyeen on 16/03/2025.
|
||||
Copyright (c) 2025 . All rights reserved.
|
||||
-->
|
||||
<plist version="1.0">
|
||||
<dict/>
|
||||
<dict>
|
||||
<key>APIKey</key>
|
||||
<string>AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
0
ios/Runner/Constants.swift
Normal file → Executable file
0
ios/Runner/Constants1.swift
Normal file → Executable file
0
ios/Runner/GoogleService-Info.plist
Normal file → Executable file
199
ios/Runner/Info.plist
Normal file → Executable file
@@ -1,110 +1,109 @@
|
||||
<?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>LSMinimumSystemVersion</key>
|
||||
<string>12.0</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>location</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>BGTaskSchedulerPermittedIdentifiers</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
</array>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>This app requires contacts access to function properly.</string>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true />
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Tripz Driver</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<dict>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>12.0</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>location</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>BGTaskSchedulerPermittedIdentifiers</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Tripz Driver</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>94</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>5.0.94</string>
|
||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||
<string>NO</string>
|
||||
<key>GMSApiKey</key>
|
||||
<string>YOUR_API_KEY</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string></string>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>googlechromes</string>
|
||||
<string>comgooglemaps</string>
|
||||
</array>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true />
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app requires access to your camera in order to scan QR codes and capture images
|
||||
</array>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>This app requires contacts access to function properly.</string>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Tripz Driver</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Tripz Driver</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>100</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>5.0.100</string>
|
||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||
<string>NO</string>
|
||||
<key>GMSApiKey</key>
|
||||
<string>YOUR_API_KEY</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string></string>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>googlechromes</string>
|
||||
<string>comgooglemaps</string>
|
||||
</array>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app requires access to your camera in order to scan QR codes and capture images
|
||||
for uploading and access to connect to a call.</string>
|
||||
<key>NSFaceIDUsageDescription</key>
|
||||
<string>Use Face ID to securely authenticate payment accounts.</string>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>This app needs access to your location to provide you with the best ride experience.
|
||||
<key>NSFaceIDUsageDescription</key>
|
||||
<string>Use Face ID to securely authenticate payment accounts.</string>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>This app needs access to your location to provide you with the best ride experience.
|
||||
Your location data will be used to find the nearest available cars and connect you with
|
||||
the closest captain for efficient and convenient rides.</string>
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<string>This app needs access to location.</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>This app needs access to your location to provide you with the best ride experience.
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<string>This app needs access to location.</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>This app needs access to your location to provide you with the best ride experience.
|
||||
Your location data will be used to find the nearest available cars and connect you with
|
||||
the closest captain for efficient and convenient rides.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>This app requires access to your microphone to record audio, allowing you to add
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>This app requires access to your microphone to record audio, allowing you to add
|
||||
voice recordings to your photos and videos and access to connect to a call.</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Explanation of why your app needs access to the photo library.</string>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true />
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false />
|
||||
</dict>
|
||||
</plist>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Explanation of why your app needs access to the photo library.</string>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
0
ios/Runner/JailbreakDetection.swift
Normal file → Executable file
0
ios/Runner/KeychainHelper.swift
Normal file → Executable file
1
ios/Runner/Runner-Bridging-Header.h
Normal file → Executable file
@@ -1 +1,2 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
#import "SecurityChecks.h"
|
||||
|
||||
0
ios/Runner/Runner.entitlements
Normal file → Executable file
12
ios/Runner/SecurityChecks.h
Normal file → Executable file
@@ -2,11 +2,15 @@
|
||||
// SecurityChecks.h
|
||||
// Runner
|
||||
//
|
||||
// Created by Hamza Aleghwairyeen on 16/03/2025.
|
||||
// Created by Hamza Aleghwairyeen on 17/03/2025.
|
||||
//
|
||||
|
||||
#ifndef SecurityChecks_h
|
||||
#define SecurityChecks_h
|
||||
// SecurityChecks.h
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h> // Import UIKit
|
||||
|
||||
@interface SecurityChecks : NSObject
|
||||
|
||||
#endif /* SecurityChecks_h */
|
||||
+ (BOOL)isDeviceCompromised; // Combined check
|
||||
|
||||
@end
|
||||
|
||||
191
ios/Runner/SecurityChecks.m
Normal file → Executable file
@@ -2,7 +2,196 @@
|
||||
// SecurityChecks.m
|
||||
// Runner
|
||||
//
|
||||
// Created by Hamza Aleghwairyeen on 16/03/2025.
|
||||
// Created by Hamza Aleghwairyeen on 17/03/2025.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
|
||||
#import "SecurityChecks.h"
|
||||
#import <sys/stat.h>
|
||||
#include <dlfcn.h>
|
||||
#import <sys/sysctl.h>
|
||||
#include <mach-o/dyld.h> // For _dyld_image_count and _dyld_get_image_name
|
||||
#include <unistd.h> // for fork()
|
||||
#include <sys/socket.h> //for socket, connect
|
||||
#include <netinet/in.h> // for sockaddr_in
|
||||
#include <arpa/inet.h> // for inet_pton
|
||||
|
||||
@implementation SecurityChecks
|
||||
|
||||
+ (BOOL)isDeviceJailbroken {
|
||||
// (Same jailbreak checks as before - from previous responses)
|
||||
// 1. Check for common jailbreak files
|
||||
NSArray *jailbreakPaths = @[
|
||||
@"/Applications/Cydia.app",
|
||||
// #if !TARGET_IPHONE_SIMULATOR
|
||||
// @"/bin/bash",
|
||||
// #endif
|
||||
@"/Library/MobileSubstrate/MobileSubstrate.dylib",
|
||||
@"/bin/bash",
|
||||
@"/usr/sbin/sshd",
|
||||
@"/etc/apt",
|
||||
@"/private/var/lib/apt/",
|
||||
@"/private/var/tmp/cydia.log",
|
||||
];
|
||||
|
||||
for (NSString *path in jailbreakPaths) {
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
|
||||
NSLog(@"Jailbreak file detected: %@", path);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Check if we can write outside the sandbox (a strong indicator)
|
||||
NSError *error = nil;
|
||||
NSString *testPath = @"/private/jailbreaktest.txt";
|
||||
[@"test" writeToFile:testPath atomically:YES encoding:NSUTF8StringEncoding error:&error];
|
||||
|
||||
if (!error) {
|
||||
// If we can write, it's jailbroken. Remove the file immediately.
|
||||
[[NSFileManager defaultManager] removeItemAtPath:testPath error:nil];
|
||||
NSLog(@"Sandbox write test indicates jailbreak.");
|
||||
return YES;
|
||||
}
|
||||
//3: Check for existence of the symbolic link /Applications.
|
||||
struct stat s;
|
||||
if (lstat("/Applications", &s) == 0) {
|
||||
if (S_ISLNK(s.st_mode)) {
|
||||
NSLog(@"Symbolic link /Applications exists, jailbroken");
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
//4:Check for dyld Libraries
|
||||
uint32_t count = _dyld_image_count();
|
||||
for (uint32_t i = 0 ; i < count ; ++i) {
|
||||
const char *dyld = _dyld_get_image_name(i);
|
||||
if (strstr(dyld, "MobileSubstrate") != NULL || strstr(dyld, "libcycript") != NULL) {
|
||||
NSLog(@"Suspicious dyld library found: %s", dyld);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
//5 Check if fork() is available. Sandboxed apps should not be able to call fork().
|
||||
#if !TARGET_IPHONE_SIMULATOR // Don't run this on the simulator
|
||||
int pid = fork();
|
||||
if (pid == 0)
|
||||
{
|
||||
//in child, exit immediately to avoid crashing.
|
||||
exit(0);
|
||||
} else if (pid > 0)
|
||||
{
|
||||
NSLog(@"Fork available. Likely jailbroken.");
|
||||
return YES; // Fork succeeded; likely jailbroken
|
||||
}
|
||||
#endif
|
||||
|
||||
return NO; // No jailbreak indicators found
|
||||
}
|
||||
+ (BOOL)isDebuggerAttached {
|
||||
int mib[4];
|
||||
struct kinfo_proc info;
|
||||
size_t size = sizeof(info);
|
||||
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC;
|
||||
mib[2] = KERN_PROC_PID;
|
||||
mib[3] = getpid();
|
||||
|
||||
sysctl(mib, 4, &info, &size, NULL, 0);
|
||||
|
||||
return (info.kp_proc.p_flag & P_TRACED) != 0;
|
||||
}
|
||||
|
||||
// Check for Frida's default port
|
||||
+ (BOOL)isFridaListeningOnDefaultPort {
|
||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock == -1) {
|
||||
return NO; // Couldn't create socket
|
||||
}
|
||||
|
||||
struct sockaddr_in sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(27042); // Default Frida port
|
||||
inet_pton(AF_INET, "127.0.0.1", &sa.sin_addr);
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&sa, sizeof(sa)) != -1) {
|
||||
NSLog(@"Frida default port (27042) is open.");
|
||||
close(sock);
|
||||
return YES;
|
||||
}
|
||||
|
||||
close(sock);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)isFridaDetected {
|
||||
int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
|
||||
size_t length;
|
||||
struct kinfo_proc *procs, *proc;
|
||||
|
||||
sysctl(name, 3, NULL, &length, NULL, 0);
|
||||
procs = malloc(length);
|
||||
sysctl(name, 3, procs, &length, NULL, 0);
|
||||
|
||||
for (proc = procs; (char *)proc < (char *)procs + length; proc++) {
|
||||
if (strstr(proc->kp_proc.p_comm, "frida") != NULL) {
|
||||
free(procs);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
free(procs);
|
||||
return NO;
|
||||
}
|
||||
// Check for loaded dylibs that indicate Frida
|
||||
+(BOOL) checkForFridaDylib{
|
||||
uint32_t count = _dyld_image_count();
|
||||
for (uint32_t i = 0 ; i < count ; ++i) {
|
||||
const char *dyld = _dyld_get_image_name(i);
|
||||
if (strstr(dyld, "FridaGadget") != NULL) { // Look for FridaGadget
|
||||
NSLog(@"FridaGadget dylib found: %s", dyld);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Check process name
|
||||
+ (BOOL)checkProcessName {
|
||||
NSString* processName = [[NSProcessInfo processInfo] processName];
|
||||
if ([processName containsString:@"Frida"]) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// A combined check for jailbreak and Frida
|
||||
+ (BOOL)isDeviceCompromised {
|
||||
if ([SecurityChecks isDeviceJailbroken]) {
|
||||
return YES;
|
||||
}
|
||||
if ([SecurityChecks isFridaListeningOnDefaultPort]) {
|
||||
return YES;
|
||||
}
|
||||
if ([SecurityChecks checkForFridaDylib]) {
|
||||
return YES;
|
||||
}
|
||||
if([SecurityChecks checkProcessName]){
|
||||
return YES;
|
||||
}
|
||||
// if ([SecurityChecks isDebuggerAttached]) {
|
||||
// return YES;
|
||||
// }
|
||||
// if ([SecurityChecks isFridaDetected]) {
|
||||
// return YES;
|
||||
// }
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||