Commit bc0fad7d authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

add root detection

parent 502813d2
...@@ -106,6 +106,7 @@ enum VerificationErrorType { ...@@ -106,6 +106,7 @@ enum VerificationErrorType {
expired, expired,
oldseed, oldseed,
server, server,
root,
other, other,
} }
......
...@@ -2,7 +2,11 @@ PODS: ...@@ -2,7 +2,11 @@ PODS:
- connectivity (0.0.1): - connectivity (0.0.1):
- Flutter - Flutter
- Reachability - Reachability
- DTTJailbreakDetection (0.4.0)
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_jailbreak_detection (1.0.0):
- DTTJailbreakDetection
- Flutter
- MTBBarcodeScanner (5.0.11) - MTBBarcodeScanner (5.0.11)
- package_info (0.0.1): - package_info (0.0.1):
- Flutter - Flutter
...@@ -20,6 +24,7 @@ PODS: ...@@ -20,6 +24,7 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- connectivity (from `.symlinks/plugins/connectivity/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_jailbreak_detection (from `.symlinks/plugins/flutter_jailbreak_detection/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`) - package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
...@@ -28,6 +33,7 @@ DEPENDENCIES: ...@@ -28,6 +33,7 @@ DEPENDENCIES:
SPEC REPOS: SPEC REPOS:
trunk: trunk:
- DTTJailbreakDetection
- MTBBarcodeScanner - MTBBarcodeScanner
- Reachability - Reachability
...@@ -36,6 +42,8 @@ EXTERNAL SOURCES: ...@@ -36,6 +42,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/connectivity/ios" :path: ".symlinks/plugins/connectivity/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
flutter_jailbreak_detection:
:path: ".symlinks/plugins/flutter_jailbreak_detection/ios"
package_info: package_info:
:path: ".symlinks/plugins/package_info/ios" :path: ".symlinks/plugins/package_info/ios"
path_provider_ios: path_provider_ios:
...@@ -49,7 +57,9 @@ EXTERNAL SOURCES: ...@@ -49,7 +57,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
DTTJailbreakDetection: 5e356c5badc17995f65a83ed9483f787a0057b71
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
flutter_jailbreak_detection: f6c01e4bc73641c6b69c5112e50301240601abb4
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5
......
...@@ -269,6 +269,12 @@ class _HomePageState extends State<HomePage> { ...@@ -269,6 +269,12 @@ class _HomePageState extends State<HomePage> {
), ),
], ],
) )
else if (_bloc!.error == VerificationErrorType.root)
Text(
'Root/Jailbreak entdeckt. Bitte nutze ein unmodifiziertes Gerät für deinen 3G Nachweis',
style: Theme.of(context).textTheme.headline4,
textAlign: TextAlign.center,
)
else else
Text( Text(
'Ein unbekanntes Problem wurde festgestellt', 'Ein unbekanntes Problem wurde festgestellt',
......
...@@ -4,6 +4,7 @@ import 'dart:io'; ...@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'package:digital_3g_common/verification_api.dart'; import 'package:digital_3g_common/verification_api.dart';
import 'package:flutter_jailbreak_detection/flutter_jailbreak_detection.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
...@@ -28,7 +29,15 @@ class VerificationBloc extends Bloc<VerificationEvent, VerificationState> { ...@@ -28,7 +29,15 @@ class VerificationBloc extends Bloc<VerificationEvent, VerificationState> {
VerificationBloc(String url) : super(VerificationState.busy) { VerificationBloc(String url) : super(VerificationState.busy) {
_api = VerificationApi(http.Client(), url); _api = VerificationApi(http.Client(), url);
_initVerificationStore().then((_) => _initTicketFile().then((value) => _loadTicket())); FlutterJailbreakDetection.jailbroken.then((bool jailbroken) {
if (!jailbroken) {
_initVerificationStore().then((_) => _initTicketFile().then((value) => _loadTicket()));
} else {
_log.severe('jailbroken/rooted device detected, VerificationBloc halted');
_error = VerificationErrorType.root;
emit(VerificationState.error);
}
});
} }
VerificationApi? get api => _api; VerificationApi? get api => _api;
......
...@@ -111,6 +111,13 @@ packages: ...@@ -111,6 +111,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.3.3" version: "7.3.3"
flutter_jailbreak_detection:
dependency: "direct main"
description:
name: flutter_jailbreak_detection
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
...@@ -199,21 +206,21 @@ packages: ...@@ -199,21 +206,21 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
path_provider: path_provider:
dependency: "direct main" dependency: "direct main"
description: description:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.7" version: "2.0.8"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.11"
path_provider_ios: path_provider_ios:
dependency: transitive dependency: transitive
description: description:
...@@ -227,28 +234,28 @@ packages: ...@@ -227,28 +234,28 @@ packages:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.5"
path_provider_macos: path_provider_macos:
dependency: transitive dependency: transitive
description: description:
name: path_provider_macos name: path_provider_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.5"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.3"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.5"
platform: platform:
dependency: transitive dependency: transitive
description: description:
...@@ -262,7 +269,7 @@ packages: ...@@ -262,7 +269,7 @@ packages:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.1.2"
process: process:
dependency: transitive dependency: transitive
description: description:
...@@ -276,7 +283,7 @@ packages: ...@@ -276,7 +283,7 @@ packages:
name: provider name: provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.1" version: "6.0.2"
qr_code_scanner: qr_code_scanner:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -290,28 +297,28 @@ packages: ...@@ -290,28 +297,28 @@ packages:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.12"
shared_preferences_android: shared_preferences_android:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_android name: shared_preferences_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.10"
shared_preferences_ios: shared_preferences_ios:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_ios name: shared_preferences_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.9"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_linux name: shared_preferences_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.3" version: "2.0.4"
shared_preferences_macos: shared_preferences_macos:
dependency: transitive dependency: transitive
description: description:
...@@ -332,14 +339,14 @@ packages: ...@@ -332,14 +339,14 @@ packages:
name: shared_preferences_web name: shared_preferences_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_windows name: shared_preferences_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.3" version: "2.0.4"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
...@@ -351,7 +358,7 @@ packages: ...@@ -351,7 +358,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
...@@ -379,49 +386,49 @@ packages: ...@@ -379,49 +386,49 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.17" version: "6.0.18"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_android name: url_launcher_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.13" version: "6.0.14"
url_launcher_ios: url_launcher_ios:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_ios name: url_launcher_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.13" version: "6.0.14"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.5"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
...@@ -442,7 +449,7 @@ packages: ...@@ -442,7 +449,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.3.1" version: "2.3.8"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
...@@ -451,5 +458,5 @@ packages: ...@@ -451,5 +458,5 @@ packages:
source: hosted source: hosted
version: "0.2.0" version: "0.2.0"
sdks: sdks:
dart: ">=2.14.0 <3.0.0" dart: ">=2.15.0 <3.0.0"
flutter: ">=2.5.0" flutter: ">=2.5.0"
...@@ -20,6 +20,7 @@ dependencies: ...@@ -20,6 +20,7 @@ dependencies:
flutter_phoenix: ^1.0.0 flutter_phoenix: ^1.0.0
shared_preferences: ^2.0.8 shared_preferences: ^2.0.8
connectivity: ^3.0.6 connectivity: ^3.0.6
flutter_jailbreak_detection: ^1.8.0
dev_dependencies: dev_dependencies:
flutter_lints: ^1.0.0 flutter_lints: ^1.0.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment