Skip to content

Commit e371e1b

Browse files
authored
Merge pull request #4 from EXXETA/develop
Release 1.0.1 with Jitpack config
2 parents f37910b + 5d633a2 commit e371e1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1144
-11
lines changed

example/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
.idea/
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx
10+
local.properties
11+

example/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

example/app/build.gradle.kts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.jetbrains.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "com.exxeta.mobilesecuritytoolkitexample"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "com.exxeta.mobilesecuritytoolkitexample"
12+
minSdk = 28
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
vectorDrawables {
19+
useSupportLibrary = true
20+
}
21+
}
22+
23+
buildTypes {
24+
release {
25+
isMinifyEnabled = false
26+
proguardFiles(
27+
getDefaultProguardFile("proguard-android-optimize.txt"),
28+
"proguard-rules.pro"
29+
)
30+
// Don't do this, just just to test
31+
signingConfig = signingConfigs.getByName("debug")
32+
}
33+
}
34+
compileOptions {
35+
sourceCompatibility = JavaVersion.VERSION_1_8
36+
targetCompatibility = JavaVersion.VERSION_1_8
37+
}
38+
kotlinOptions {
39+
jvmTarget = "1.8"
40+
}
41+
buildFeatures {
42+
compose = true
43+
}
44+
composeOptions {
45+
kotlinCompilerExtensionVersion = "1.5.1"
46+
}
47+
packaging {
48+
resources {
49+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
50+
}
51+
}
52+
}
53+
54+
dependencies {
55+
implementation(libs.android.security.toolkit)
56+
57+
implementation(libs.androidx.core.ktx)
58+
implementation(libs.androidx.lifecycle.runtime.ktx)
59+
implementation(libs.androidx.activity.compose)
60+
implementation(platform(libs.androidx.compose.bom))
61+
implementation(libs.androidx.ui)
62+
implementation(libs.androidx.ui.graphics)
63+
implementation(libs.androidx.ui.tooling.preview)
64+
implementation(libs.androidx.material3)
65+
66+
testImplementation(libs.junit)
67+
androidTestImplementation(libs.androidx.junit)
68+
androidTestImplementation(libs.androidx.espresso.core)
69+
androidTestImplementation(platform(libs.androidx.compose.bom))
70+
androidTestImplementation(libs.androidx.ui.test.junit4)
71+
debugImplementation(libs.androidx.ui.tooling)
72+
debugImplementation(libs.androidx.ui.test.manifest)
73+
}

