underManInTheMiddleAttack
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" />
Content copied to clipboard
🔑 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}")
}
Content copied to clipboard
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")
}
}
Content copied to clipboard
Return
Boolean
— true if a Man-In-The-Middle is currently detected.