mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-10 19:52:24 +00:00
android: not use relative paths for executing commands
i hope it's the same across all skins
This commit is contained in:
@@ -111,8 +111,8 @@ fun Onboarding(navController: NavController, activityContext: Context) {
|
|||||||
kotlinx.coroutines.MainScope().launch {
|
kotlinx.coroutines.MainScope().launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec("su -c id")
|
val process = Runtime.getRuntime().exec("/system/bin/su -c id")
|
||||||
val exitValue = process.waitFor()
|
val exitValue = process.waitFor() // no idea why i have this, probably don't need to do this
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
rootCheckPassed = (exitValue == 0)
|
rootCheckPassed = (exitValue == 0)
|
||||||
rootCheckFailed = (exitValue != 0)
|
rootCheckFailed = (exitValue != 0)
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
|
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", "settings", "get", "secure", "bluetooth_address"))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "settings", "get", "secure", "bluetooth_address"))
|
||||||
val output = process.inputStream.bufferedReader().use { it.readLine() }
|
val output = process.inputStream.bufferedReader().use { it.readLine() }
|
||||||
localMac = output.trim()
|
localMac = output.trim()
|
||||||
|
|
||||||
@@ -954,7 +954,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
|
|
||||||
Log.d("AirPodsParser", "Stem press received: $stemPressType on $bud, cameraActive: $cameraActive, cameraAction: ${config.cameraAction}")
|
Log.d("AirPodsParser", "Stem press received: $stemPressType on $bud, cameraActive: $cameraActive, cameraAction: ${config.cameraAction}")
|
||||||
if (cameraActive && config.cameraAction != null && stemPressType == config.cameraAction) {
|
if (cameraActive && config.cameraAction != null && stemPressType == config.cameraAction) {
|
||||||
Runtime.getRuntime().exec(arrayOf("su", "-c", "input keyevent 27"))
|
Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "input keyevent 27"))
|
||||||
} else {
|
} else {
|
||||||
val action = getActionFor(bud, stemPressType)
|
val action = getActionFor(bud, stemPressType)
|
||||||
Log.d("AirPodsParser", "$bud $stemPressType action: $action")
|
Log.d("AirPodsParser", "$bud $stemPressType action: $action")
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class LogCollector(private val context: Context) {
|
|||||||
private suspend fun executeRootCommand(command: String): String {
|
private suspend fun executeRootCommand(command: String): String {
|
||||||
return withContext(Dispatchers.IO) {
|
return withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec("su -c $command")
|
val process = Runtime.getRuntime().exec("/system/bin/su -c $command")
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val output = StringBuilder()
|
val output = StringBuilder()
|
||||||
var line: String?
|
var line: String?
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
fun clearHookOffsets(): Boolean {
|
fun clearHookOffsets(): Boolean {
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec(arrayOf(
|
val process = Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c",
|
"/system/bin/su", "-c",
|
||||||
"setprop $HOOK_OFFSET_PROP '' && " +
|
"/system/bin/setprop $HOOK_OFFSET_PROP '' && " +
|
||||||
"setprop $CFG_REQ_OFFSET_PROP '' && " +
|
"/system/bin/setprop $CFG_REQ_OFFSET_PROP '' && " +
|
||||||
"setprop $CSM_CONFIG_OFFSET_PROP '' && " +
|
"/system/bin/setprop $CSM_CONFIG_OFFSET_PROP '' && " +
|
||||||
"setprop $PEER_INFO_REQ_OFFSET_PROP '' &&" +
|
"/system/bin/setprop $PEER_INFO_REQ_OFFSET_PROP '' &&" +
|
||||||
"setprop $SDP_OFFSET_PROP ''"
|
"/system/bin/setprop $SDP_OFFSET_PROP ''"
|
||||||
))
|
))
|
||||||
val exitCode = process.waitFor()
|
val exitCode = process.waitFor()
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
fun clearSdpOffset(): Boolean {
|
fun clearSdpOffset(): Boolean {
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec(arrayOf(
|
val process = Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c", "setprop $SDP_OFFSET_PROP ''"
|
"/system/bin/su", "-c", "/system/bin/setprop $SDP_OFFSET_PROP ''"
|
||||||
))
|
))
|
||||||
val exitCode = process.waitFor()
|
val exitCode = process.waitFor()
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
|
|
||||||
fun isSdpOffsetAvailable(): Boolean {
|
fun isSdpOffsetAvailable(): Boolean {
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("getprop", SDP_OFFSET_PROP))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/getprop", SDP_OFFSET_PROP))
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val propValue = reader.readLine()
|
val propValue = reader.readLine()
|
||||||
process.waitFor()
|
process.waitFor()
|
||||||
@@ -162,7 +162,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
}
|
}
|
||||||
_progressState.value = ProgressState.CheckingExisting
|
_progressState.value = ProgressState.CheckingExisting
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("getprop", HOOK_OFFSET_PROP))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/getprop", HOOK_OFFSET_PROP))
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val propValue = reader.readLine()
|
val propValue = reader.readLine()
|
||||||
process.waitFor()
|
process.waitFor()
|
||||||
@@ -288,14 +288,14 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Removing existing extract directory")
|
Log.d(TAG, "Removing existing extract directory")
|
||||||
Runtime.getRuntime().exec(arrayOf("su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
||||||
|
|
||||||
Runtime.getRuntime().exec(arrayOf("su", "-c", "mkdir -p $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "mkdir -p $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
||||||
|
|
||||||
Log.d(TAG, "Extracting ${radare2TarballFile.absolutePath} to $EXTRACT_DIR")
|
Log.d(TAG, "Extracting ${radare2TarballFile.absolutePath} to $EXTRACT_DIR")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(
|
val process = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "tar xvf ${radare2TarballFile.absolutePath} -C $EXTRACT_DIR")
|
arrayOf("/system/bin/su", "-c", "tar xvf ${radare2TarballFile.absolutePath} -C $EXTRACT_DIR")
|
||||||
)
|
)
|
||||||
|
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
@@ -327,7 +327,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
private suspend fun checkIfAlreadyExtracted(): Boolean = withContext(Dispatchers.IO) {
|
private suspend fun checkIfAlreadyExtracted(): Boolean = withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
val checkDirProcess = Runtime.getRuntime().exec(
|
val checkDirProcess = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "[ -d $EXTRACT_DIR/data/local/tmp/aln_unzip ] && echo 'exists'")
|
arrayOf("/system/bin/su", "-c", "[ -d $EXTRACT_DIR/data/local/tmp/aln_unzip ] && echo 'exists'")
|
||||||
)
|
)
|
||||||
val dirExists = BufferedReader(InputStreamReader(checkDirProcess.inputStream)).readLine() == "exists"
|
val dirExists = BufferedReader(InputStreamReader(checkDirProcess.inputStream)).readLine() == "exists"
|
||||||
checkDirProcess.waitFor()
|
checkDirProcess.waitFor()
|
||||||
@@ -338,7 +338,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val tarProcess = Runtime.getRuntime().exec(
|
val tarProcess = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "tar tf ${radare2TarballFile.absolutePath}")
|
arrayOf("/system/bin/su", "-c", "tar tf ${radare2TarballFile.absolutePath}")
|
||||||
)
|
)
|
||||||
val tarFiles = BufferedReader(InputStreamReader(tarProcess.inputStream)).readLines()
|
val tarFiles = BufferedReader(InputStreamReader(tarProcess.inputStream)).readLines()
|
||||||
.filter { it.isNotEmpty() }
|
.filter { it.isNotEmpty() }
|
||||||
@@ -352,7 +352,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val findProcess = Runtime.getRuntime().exec(
|
val findProcess = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "find $EXTRACT_DIR/data/local/tmp/aln_unzip -type f | sort")
|
arrayOf("/system/bin/su", "-c", "find $EXTRACT_DIR/data/local/tmp/aln_unzip -type f | sort")
|
||||||
)
|
)
|
||||||
val extractedFiles = BufferedReader(InputStreamReader(findProcess.inputStream)).readLines()
|
val extractedFiles = BufferedReader(InputStreamReader(findProcess.inputStream)).readLines()
|
||||||
.filter { it.isNotEmpty() }
|
.filter { it.isNotEmpty() }
|
||||||
@@ -370,14 +370,14 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
|
|
||||||
val filePathInExtractDir = "$EXTRACT_DIR/$tarFile"
|
val filePathInExtractDir = "$EXTRACT_DIR/$tarFile"
|
||||||
val fileCheckProcess = Runtime.getRuntime().exec(
|
val fileCheckProcess = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "[ -f $filePathInExtractDir ] && echo 'exists'")
|
arrayOf("/system/bin/su", "-c", "[ -f $filePathInExtractDir ] && echo 'exists'")
|
||||||
)
|
)
|
||||||
val fileExists = BufferedReader(InputStreamReader(fileCheckProcess.inputStream)).readLine() == "exists"
|
val fileExists = BufferedReader(InputStreamReader(fileCheckProcess.inputStream)).readLine() == "exists"
|
||||||
fileCheckProcess.waitFor()
|
fileCheckProcess.waitFor()
|
||||||
|
|
||||||
if (!fileExists) {
|
if (!fileExists) {
|
||||||
Log.d(TAG, "File $filePathInExtractDir from tarball missing in extract directory")
|
Log.d(TAG, "File $filePathInExtractDir from tarball missing in extract directory")
|
||||||
Runtime.getRuntime().exec(arrayOf("su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
||||||
return@withContext false
|
return@withContext false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,13 +394,13 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
try {
|
try {
|
||||||
Log.d(TAG, "Making binaries executable in $RADARE2_BIN_PATH")
|
Log.d(TAG, "Making binaries executable in $RADARE2_BIN_PATH")
|
||||||
val chmod1Result = Runtime.getRuntime().exec(
|
val chmod1Result = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "chmod -R 755 $RADARE2_BIN_PATH")
|
arrayOf("/system/bin/su", "-c", "chmod -R 755 $RADARE2_BIN_PATH")
|
||||||
).waitFor()
|
).waitFor()
|
||||||
|
|
||||||
Log.d(TAG, "Making binaries executable in $BUSYBOX_PATH")
|
Log.d(TAG, "Making binaries executable in $BUSYBOX_PATH")
|
||||||
|
|
||||||
val chmod2Result = Runtime.getRuntime().exec(
|
val chmod2Result = Runtime.getRuntime().exec(
|
||||||
arrayOf("su", "-c", "chmod -R 755 $BUSYBOX_PATH")
|
arrayOf("/system/bin/su", "-c", "chmod -R 755 $BUSYBOX_PATH")
|
||||||
).waitFor()
|
).waitFor()
|
||||||
|
|
||||||
if (chmod1Result == 0 && chmod2Result == 0) {
|
if (chmod1Result == 0 && chmod2Result == 0) {
|
||||||
@@ -421,8 +421,8 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
var offset = 0L
|
var offset = 0L
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@Suppress("LocalVariableName") val currentLD_LIBRARY_PATH = ProcessBuilder().command("su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
@Suppress("LocalVariableName") val currentLD_LIBRARY_PATH = ProcessBuilder().command("/system/bin/su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
||||||
val currentPATH = ProcessBuilder().command("su", "-c", "printenv PATH").start().inputStream.bufferedReader().readText().trim()
|
val currentPATH = ProcessBuilder().command("/system/bin/su", "-c", "printenv PATH").start().inputStream.bufferedReader().readText().trim()
|
||||||
val envSetup = """
|
val envSetup = """
|
||||||
export LD_LIBRARY_PATH="$RADARE2_LIB_PATH:$currentLD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="$RADARE2_LIB_PATH:$currentLD_LIBRARY_PATH"
|
||||||
export PATH="$BUSYBOX_PATH:$RADARE2_BIN_PATH:$currentPATH"
|
export PATH="$BUSYBOX_PATH:$RADARE2_BIN_PATH:$currentPATH"
|
||||||
@@ -431,7 +431,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep fcr_chk_chan"
|
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep fcr_chk_chan"
|
||||||
Log.d(TAG, "Running command: $command")
|
Log.d(TAG, "Running command: $command")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", command))
|
||||||
|
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
||||||
@@ -484,7 +484,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep l2cu_process_our_cfg_req"
|
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep l2cu_process_our_cfg_req"
|
||||||
Log.d(TAG, "Running command: $command")
|
Log.d(TAG, "Running command: $command")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", command))
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
if (offset > 0L) {
|
if (offset > 0L) {
|
||||||
val hexString = "0x${offset.toString(16)}"
|
val hexString = "0x${offset.toString(16)}"
|
||||||
Runtime.getRuntime().exec(arrayOf(
|
Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c", "setprop $CFG_REQ_OFFSET_PROP $hexString"
|
"/system/bin/su", "-c", "/system/bin/setprop $CFG_REQ_OFFSET_PROP $hexString"
|
||||||
)).waitFor()
|
)).waitFor()
|
||||||
Log.d(TAG, "Saved l2cu_process_our_cfg_req offset: $hexString")
|
Log.d(TAG, "Saved l2cu_process_our_cfg_req offset: $hexString")
|
||||||
}
|
}
|
||||||
@@ -529,7 +529,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep l2c_csm_config"
|
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep l2c_csm_config"
|
||||||
Log.d(TAG, "Running command: $command")
|
Log.d(TAG, "Running command: $command")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", command))
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
if (offset > 0L) {
|
if (offset > 0L) {
|
||||||
val hexString = "0x${offset.toString(16)}"
|
val hexString = "0x${offset.toString(16)}"
|
||||||
Runtime.getRuntime().exec(arrayOf(
|
Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c", "setprop $CSM_CONFIG_OFFSET_PROP $hexString"
|
"/system/bin/su", "-c", "/system/bin/setprop $CSM_CONFIG_OFFSET_PROP $hexString"
|
||||||
)).waitFor()
|
)).waitFor()
|
||||||
Log.d(TAG, "Saved l2c_csm_config offset: $hexString")
|
Log.d(TAG, "Saved l2c_csm_config offset: $hexString")
|
||||||
}
|
}
|
||||||
@@ -574,7 +574,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep l2cu_send_peer_info_req"
|
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep l2cu_send_peer_info_req"
|
||||||
Log.d(TAG, "Running command: $command")
|
Log.d(TAG, "Running command: $command")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", command))
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
if (offset > 0L) {
|
if (offset > 0L) {
|
||||||
val hexString = "0x${offset.toString(16)}"
|
val hexString = "0x${offset.toString(16)}"
|
||||||
Runtime.getRuntime().exec(arrayOf(
|
Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c", "setprop $PEER_INFO_REQ_OFFSET_PROP $hexString"
|
"/system/bin/su", "-c", "/system/bin/setprop $PEER_INFO_REQ_OFFSET_PROP $hexString"
|
||||||
)).waitFor()
|
)).waitFor()
|
||||||
Log.d(TAG, "Saved l2cu_send_peer_info_req offset: $hexString")
|
Log.d(TAG, "Saved l2cu_send_peer_info_req offset: $hexString")
|
||||||
}
|
}
|
||||||
@@ -619,7 +619,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep DmSetLocalDiRecord"
|
val command = "$envSetup && $RADARE2_BIN_PATH/rabin2 -q -E $libraryPath | grep DmSetLocalDiRecord"
|
||||||
Log.d(TAG, "Running command: $command")
|
Log.d(TAG, "Running command: $command")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", command))
|
||||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||||
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
val errorReader = BufferedReader(InputStreamReader(process.errorStream))
|
||||||
|
|
||||||
@@ -650,7 +650,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
if (offset > 0L) {
|
if (offset > 0L) {
|
||||||
val hexString = "0x${offset.toString(16)}"
|
val hexString = "0x${offset.toString(16)}"
|
||||||
Runtime.getRuntime().exec(arrayOf(
|
Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c", "setprop $SDP_OFFSET_PROP $hexString"
|
"/system/bin/su", "-c", "/system/bin/setprop $SDP_OFFSET_PROP $hexString"
|
||||||
)).waitFor()
|
)).waitFor()
|
||||||
Log.d(TAG, "Saved DmSetLocalDiRecord offset: $hexString")
|
Log.d(TAG, "Saved DmSetLocalDiRecord offset: $hexString")
|
||||||
}
|
}
|
||||||
@@ -665,13 +665,13 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
Log.d(TAG, "Saving offset to system property: $hexString")
|
Log.d(TAG, "Saving offset to system property: $hexString")
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf(
|
val process = Runtime.getRuntime().exec(arrayOf(
|
||||||
"su", "-c", "setprop $HOOK_OFFSET_PROP $hexString"
|
"/system/bin/su", "-c", "/system/bin/setprop $HOOK_OFFSET_PROP $hexString"
|
||||||
))
|
))
|
||||||
|
|
||||||
val exitCode = process.waitFor()
|
val exitCode = process.waitFor()
|
||||||
if (exitCode == 0) {
|
if (exitCode == 0) {
|
||||||
val verifyProcess = Runtime.getRuntime().exec(arrayOf(
|
val verifyProcess = Runtime.getRuntime().exec(arrayOf(
|
||||||
"getprop", HOOK_OFFSET_PROP
|
"/system/bin/getprop", HOOK_OFFSET_PROP
|
||||||
))
|
))
|
||||||
val propValue = BufferedReader(InputStreamReader(verifyProcess.inputStream)).readLine()
|
val propValue = BufferedReader(InputStreamReader(verifyProcess.inputStream)).readLine()
|
||||||
verifyProcess.waitFor()
|
verifyProcess.waitFor()
|
||||||
@@ -694,7 +694,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
|
|
||||||
private fun cleanupExtractedFiles() {
|
private fun cleanupExtractedFiles() {
|
||||||
try {
|
try {
|
||||||
Runtime.getRuntime().exec(arrayOf("su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
||||||
Log.d(TAG, "Cleaned up extracted files at $EXTRACT_DIR/data/local/tmp/aln_unzip")
|
Log.d(TAG, "Cleaned up extracted files at $EXTRACT_DIR/data/local/tmp/aln_unzip")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "Failed to cleanup extracted files", e)
|
Log.e(TAG, "Failed to cleanup extracted files", e)
|
||||||
@@ -732,8 +732,8 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
return@withContext false
|
return@withContext false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("LocalVariableName") val currentLD_LIBRARY_PATH = ProcessBuilder().command("su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
@Suppress("LocalVariableName") val currentLD_LIBRARY_PATH = ProcessBuilder().command("/system/bin/su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
||||||
val currentPATH = ProcessBuilder().command("su", "-c", "printenv PATH").start().inputStream.bufferedReader().readText().trim()
|
val currentPATH = ProcessBuilder().command("/system/bin/su", "-c", "printenv PATH").start().inputStream.bufferedReader().readText().trim()
|
||||||
val envSetup = """
|
val envSetup = """
|
||||||
export LD_LIBRARY_PATH="$RADARE2_LIB_PATH:$currentLD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="$RADARE2_LIB_PATH:$currentLD_LIBRARY_PATH"
|
||||||
export PATH="$BUSYBOX_PATH:$RADARE2_BIN_PATH:$currentPATH"
|
export PATH="$BUSYBOX_PATH:$RADARE2_BIN_PATH:$currentPATH"
|
||||||
|
|||||||
Reference in New Issue
Block a user