hostsIsModified

suspend fun hostsIsModified(): Boolean

Determine if the hosts file was modified.


🔑 Minimum required license level: Core.


Sample usage

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


To observe changes of the host check you can use the observe() method.

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

Return

Boolean — true if the modification of original hosts file is currently detected.