搜尋套件、儲存庫與 APP 分類

套件詳情v4.0.0

security_plus

一個全新的Flutter外掛,用於偵測多種安全警示,例如root、越獄、模擬器、開發模式以及外部儲存執行。

AndroidiOS
近 30 天下載
3630
喜歡數
26
Pub 分數
160

安裝套件

flutter pub add security_plus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

security_plus 是一個 Flutter 插件,旨在透過偵測多種潛在威脅來增強應用程式安全性,包括取得 root 權限、越獄檢測、模擬器環境、開發模式以及外部儲存使用。它幫助開發者保護其應用程式免受在被破解或調試的裝置上存在的常見漏洞影響。該套件可無縫整合至 Android 與 iOS 平台,提供執行時的即時檢查。透過早期識別高風險狀況,它能實現主動回應,例如限制功能或終止會話。適用於處理敏感資料的應用程式,它在無需複雜實作的情況下增強了整體安全態勢。

適用情境

  • 保護金融應用程式免受未授權的訪問
  • 檢測遊戲應用中的模擬器
  • 防止在生產環境中使用除錯模式
  • 保護健康與個人數據應用
  • 阻止在根設備上的執行
  • 強制執行安全環境檢查

主要特色

  • 根和越獄檢測
  • 模擬器和模擬器檢測
  • 開發模式檢測
  • 外部儲存使用情況監控
  • 跨平台支援(Android 與 iOS)
  • 即時安全警示

適合對象

  • 處理敏感用戶數據的應用程式
  • 金融和銀行應用
  • 注重健康和隱私的應用程式
  • 需要反作弊措施的遊戲
  • 企業移動解決方案

使用建議

  • 可能在某些設備上觸發誤報
  • 需要仔細處理檢測到的威脅
  • 僅限基本安全檢查
  • 不可替代全面的安全架構
  • 高頻率檢查中的效能影響

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Security Plus

A comprehensive Flutter security plugin that provides advanced security features for your Flutter applications, including root detection, emulator detection, and various security checks.

pub package License: MIT

Features

  • 🛡️ Advanced Root Detection

    • Multiple detection layers
    • Frida anti-tampering protection
    • Magisk detection
    • SuperSU detection
    • Common root app detection
  • 📱 Emulator Detection

    • Comprehensive emulator environment checks
    • Build properties analysis
    • Hardware characteristics verification
  • 🔒 Security Checks

    • Development mode detection
    • Mock location detection
    • External storage checks
    • Runtime integrity verification
    • System tampering detection

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  security_plus: ^3.0.1

Platform Setup

Android

1.Add the following permissions to your AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
</manifest>

2.Add permission_handler for runtime permission management:

dependencies:
  permission_handler: ^10.4.3
iOS

Add the following to your Info.plist file:

<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open to verify device security.</string>

Usage

Import the package
import 'package:security_plus/security_plus.dart';
import 'package:permission_handler/permission_handler.dart';
Handle Permissions and Security Checks
Future<void> checkDeviceSecurity() async {
  // Request location permission first
  if (Platform.isAndroid) {
    final status = await Permission.location.request();
    if (!status.isGranted) {
      // Handle permission denied
      return;
    }
  }

  // Perform security checks
  try {
    final isRooted = await SecurityPlus.isRooted;
    final isEmulator = await SecurityPlus.isEmulator;
    final isDevelopmentMode = await SecurityPlus.isDevelopmentModeEnable;
    final isMockLocation = await SecurityPlus.isMockLocationEnabled;
    final isExternalStorage = await SecurityPlus.isOnExternalStorage;

    // Handle security check results
    if (isRooted || isEmulator || isMockLocation) {
      // Handle security risks
    }
  } catch (e) {
    // Handle errors
  }
}
Individual Security Checks
Root Detection
try {
  bool isRooted = await SecurityPlus.isRooted;
  if (isRooted) {
    // Handle rooted device
  }
} catch (e) {
  // Handle errors
}
Emulator Detection
try {
  bool isEmulator = await SecurityPlus.isEmulator;
  if (isEmulator) {
    // Handle emulator detection
  }
} catch (e) {
  // Handle errors
}
Development Mode Check
try {
  bool isDevelopmentMode = await SecurityPlus.isDevelopmentModeEnable;
  if (isDevelopmentMode) {
    // Handle development mode
  }
} catch (e) {
  // Handle errors
}
Mock Location Check
try {
  bool isMockLocation = await SecurityPlus.isMockLocationEnabled;
  if (isMockLocation) {
    // Handle mock location
  }
} catch (e) {
  // Handle errors
}
External Storage Check
try {
  bool isOnExternalStorage = await SecurityPlus.isOnExternalStorage;
  if (isOnExternalStorage) {
    // Handle external storage detection
  }
} catch (e) {
  // Handle errors
}

Security Features

Root Detection Mechanisms

The plugin employs multiple layers of root detection:

  1. RootBeer Integration: Uses the advanced RootBeer library for base root detection
  2. Frida Detection: Actively searches for Frida-related processes and libraries
  3. File System Checks: Scans for common root-related files and directories
  4. Package Analysis: Detects known root management applications
  5. Runtime Integrity: Checks for system modifications and hooks
Anti-Tampering Protection
  • Process monitoring for known tampering tools
  • Library injection detection
  • System property verification
  • Runtime integrity checks

Example

Check out the example directory for a complete sample application demonstrating all features.

Platform Support

Android iOS
✅ 🚧

Contributing

Contributions are welcome! If you find a bug or want a feature, please open an issue.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created and maintained by Abdelrahman Bonna.

Acknowledgments

  • RootBeer - For root detection capabilities
  • The Flutter team and community for their amazing work

Disclaimer

This plugin provides security features but should not be considered as the sole security measure for your application. Always implement multiple layers of security and keep your security measures up to date.

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.0.2

原始碼儲存庫

使用此套件的專案

暫無相關資料。