mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-03 00:29:16 +00:00
Compare commits
3 Commits
release-ni
...
v0.2.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
993ba1ba08 | ||
|
|
3a9c118353 | ||
|
|
37313fbb1c |
@@ -13,8 +13,8 @@ android {
|
|||||||
applicationId = "me.kavishdevar.librepods"
|
applicationId = "me.kavishdevar.librepods"
|
||||||
minSdk = 28
|
minSdk = 28
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 7
|
versionCode = 8
|
||||||
versionName = "0.1.0-rc.4"
|
versionName = "0.2.0-alpha"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ 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("/system/bin/su -c id")
|
val process = Runtime.getRuntime().exec("su -c id")
|
||||||
val exitValue = process.waitFor() // no idea why i have this, probably don't need to do this
|
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)
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ fun LongPress(navController: NavController, name: String) {
|
|||||||
if (modesByte != null) {
|
if (modesByte != null) {
|
||||||
Log.d("PressAndHoldSettingsScreen", "Current modes state: ${modesByte.toString(2)}")
|
Log.d("PressAndHoldSettingsScreen", "Current modes state: ${modesByte.toString(2)}")
|
||||||
Log.d("PressAndHoldSettingsScreen", "Off mode: ${(modesByte and 0x01) != 0.toByte()}")
|
Log.d("PressAndHoldSettingsScreen", "Off mode: ${(modesByte and 0x01) != 0.toByte()}")
|
||||||
Log.d("PressAndHoldSettingsScreen", "Transparency mode: ${(modesByte and 0x02) != 0.toByte()}")
|
Log.d("PressAndHoldSettingsScreen", "Transparency mode: ${(modesByte and 0x04) != 0.toByte()}")
|
||||||
Log.d("PressAndHoldSettingsScreen", "Noise Cancellation mode: ${(modesByte and 0x04) != 0.toByte()}")
|
Log.d("PressAndHoldSettingsScreen", "Noise Cancellation mode: ${(modesByte and 0x02) != 0.toByte()}")
|
||||||
Log.d("PressAndHoldSettingsScreen", "Adaptive mode: ${(modesByte and 0x08) != 0.toByte()}")
|
Log.d("PressAndHoldSettingsScreen", "Adaptive mode: ${(modesByte and 0x08) != 0.toByte()}")
|
||||||
}
|
}
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -222,9 +222,9 @@ fun LongPress(navController: NavController, name: String) {
|
|||||||
name = stringResource(R.string.transparency),
|
name = stringResource(R.string.transparency),
|
||||||
description = "Lets in external sounds",
|
description = "Lets in external sounds",
|
||||||
iconRes = R.drawable.transparency,
|
iconRes = R.drawable.transparency,
|
||||||
selected = (currentByte and 0x02) != 0,
|
selected = (currentByte and 0x04) != 0,
|
||||||
onClick = {
|
onClick = {
|
||||||
val bit = 0x02
|
val bit = 0x04
|
||||||
val newValue = if ((currentByte and bit) != 0) {
|
val newValue = if ((currentByte and bit) != 0) {
|
||||||
val temp = currentByte and bit.inv()
|
val temp = currentByte and bit.inv()
|
||||||
if (countEnabledModes(temp) >= 2) temp else currentByte
|
if (countEnabledModes(temp) >= 2) temp else currentByte
|
||||||
@@ -268,9 +268,9 @@ fun LongPress(navController: NavController, name: String) {
|
|||||||
name = stringResource(R.string.noise_cancellation),
|
name = stringResource(R.string.noise_cancellation),
|
||||||
description = "Blocks out external sounds",
|
description = "Blocks out external sounds",
|
||||||
iconRes = R.drawable.noise_cancellation,
|
iconRes = R.drawable.noise_cancellation,
|
||||||
selected = (currentByte and 0x04) != 0,
|
selected = (currentByte and 0x02) != 0,
|
||||||
onClick = {
|
onClick = {
|
||||||
val bit = 0x04
|
val bit = 0x02
|
||||||
val newValue = if ((currentByte and bit) != 0) {
|
val newValue = if ((currentByte and bit) != 0) {
|
||||||
val temp = currentByte and bit.inv()
|
val temp = currentByte and bit.inv()
|
||||||
if (countEnabledModes(temp) >= 2) temp else currentByte
|
if (countEnabledModes(temp) >= 2) temp else currentByte
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
|
|||||||
|
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
|
|
||||||
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "settings", "get", "secure", "bluetooth_address"))
|
val process = Runtime.getRuntime().exec(arrayOf("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("/system/bin/su", "-c", "input keyevent 27"))
|
Runtime.getRuntime().exec(arrayOf("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("/system/bin/su -c $command")
|
val process = Runtime.getRuntime().exec("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,7 +74,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
fun clearHookOffsets(): Boolean {
|
fun clearHookOffsets(): Boolean {
|
||||||
try {
|
try {
|
||||||
val process = Runtime.getRuntime().exec(arrayOf(
|
val process = Runtime.getRuntime().exec(arrayOf(
|
||||||
"/system/bin/su", "-c",
|
"su", "-c",
|
||||||
"/system/bin/setprop $HOOK_OFFSET_PROP '' && " +
|
"/system/bin/setprop $HOOK_OFFSET_PROP '' && " +
|
||||||
"/system/bin/setprop $CFG_REQ_OFFSET_PROP '' && " +
|
"/system/bin/setprop $CFG_REQ_OFFSET_PROP '' && " +
|
||||||
"/system/bin/setprop $CSM_CONFIG_OFFSET_PROP '' && " +
|
"/system/bin/setprop $CSM_CONFIG_OFFSET_PROP '' && " +
|
||||||
@@ -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(
|
||||||
"/system/bin/su", "-c", "/system/bin/setprop $SDP_OFFSET_PROP ''"
|
"su", "-c", "/system/bin/setprop $SDP_OFFSET_PROP ''"
|
||||||
))
|
))
|
||||||
val exitCode = process.waitFor()
|
val exitCode = 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("/system/bin/su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("su", "-c", "rm -rf $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()
|
Runtime.getRuntime().exec(arrayOf("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("/system/bin/su", "-c", "tar xvf ${radare2TarballFile.absolutePath} -C $EXTRACT_DIR")
|
arrayOf("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("/system/bin/su", "-c", "[ -d $EXTRACT_DIR/data/local/tmp/aln_unzip ] && echo 'exists'")
|
arrayOf("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("/system/bin/su", "-c", "tar tf ${radare2TarballFile.absolutePath}")
|
arrayOf("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("/system/bin/su", "-c", "find $EXTRACT_DIR/data/local/tmp/aln_unzip -type f | sort")
|
arrayOf("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("/system/bin/su", "-c", "[ -f $filePathInExtractDir ] && echo 'exists'")
|
arrayOf("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("/system/bin/su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("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("/system/bin/su", "-c", "chmod -R 755 $RADARE2_BIN_PATH")
|
arrayOf("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("/system/bin/su", "-c", "chmod -R 755 $BUSYBOX_PATH")
|
arrayOf("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("/system/bin/su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
@Suppress("LocalVariableName") val currentLD_LIBRARY_PATH = ProcessBuilder().command("su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
||||||
val currentPATH = ProcessBuilder().command("/system/bin/su", "-c", "printenv PATH").start().inputStream.bufferedReader().readText().trim()
|
val currentPATH = ProcessBuilder().command("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("/system/bin/su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("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("/system/bin/su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("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(
|
||||||
"/system/bin/su", "-c", "/system/bin/setprop $CFG_REQ_OFFSET_PROP $hexString"
|
"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("/system/bin/su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("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(
|
||||||
"/system/bin/su", "-c", "/system/bin/setprop $CSM_CONFIG_OFFSET_PROP $hexString"
|
"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("/system/bin/su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("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(
|
||||||
"/system/bin/su", "-c", "/system/bin/setprop $PEER_INFO_REQ_OFFSET_PROP $hexString"
|
"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("/system/bin/su", "-c", command))
|
val process = Runtime.getRuntime().exec(arrayOf("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(
|
||||||
"/system/bin/su", "-c", "/system/bin/setprop $SDP_OFFSET_PROP $hexString"
|
"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,7 +665,7 @@ 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(
|
||||||
"/system/bin/su", "-c", "/system/bin/setprop $HOOK_OFFSET_PROP $hexString"
|
"su", "-c", "/system/bin/setprop $HOOK_OFFSET_PROP $hexString"
|
||||||
))
|
))
|
||||||
|
|
||||||
val exitCode = process.waitFor()
|
val exitCode = process.waitFor()
|
||||||
@@ -694,7 +694,7 @@ class RadareOffsetFinder(context: Context) {
|
|||||||
|
|
||||||
private fun cleanupExtractedFiles() {
|
private fun cleanupExtractedFiles() {
|
||||||
try {
|
try {
|
||||||
Runtime.getRuntime().exec(arrayOf("/system/bin/su", "-c", "rm -rf $EXTRACT_DIR/data/local/tmp/aln_unzip")).waitFor()
|
Runtime.getRuntime().exec(arrayOf("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("/system/bin/su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
@Suppress("LocalVariableName") val currentLD_LIBRARY_PATH = ProcessBuilder().command("su", "-c", "printenv LD_LIBRARY_PATH").start().inputStream.bufferedReader().readText().trim()
|
||||||
val currentPATH = ProcessBuilder().command("/system/bin/su", "-c", "printenv PATH").start().inputStream.bufferedReader().readText().trim()
|
val currentPATH = ProcessBuilder().command("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