|
|
@@ -18,11 +18,14 @@ import com.example.modifier.constants.PACKAGE_GMS
|
|
|
import com.example.modifier.constants.PACKAGE_MESSAGING
|
|
|
import com.example.modifier.constants.PACKAGE_PLAY
|
|
|
import com.example.modifier.constants.SIMView
|
|
|
+import com.example.modifier.extension.disable
|
|
|
+import com.example.modifier.extension.enable
|
|
|
import com.example.modifier.extension.kill
|
|
|
import com.example.modifier.extension.resume
|
|
|
import com.example.modifier.extension.suspend
|
|
|
import com.example.modifier.model.SpoofedInfo
|
|
|
import com.example.modifier.utils.ApduChannel
|
|
|
+import com.example.modifier.utils.ROOT_ACCESS
|
|
|
import com.example.modifier.utils.SimEncoder
|
|
|
import com.example.modifier.utils.genAndroidId
|
|
|
import com.example.modifier.utils.genICCID
|
|
|
@@ -199,110 +202,110 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
}
|
|
|
if (suspend == true) {
|
|
|
shellRun(
|
|
|
- PACKAGE_MESSAGING.suspend(),
|
|
|
- PACKAGE_PLAY.suspend(),
|
|
|
- PACKAGE_GMS.suspend(),
|
|
|
PACKAGE_GMS.kill(),
|
|
|
PACKAGE_PLAY.kill(),
|
|
|
PACKAGE_MESSAGING.kill(),
|
|
|
+ PACKAGE_MESSAGING.disable(),
|
|
|
)
|
|
|
}
|
|
|
val context = getContext()
|
|
|
|
|
|
- runCatching {
|
|
|
- val plmn = spoofedInfo.mcc + spoofedInfo.mnc
|
|
|
- val plmnHex = SimEncoder.encPLMN(spoofedInfo.mcc + spoofedInfo.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(spoofedInfo.iccid))
|
|
|
+ if (!ROOT_ACCESS) {
|
|
|
+ runCatching {
|
|
|
+ val plmn = spoofedInfo.mcc + spoofedInfo.mnc
|
|
|
+ val plmnHex = SimEncoder.encPLMN(spoofedInfo.mcc + spoofedInfo.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(spoofedInfo.iccid))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_MF)
|
|
|
- apduChannel.select(SIMView.FID_DF_TELECOM)
|
|
|
- apduChannel.select(SIMView.FID_EF_MSISDN)
|
|
|
- apduChannel.writeRecord(
|
|
|
- 1, SimEncoder.encMSISDN(spoofedInfo.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(spoofedInfo.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(spoofedInfo.imsi))
|
|
|
+ apduChannel.select(SIMView.FID_MF)
|
|
|
+ apduChannel.select(SIMView.FID_DF_GSM)
|
|
|
+ apduChannel.select(SIMView.FID_EF_IMSI)
|
|
|
+ apduChannel.writeBinary(SimEncoder.encIMSI(spoofedInfo.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'))
|
|
|
|
|
|
- apduChannel.select(SIMView.FID_EF_SPN)
|
|
|
- apduChannel.writeBinary("01542d4d6f62696c65ffffffffffffffff") //T-Mobile
|
|
|
+ apduChannel.select(SIMView.FID_EF_SPN)
|
|
|
+ apduChannel.writeBinary("01542d4d6f62696c65ffffffffffffffff") //T-Mobile
|
|
|
|
|
|
- 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(spoofedInfo.number)
|
|
|
- apduChannel.close()
|
|
|
+ val apduChannel1 = ApduChannel(telephonyManager, SIMView.AID_USIM)
|
|
|
+ apduChannel1.writeMSISDN_USIM(spoofedInfo.number)
|
|
|
+ apduChannel.close()
|
|
|
|
|
|
- runCatching {
|
|
|
- val mClass = Class.forName("android.telephony.TelephonyManager")
|
|
|
- val rebootRadio = mClass.getDeclaredMethod("rebootRadio")
|
|
|
- rebootRadio.isAccessible = true
|
|
|
- rebootRadio.invoke(telephonyManager)
|
|
|
- Log.i(TAG, "rebootRadio: success")
|
|
|
- }.onFailure {
|
|
|
- Log.e(TAG, "Error rebootRadio: ${it.message}", it)
|
|
|
- }
|
|
|
+ runCatching {
|
|
|
+ val mClass = Class.forName("android.telephony.TelephonyManager")
|
|
|
+ val rebootRadio = mClass.getDeclaredMethod("rebootRadio")
|
|
|
+ rebootRadio.isAccessible = true
|
|
|
+ rebootRadio.invoke(telephonyManager)
|
|
|
+ Log.i(TAG, "rebootRadio: success")
|
|
|
+ }.onFailure {
|
|
|
+ Log.e(TAG, "Error rebootRadio: ${it.message}", it)
|
|
|
+ }
|
|
|
|
|
|
- val subscriptionManager =
|
|
|
- context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE) as SubscriptionManager
|
|
|
+ val subscriptionManager =
|
|
|
+ context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE) as SubscriptionManager
|
|
|
|
|
|
- run rebootModem@{
|
|
|
- repeat(20) {
|
|
|
- runCatching {
|
|
|
- val activeSubscriptionInfoList =
|
|
|
- subscriptionManager.activeSubscriptionInfoList
|
|
|
- activeSubscriptionInfoList?.forEach {
|
|
|
- Log.i(TAG, "iccid:${it.iccId} target:${spoofedInfo.iccid}")
|
|
|
- if (it.iccId == spoofedInfo.iccid) {
|
|
|
- Log.i(TAG, "rebootModem: success")
|
|
|
- if (Build.DEVICE == "redfin") {
|
|
|
- delay(10000)
|
|
|
+ run rebootModem@{
|
|
|
+ repeat(20) {
|
|
|
+ runCatching {
|
|
|
+ val activeSubscriptionInfoList =
|
|
|
+ subscriptionManager.activeSubscriptionInfoList
|
|
|
+ activeSubscriptionInfoList?.forEach {
|
|
|
+ Log.i(TAG, "iccid:${it.iccId} target:${spoofedInfo.iccid}")
|
|
|
+ if (it.iccId == spoofedInfo.iccid) {
|
|
|
+ Log.i(TAG, "rebootModem: success")
|
|
|
+ if (Build.DEVICE == "redfin") {
|
|
|
+ delay(10000)
|
|
|
+ }
|
|
|
+ return@rebootModem
|
|
|
+ } else {
|
|
|
+ delay(2000)
|
|
|
}
|
|
|
- return@rebootModem
|
|
|
- } else {
|
|
|
- delay(2000)
|
|
|
}
|
|
|
+ }.onFailure {
|
|
|
+ Log.e(TAG, "Error reading ICCID: ${it.message}", it)
|
|
|
}
|
|
|
- }.onFailure {
|
|
|
- Log.e(TAG, "Error reading ICCID: ${it.message}", it)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -310,12 +313,11 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
|
|
|
if (suspend == true) {
|
|
|
shellRun(
|
|
|
- PACKAGE_GMS.resume(),
|
|
|
- PACKAGE_PLAY.resume(),
|
|
|
- PACKAGE_MESSAGING.resume(),
|
|
|
PACKAGE_PLAY.kill(),
|
|
|
PACKAGE_GMS.kill(),
|
|
|
- PACKAGE_MESSAGING.kill(),
|
|
|
+ "sleep 5",
|
|
|
+ PACKAGE_MESSAGING.enable(),
|
|
|
+ "cmd role add-role-holder android.app.role.SMS $PACKAGE_MESSAGING",
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -398,7 +400,8 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
androidId = genAndroidId(),
|
|
|
gmsAid = genAndroidId(),
|
|
|
rootAid = genAndroidId()
|
|
|
- )
|
|
|
+ ),
|
|
|
+ suspend = false
|
|
|
)
|
|
|
}
|
|
|
}
|