example/app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.exxeta.mobilesecuritytoolkitexample
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.exxeta.mobilesecuritytoolkitexample", appContext.packageName)
23+
}
24+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:dataExtractionRules="@xml/data_extraction_rules"
8+
android:fullBackupContent="@xml/backup_rules"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.MobileSecurityToolkitExample"
14+
tools:targetApi="31" >
15+
<activity
16+
android:name=".MainActivity"
17+
android:exported="true"
18+
android:label="@string/app_name"
19+
android:theme="@style/Theme.MobileSecurityToolkitExample" >
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN" />
22+
23+
<category android:name="android.intent.category.LAUNCHER" />
24+
</intent-filter>
25+
</activity>
26+
</application>
27+
28+
</manifest>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.exxeta.mobilesecuritytoolkitexample
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.activity.enableEdgeToEdge
7+
import androidx.compose.ui.platform.LocalContext
8+
import com.exxeta.mobilesecuritytoolkitexample.ui.theme.MobileSecurityToolkitExampleTheme
9+
10+
class MainActivity : ComponentActivity() {
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
super.onCreate(savedInstanceState)
13+
enableEdgeToEdge()
14+
setContent {
15+
MobileSecurityToolkitExampleTheme {
16+
ThreatStatusList()
17+
}
18+
}
19+
}
20+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.exxeta.mobilesecuritytoolkitexample
2+
3+
data class ThreatStatus(
4+
val title: String,
5+
val description: String,
6+
val isDetected: Boolean,
7+
)
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
package com.exxeta.mobilesecuritytoolkitexample
2+
3+
import androidx.compose.foundation.layout.Spacer
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.layout.height
6+
import androidx.compose.foundation.layout.padding
7+
import androidx.compose.foundation.layout.size
8+
import androidx.compose.foundation.lazy.LazyColumn
9+
import androidx.compose.foundation.lazy.items
10+
import androidx.compose.material3.Card
11+
import androidx.compose.material3.CardDefaults
12+
import androidx.compose.material3.Icon
13+
import androidx.compose.material3.MaterialTheme
14+
import androidx.compose.material3.Text
15+
import androidx.compose.runtime.Composable
16+
import androidx.compose.runtime.LaunchedEffect
17+
import androidx.compose.runtime.mutableStateListOf
18+
import androidx.compose.runtime.remember
19+
import androidx.compose.ui.Modifier
20+
import androidx.compose.ui.graphics.Color
21+
import androidx.compose.ui.platform.LocalContext
22+
import androidx.compose.ui.res.painterResource
23+
import androidx.compose.ui.text.style.TextAlign
24+
import androidx.compose.ui.tooling.preview.Preview
25+
import androidx.compose.ui.unit.dp
26+
import com.exxeta.mobilesecuritytoolkitexample.ui.theme.MobileSecurityToolkitExampleTheme
27+
import com.exxeta.securitytoolkit.ThreatDetectionCenter
28+
29+
@Composable
30+
fun ThreatStatusList() {
31+
32+
val context = LocalContext.current
33+
val detectionCenter = ThreatDetectionCenter(context)
34+
detectionCenter.threats
35+
val reportedThreats = remember {
36+
mutableStateListOf<ThreatDetectionCenter.Threat>()
37+
}
38+
39+
LaunchedEffect(Unit) {
40+
detectionCenter.threats.collect {
41+
reportedThreats.add(it)
42+
}
43+
}
44+
45+
val threats = listOf(
46+
ThreatStatus(
47+
"Root",
48+
"Is a way of acquiring privileged control over the operating system of a device. Tools such as Magisk or Shadow can hide the privileged access",
49+
reportedThreats.contains(ThreatDetectionCenter.Threat.ROOT_PRIVILEGES),
50+
),
51+
ThreatStatus(
52+
"Hooks",
53+
"Intercept system or application calls and then modify them (modify the return value of a function call for example)",
54+
reportedThreats.contains(ThreatDetectionCenter.Threat.HOOKS),
55+
),
56+
ThreatStatus(
57+
"Emulator",
58+
"Running the application in an Emulator",
59+
reportedThreats.contains(ThreatDetectionCenter.Threat.SIMULATOR),
60+
),
61+
)
62+
63+
LazyColumn(
64+
modifier = Modifier
65+
.padding(16.dp)
66+
) {
67+
item {
68+
Spacer(modifier = Modifier.height(48.dp))
69+
Icon(
70+
painter = painterResource(R.drawable.stethoscope_24px),
71+
contentDescription = "stethoscope_24px",
72+
modifier = Modifier
73+
.fillMaxWidth()
74+
.size(80.dp)
75+
)
76+
Spacer(modifier = Modifier.height(24.dp))
77+
Text(
78+
text = "Protection",
79+
style = MaterialTheme.typography.headlineLarge,
80+
modifier = Modifier
81+
.fillMaxWidth()
82+
.padding(bottom = 8.dp),
83+
textAlign = TextAlign.Center
84+
)
85+
Text(
86+
text = "Here is a list of the threats that could put you at risk",
87+
style = MaterialTheme.typography.titleMedium,
88+
modifier = Modifier
89+
.fillMaxWidth()
90+
.padding(bottom = 16.dp),
91+
textAlign = TextAlign.Center,
92+
color = Color.Gray
93+
)
94+
}
95+
items(threats) { item ->
96+
Card(
97+
modifier = Modifier
98+
.padding(8.dp)
99+
.fillMaxWidth(),
100+
shape = MaterialTheme.shapes.medium,
101+
elevation = CardDefaults.cardElevation(1.dp)
102+
) {
103+
ThreatStatusRow(threatStatus = item)
104+
}
105+
}
106+
}
107+
}
108+
109+
@Preview(showBackground = true, showSystemUi = true)
110+
@Composable
111+
private fun Preview() {
112+
MobileSecurityToolkitExampleTheme {
113+
ThreatStatusList()
114+
}
115+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package com.exxeta.mobilesecuritytoolkitexample
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.Arrangement
5+
import androidx.compose.foundation.layout.Box
6+
import androidx.compose.foundation.layout.Column
7+
import androidx.compose.foundation.layout.Row
8+
import androidx.compose.foundation.layout.fillMaxWidth
9+
import androidx.compose.foundation.layout.padding
10+
import androidx.compose.foundation.layout.wrapContentHeight
11+
import androidx.compose.foundation.shape.CornerSize
12+
import androidx.compose.foundation.shape.RoundedCornerShape
13+
import androidx.compose.material3.MaterialTheme
14+
import androidx.compose.material3.Text
15+
import androidx.compose.runtime.Composable
16+
import androidx.compose.ui.Alignment
17+
import androidx.compose.ui.Modifier
18+
import androidx.compose.ui.draw.clip
19+
import androidx.compose.ui.graphics.Color
20+
import androidx.compose.ui.tooling.preview.Preview
21+
import androidx.compose.ui.unit.dp
22+
import com.exxeta.mobilesecuritytoolkitexample.ui.theme.MobileSecurityToolkitExampleTheme
23+
24+
@Composable
25+
fun ThreatStatusRow(threatStatus: ThreatStatus) {
26+
val redColor = Color(1f, 0.23f, 0.18f)
27+
val greenColor = Color(0.3f, 0.85f, 0.4f)
28+
29+
Column(
30+
modifier = Modifier
31+
.fillMaxWidth()
32+
.wrapContentHeight()
33+
.padding(16.dp),
34+
) {
35+
Row(
36+
modifier = Modifier
37+
.padding(bottom = 8.dp)
38+
.fillMaxWidth(),
39+
verticalAlignment = Alignment.CenterVertically,
40+
horizontalArrangement = Arrangement.SpaceBetween,
41+
) {
42+
Text(
43+
text = threatStatus.title,
44+
style = MaterialTheme.typography.titleLarge,
45+
)
46+
Box(
47+
modifier = Modifier
48+
.clip(RoundedCornerShape(CornerSize(size = 4.dp)))
49+
.background(if (threatStatus.isDetected) redColor else greenColor)
50+
) {
51+
Text(
52+
text = if (threatStatus.isDetected) "DETECTED" else "SAFE",
53+
color = MaterialTheme.colorScheme.background,
54+
style = MaterialTheme.typography.bodySmall,
55+
modifier = Modifier
56+
.padding(vertical = 2.dp)
57+
.padding(horizontal = 8.dp)
58+
)
59+
}
60+
}
61+
Text(
62+
threatStatus.description,
63+
style = MaterialTheme.typography.titleMedium,
64+
color = Color.Gray
65+
)
66+
}
67+
}
68+
69+
@Preview(showBackground = true, showSystemUi = true)
70+
@Composable
71+
private fun Preview() {
72+
MobileSecurityToolkitExampleTheme {
73+
ThreatStatusRow(
74+
ThreatStatus(
75+
"Jailbreak", "Description", false,
76+
)
77+
)
78+
}
79+
}

0 commit comments

Comments
 (0)