|
|
@@ -17,6 +17,8 @@ import com.example.modifier.constants.PACKAGE_GMS
|
|
|
import com.example.modifier.constants.PACKAGE_MESSAGING
|
|
|
import com.example.modifier.constants.SIMView
|
|
|
import com.example.modifier.extension.kill
|
|
|
+import com.example.modifier.extension.resume
|
|
|
+import com.example.modifier.extension.suspend
|
|
|
import com.example.modifier.model.SpoofedSimInfo
|
|
|
import com.example.modifier.utils.ApduChannel
|
|
|
import com.example.modifier.utils.ROOT_ACCESS
|
|
|
@@ -133,19 +135,27 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
}
|
|
|
try {
|
|
|
if (ROOT_ACCESS) {
|
|
|
- if (suspend == true) {
|
|
|
- suspendPackage(PACKAGE_GMS, PACKAGE_MESSAGING)
|
|
|
- }
|
|
|
shellRun(
|
|
|
- "setprop persist.spoof.number ${spoofedSimInfo.number}",
|
|
|
- "setprop persist.spoof.mcc ${spoofedSimInfo.mcc}",
|
|
|
- "setprop persist.spoof.mnc ${spoofedSimInfo.mnc}",
|
|
|
- "setprop persist.spoof.iccid ${spoofedSimInfo.iccid}",
|
|
|
- "setprop persist.spoof.imsi ${spoofedSimInfo.imsi}",
|
|
|
- "setprop persist.spoof.imei ${spoofedSimInfo.imei}",
|
|
|
- "setprop persist.spoof.country ${spoofedSimInfo.country}",
|
|
|
- "setprop persist.spoof.carrier.id ${spoofedSimInfo.carrierId}",
|
|
|
- "setprop persist.spoof.carrier.name '${spoofedSimInfo.carrierName}'",
|
|
|
+ *(when {
|
|
|
+ suspend == true -> arrayOf(
|
|
|
+ PACKAGE_GMS.suspend(),
|
|
|
+ "sleep 1",
|
|
|
+ PACKAGE_MESSAGING.suspend(),
|
|
|
+ "sleep 1"
|
|
|
+ )
|
|
|
+
|
|
|
+ else -> emptyArray()
|
|
|
+ } + arrayOf(
|
|
|
+ "setprop persist.spoof.number ${spoofedSimInfo.number}",
|
|
|
+ "setprop persist.spoof.mcc ${spoofedSimInfo.mcc}",
|
|
|
+ "setprop persist.spoof.mnc ${spoofedSimInfo.mnc}",
|
|
|
+ "setprop persist.spoof.iccid ${spoofedSimInfo.iccid}",
|
|
|
+ "setprop persist.spoof.imsi ${spoofedSimInfo.imsi}",
|
|
|
+ "setprop persist.spoof.imei ${spoofedSimInfo.imei}",
|
|
|
+ "setprop persist.spoof.country ${spoofedSimInfo.country}",
|
|
|
+ "setprop persist.spoof.carrier.id ${spoofedSimInfo.carrierId}",
|
|
|
+ "setprop persist.spoof.carrier.name '${spoofedSimInfo.carrierName}'",
|
|
|
+ ))
|
|
|
)
|
|
|
|
|
|
val context = getContext()
|
|
|
@@ -169,80 +179,86 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
|
|
|
} else {
|
|
|
if (suspend == true) {
|
|
|
- suspendPackage(PACKAGE_GMS, PACKAGE_MESSAGING)
|
|
|
shellRun(
|
|
|
+ PACKAGE_GMS.suspend(),
|
|
|
PACKAGE_GMS.kill(),
|
|
|
+ PACKAGE_MESSAGING.suspend(),
|
|
|
PACKAGE_MESSAGING.kill()
|
|
|
)
|
|
|
+ }
|
|
|
|
|
|
+ val plmn = spoofedSimInfo.mcc + spoofedSimInfo.mnc
|
|
|
+ val plmnHex = SimEncoder.encPLMN(spoofedSimInfo.mcc + spoofedSimInfo.mnc)
|
|
|
+ val plmnwactHex = SimEncoder.encPLMNwAcT("$plmn:4000,$plmn:8000,$plmn:0080")
|
|
|
+ val fplmn =
|
|
|
+ SimEncoder.encPLMN("46000,46001,46002,46006,46007,46011,46012,46015,46020")
|
|
|
+ val telephonyManager =
|
|
|
+ context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
|
|
|
+ val apduChannel = ApduChannel(telephonyManager, SIMView.AID_CUSTOM)
|
|
|
+ apduChannel.select(SIMView.FID_MF)
|
|
|
+ apduChannel.select(SIMView.FID_EF_ICCID)
|
|
|
+ apduChannel.writeBinary(SimEncoder.encICCID(spoofedSimInfo.iccid))
|
|
|
|
|
|
- val plmn = spoofedSimInfo.mcc + spoofedSimInfo.mnc
|
|
|
- val plmnHex = SimEncoder.encPLMN(spoofedSimInfo.mcc + spoofedSimInfo.mnc)
|
|
|
- val plmnwactHex = SimEncoder.encPLMNwAcT("$plmn:4000,$plmn:8000,$plmn:0080")
|
|
|
- val fplmn =
|
|
|
- SimEncoder.encPLMN("46000,46001,46002,46006,46007,46011,46012,46015,46020")
|
|
|
- val telephonyManager =
|
|
|
- context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
|
|
|
- val apduChannel = ApduChannel(telephonyManager, SIMView.AID_CUSTOM)
|
|
|
- apduChannel.select(SIMView.FID_MF)
|
|
|
- apduChannel.select(SIMView.FID_EF_ICCID)
|
|
|
- apduChannel.writeBinary(SimEncoder.encICCID(spoofedSimInfo.iccid))
|
|
|
-
|
|
|
- apduChannel.select(SIMView.FID_MF)
|
|
|
- apduChannel.select(SIMView.FID_DF_TELECOM)
|
|
|
- apduChannel.select(SIMView.FID_EF_MSISDN)
|
|
|
- apduChannel.writeRecord(
|
|
|
- 1, SimEncoder.encMSISDN(spoofedSimInfo.number)
|
|
|
- .padStart(56, 'F')
|
|
|
- )
|
|
|
+ apduChannel.select(SIMView.FID_MF)
|
|
|
+ apduChannel.select(SIMView.FID_DF_TELECOM)
|
|
|
+ apduChannel.select(SIMView.FID_EF_MSISDN)
|
|
|
+ apduChannel.writeRecord(
|
|
|
+ 1, SimEncoder.encMSISDN(spoofedSimInfo.number)
|
|
|
+ .padStart(56, 'F')
|
|
|
+ )
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_MF)
|
|
|
- apduChannel.select(SIMView.FID_DF_GSM)
|
|
|
- apduChannel.select(SIMView.FID_EF_IMSI)
|
|
|
- apduChannel.writeBinary(SimEncoder.encIMSI(spoofedSimInfo.imsi))
|
|
|
+ apduChannel.select(SIMView.FID_MF)
|
|
|
+ apduChannel.select(SIMView.FID_DF_GSM)
|
|
|
+ apduChannel.select(SIMView.FID_EF_IMSI)
|
|
|
+ apduChannel.writeBinary(SimEncoder.encIMSI(spoofedSimInfo.imsi))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_PLMNSEL)
|
|
|
- apduChannel.writeBinary(plmnHex.padEnd(120, 'f'))
|
|
|
+ apduChannel.select(SIMView.FID_EF_PLMNSEL)
|
|
|
+ apduChannel.writeBinary(plmnHex.padEnd(120, 'f'))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_EHPLMN)
|
|
|
- apduChannel.writeBinary(plmnHex.padEnd(24, 'f'))
|
|
|
+ apduChannel.select(SIMView.FID_EF_EHPLMN)
|
|
|
+ apduChannel.writeBinary(plmnHex.padEnd(24, 'f'))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_PLMNWACT)
|
|
|
- apduChannel.writeBinary(plmnwactHex.padEnd(240, 'f'))
|
|
|
+ apduChannel.select(SIMView.FID_EF_PLMNWACT)
|
|
|
+ apduChannel.writeBinary(plmnwactHex.padEnd(240, 'f'))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_OPLMNWACT)
|
|
|
- apduChannel.writeBinary(plmnwactHex.padEnd(120, 'f'))
|
|
|
+ apduChannel.select(SIMView.FID_EF_OPLMNWACT)
|
|
|
+ apduChannel.writeBinary(plmnwactHex.padEnd(120, 'f'))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_HPLMNWACT)
|
|
|
- apduChannel.writeBinary(plmnwactHex.padEnd(40, 'f'))
|
|
|
+ apduChannel.select(SIMView.FID_EF_HPLMNWACT)
|
|
|
+ apduChannel.writeBinary(plmnwactHex.padEnd(40, 'f'))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_FPLMN)
|
|
|
- apduChannel.writeBinary(fplmn.padEnd(60, 'f'))
|
|
|
+ apduChannel.select(SIMView.FID_EF_FPLMN)
|
|
|
+ apduChannel.writeBinary(fplmn.padEnd(60, 'f'))
|
|
|
|
|
|
- if (plmn.isNotEmpty()) {
|
|
|
- if (plmn.length == 5) {
|
|
|
- apduChannel.select(SIMView.FID_EF_AD)
|
|
|
- apduChannel.writeBinary("00000102")
|
|
|
- } else if (plmn.length == 6) {
|
|
|
- apduChannel.select(SIMView.FID_EF_AD)
|
|
|
- apduChannel.writeBinary("00000103")
|
|
|
- }
|
|
|
+ if (plmn.isNotEmpty()) {
|
|
|
+ if (plmn.length == 5) {
|
|
|
+ apduChannel.select(SIMView.FID_EF_AD)
|
|
|
+ apduChannel.writeBinary("00000102")
|
|
|
+ } else if (plmn.length == 6) {
|
|
|
+ apduChannel.select(SIMView.FID_EF_AD)
|
|
|
+ apduChannel.writeBinary("00000103")
|
|
|
}
|
|
|
- apduChannel.close()
|
|
|
+ }
|
|
|
+ apduChannel.close()
|
|
|
|
|
|
- val apduChannel1 = ApduChannel(telephonyManager, SIMView.AID_USIM)
|
|
|
- apduChannel1.writeMSISDN_USIM(spoofedSimInfo.number)
|
|
|
- apduChannel.close()
|
|
|
+ val apduChannel1 = ApduChannel(telephonyManager, SIMView.AID_USIM)
|
|
|
+ apduChannel1.writeMSISDN_USIM(spoofedSimInfo.number)
|
|
|
+ apduChannel.close()
|
|
|
|
|
|
- telephonyManager.rebootModem()
|
|
|
- delay(5000)
|
|
|
+ telephonyManager.rebootModem()
|
|
|
+ delay(10000)
|
|
|
|
|
|
+ if (suspend == true) {
|
|
|
shellRun(
|
|
|
PACKAGE_GMS.kill(),
|
|
|
- PACKAGE_MESSAGING.kill()
|
|
|
+ PACKAGE_MESSAGING.kill(),
|
|
|
+ PACKAGE_GMS.resume(),
|
|
|
+ "sleep 1",
|
|
|
+ PACKAGE_MESSAGING.resume(),
|
|
|
+ "sleep 1",
|
|
|
+ PACKAGE_MESSAGING.resume(),
|
|
|
+ "sleep 1"
|
|
|
)
|
|
|
- delay(1000)
|
|
|
- resumePackage(PACKAGE_GMS, PACKAGE_MESSAGING)
|
|
|
}
|
|
|
}
|
|
|
} catch (e: Exception) {
|
|
|
@@ -250,6 +266,12 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ suspend fun updateAvailable(available: Boolean) {
|
|
|
+ context.simInfoDataStore.edit {
|
|
|
+ it[PreferencesKeys.AVAILABLE] = available
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
suspend fun mock() {
|
|
|
if (isOldVersion(context)) {
|
|
|
val content = getContext().assets.open("us_numbers.txt").bufferedReader().use {
|
|
|
@@ -275,7 +297,8 @@ class SpoofedSimInfoRepo private constructor(private val context: Context) {
|
|
|
available = false,
|
|
|
carrierId = "1779",
|
|
|
carrierName = "Cricket Wireless"
|
|
|
- )
|
|
|
+ ),
|
|
|
+ suspend = false
|
|
|
)
|
|
|
}
|
|
|
} else {
|