underManInTheMiddleAttack

@RequiresPermission(value = "android.permission.ACCESS_NETWORK_STATE")
suspend fun underManInTheMiddleAttack(): Boolean

Determine if a Man-In-The-Middle attack is under way.


📝 Permissions needed in the manifest

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


🔑 Minimum required license level: Advanced.


Sample usage

try {
val networkDiagnostic = rasp.diagnostic.network
val underManInTheMiddleAttack = networkDiagnostic.underManInTheMiddleAttack()
Log.d("RASP-DEMO", "underManInTheMiddleAttack: $underManInTheMiddleAttack")
} catch (e: Exception) {
Log.e("RASP-DEMO", "[networkDiagnostic] underManInTheMiddleAttack error: ${e.message}")
}


To observe changes of the man in the middle attack, you can use the observe() method.

val modelNetwork = rasp.watcher.network.observe()
launch {
networkModel.underManInTheMiddleAttack.collect { detected ->
if (detected != null && detected) {
Log.d("RASP-DEMO", "[underManInTheMiddleAttack] $detected")
}
}

Return

Boolean — true if a Man-In-The-Middle is currently detected.