|
|
@@ -9,6 +9,7 @@ import android.database.Cursor
|
|
|
import android.database.MatrixCursor
|
|
|
import android.net.Uri
|
|
|
import android.os.Build
|
|
|
+import android.os.Environment
|
|
|
import android.telephony.SubscriptionManager
|
|
|
import android.telephony.TelephonyManager
|
|
|
import android.util.Base64
|
|
|
@@ -37,6 +38,7 @@ import com.example.modifier.utils.getContext
|
|
|
import com.example.modifier.utils.hasPermission
|
|
|
import com.example.modifier.utils.isOldVersion
|
|
|
import com.example.modifier.utils.shellRun
|
|
|
+import com.google.gson.Gson
|
|
|
import kotlinx.coroutines.CoroutineScope
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.delay
|
|
|
@@ -45,8 +47,11 @@ import kotlinx.coroutines.flow.map
|
|
|
import kotlinx.coroutines.launch
|
|
|
import kotlinx.serialization.encodeToString
|
|
|
import kotlinx.serialization.json.Json
|
|
|
+import org.apache.commons.io.FileUtils
|
|
|
import org.json.JSONObject
|
|
|
+import java.io.File
|
|
|
import java.net.Socket
|
|
|
+import java.nio.file.Files
|
|
|
|
|
|
val Context.simInfoDataStore by preferencesDataStore(name = "${BuildConfig.APPLICATION_ID}.simInfo")
|
|
|
|
|
|
@@ -162,17 +167,7 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
it[PreferencesKeys.BSSID] = spoofedSimInfo.bssid
|
|
|
}
|
|
|
try {
|
|
|
- runCatching {
|
|
|
- val client = Socket("127.0.0.1", 23946)
|
|
|
- client.outputStream.write(Json.encodeToString(spoofedSimInfo).toByteArray())
|
|
|
- client.close()
|
|
|
- }
|
|
|
- runCatching {
|
|
|
- val client = Socket("127.0.0.1", 23947)
|
|
|
- client.outputStream.write(Json.encodeToString(spoofedSimInfo).toByteArray())
|
|
|
- client.close()
|
|
|
- }
|
|
|
- if (ROOT_ACCESS) {
|
|
|
+ if (ROOT_ACCESS && false) {
|
|
|
if (suspend == true) {
|
|
|
shellRun(
|
|
|
PACKAGE_GMS.kill(),
|
|
|
@@ -314,15 +309,33 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
put("imei", spoofedSimInfo.imei)
|
|
|
put("number", spoofedSimInfo.number)
|
|
|
put("country", spoofedSimInfo.country)
|
|
|
- put("carrier_id", spoofedSimInfo.carrierId)
|
|
|
- put("carrier_name", spoofedSimInfo.carrierName)
|
|
|
- put("serial_no", spoofedSimInfo.serialNo)
|
|
|
+ put("carrierId", spoofedSimInfo.carrierId)
|
|
|
+ put("carrierName", spoofedSimInfo.carrierName)
|
|
|
+ put("serialNo", spoofedSimInfo.serialNo)
|
|
|
put("mac", spoofedSimInfo.mac)
|
|
|
put("bssid", spoofedSimInfo.bssid)
|
|
|
}
|
|
|
- val base64 = Base64.encode(jsonObject.toString().toByteArray(), Base64.DEFAULT)
|
|
|
- .toString(Charsets.UTF_8)
|
|
|
- shellRun("echo '$base64' > /sdcard/Android/data/com.android.phone/files/config/config.json")
|
|
|
+
|
|
|
+ runCatching {
|
|
|
+ val jsonFile = File.createTempFile(
|
|
|
+ "temp",
|
|
|
+ ".json",
|
|
|
+ getContext().externalCacheDir
|
|
|
+ )
|
|
|
+ FileUtils.writeStringToFile(jsonFile, jsonObject.toString(), Charsets.UTF_8)
|
|
|
+ shellRun(
|
|
|
+ "cp ${jsonFile.absolutePath} /sdcard/Android/data/com.android.phone/files/config/config.json",
|
|
|
+ "chown radio /sdcard/Android/data/com.android.phone/files/config/config.json",
|
|
|
+ "cp ${jsonFile.absolutePath} /data/system/config.json",
|
|
|
+ "chown system /data/system/config.json"
|
|
|
+ )
|
|
|
+ jsonFile.delete()
|
|
|
+ }.onFailure {
|
|
|
+ Log.e(TAG, "Error updateSpoofedSimInfo: ${it.message}", it)
|
|
|
+ }
|
|
|
+// val base64 = Base64.encode(jsonObject.toString().toByteArray(), Base64.DEFAULT)
|
|
|
+// .toString(Charsets.UTF_8)
|
|
|
+// shellRun("echo '$base64' > /sdcard/Android/data/com.android.phone/files/config/config.json")
|
|
|
|
|
|
} catch (e: Exception) {
|
|
|
Log.e(TAG, "Error updateSpoofedSimInfo: ${e.message}", e)
|