|
@@ -2,7 +2,6 @@ package com.example.modifier.repo
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
-import android.os.Build
|
|
|
|
|
import android.telephony.SubscriptionManager
|
|
import android.telephony.SubscriptionManager
|
|
|
import android.telephony.TelephonyManager
|
|
import android.telephony.TelephonyManager
|
|
|
import android.util.Log
|
|
import android.util.Log
|
|
@@ -18,9 +17,10 @@ import com.example.modifier.constants.PACKAGE_MESSAGING
|
|
|
import com.example.modifier.constants.PACKAGE_PLAY
|
|
import com.example.modifier.constants.PACKAGE_PLAY
|
|
|
import com.example.modifier.constants.SIMView
|
|
import com.example.modifier.constants.SIMView
|
|
|
import com.example.modifier.extension.kill
|
|
import com.example.modifier.extension.kill
|
|
|
-import com.example.modifier.model.SpoofedSimInfo
|
|
|
|
|
|
|
+import com.example.modifier.model.SpoofedInfo
|
|
|
import com.example.modifier.utils.ApduChannel
|
|
import com.example.modifier.utils.ApduChannel
|
|
|
import com.example.modifier.utils.SimEncoder
|
|
import com.example.modifier.utils.SimEncoder
|
|
|
|
|
+import com.example.modifier.utils.genAndroidId
|
|
|
import com.example.modifier.utils.genICCID
|
|
import com.example.modifier.utils.genICCID
|
|
|
import com.example.modifier.utils.genIMEI
|
|
import com.example.modifier.utils.genIMEI
|
|
|
import com.example.modifier.utils.genIMSI
|
|
import com.example.modifier.utils.genIMSI
|
|
@@ -67,6 +67,9 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
val BSSID = stringPreferencesKey("bssid")
|
|
val BSSID = stringPreferencesKey("bssid")
|
|
|
val BT_MAC = stringPreferencesKey("bt_mac")
|
|
val BT_MAC = stringPreferencesKey("bt_mac")
|
|
|
val ETH_MAC = stringPreferencesKey("eth_mac")
|
|
val ETH_MAC = stringPreferencesKey("eth_mac")
|
|
|
|
|
+ val ANDROID_ID = stringPreferencesKey("android_id")
|
|
|
|
|
+ val GMS_AID = stringPreferencesKey("gms_aid")
|
|
|
|
|
+ val ROOT_AID = stringPreferencesKey("root_aid")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private val simInfoFlow = context.simInfoDataStore.data.map {
|
|
private val simInfoFlow = context.simInfoDataStore.data.map {
|
|
@@ -87,7 +90,10 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
val bssid = it[PreferencesKeys.BSSID] ?: ""
|
|
val bssid = it[PreferencesKeys.BSSID] ?: ""
|
|
|
val btMac = it[PreferencesKeys.BT_MAC] ?: ""
|
|
val btMac = it[PreferencesKeys.BT_MAC] ?: ""
|
|
|
val ethMac = it[PreferencesKeys.ETH_MAC] ?: ""
|
|
val ethMac = it[PreferencesKeys.ETH_MAC] ?: ""
|
|
|
- SpoofedSimInfo(
|
|
|
|
|
|
|
+ val androidId = it[PreferencesKeys.ANDROID_ID] ?: ""
|
|
|
|
|
+ val gmsAid = it[PreferencesKeys.GMS_AID] ?: ""
|
|
|
|
|
+ val rootAid = it[PreferencesKeys.ROOT_AID] ?: ""
|
|
|
|
|
+ SpoofedInfo(
|
|
|
numberId = numberId,
|
|
numberId = numberId,
|
|
|
number = number,
|
|
number = number,
|
|
|
mcc = mcc,
|
|
mcc = mcc,
|
|
@@ -104,12 +110,15 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
wifiMac = wifiMac,
|
|
wifiMac = wifiMac,
|
|
|
bssid = bssid,
|
|
bssid = bssid,
|
|
|
btMac = btMac,
|
|
btMac = btMac,
|
|
|
- ethMac = ethMac
|
|
|
|
|
|
|
+ ethMac = ethMac,
|
|
|
|
|
+ androidId = androidId,
|
|
|
|
|
+ gmsAid = gmsAid,
|
|
|
|
|
+ rootAid = rootAid
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- val spoofedSimInfo = MutableStateFlow(
|
|
|
|
|
- SpoofedSimInfo(
|
|
|
|
|
|
|
+ val spoofedInfo = MutableStateFlow(
|
|
|
|
|
+ SpoofedInfo(
|
|
|
numberId = 0,
|
|
numberId = 0,
|
|
|
number = "",
|
|
number = "",
|
|
|
mcc = "",
|
|
mcc = "",
|
|
@@ -126,42 +135,45 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
wifiMac = "",
|
|
wifiMac = "",
|
|
|
bssid = "",
|
|
bssid = "",
|
|
|
btMac = "",
|
|
btMac = "",
|
|
|
- ethMac = ""
|
|
|
|
|
|
|
+ ethMac = "",
|
|
|
|
|
+ androidId = "",
|
|
|
|
|
+ gmsAid = "",
|
|
|
|
|
+ rootAid = ""
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
init {
|
|
init {
|
|
|
CoroutineScope(Dispatchers.IO).launch {
|
|
CoroutineScope(Dispatchers.IO).launch {
|
|
|
simInfoFlow.collect {
|
|
simInfoFlow.collect {
|
|
|
- spoofedSimInfo.emit(it)
|
|
|
|
|
|
|
+ spoofedInfo.emit(it)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@SuppressLint("MissingPermission")
|
|
@SuppressLint("MissingPermission")
|
|
|
- suspend fun updateSpoofedSimInfo(spoofedSimInfo: SpoofedSimInfo, suspend: Boolean? = true) {
|
|
|
|
|
|
|
+ suspend fun updateSpoofedSimInfo(spoofedInfo: SpoofedInfo, suspend: Boolean? = true) {
|
|
|
context.getSharedPreferences("share_sim_info", Context.MODE_PRIVATE)
|
|
context.getSharedPreferences("share_sim_info", Context.MODE_PRIVATE)
|
|
|
?.edit()
|
|
?.edit()
|
|
|
- ?.putString("imei", spoofedSimInfo.imei)
|
|
|
|
|
|
|
+ ?.putString("imei", spoofedInfo.imei)
|
|
|
?.apply()
|
|
?.apply()
|
|
|
context.simInfoDataStore.edit {
|
|
context.simInfoDataStore.edit {
|
|
|
- it[PreferencesKeys.NUMBER_ID] = spoofedSimInfo.numberId
|
|
|
|
|
- it[PreferencesKeys.NUMBER] = spoofedSimInfo.number
|
|
|
|
|
- it[PreferencesKeys.MCC] = spoofedSimInfo.mcc
|
|
|
|
|
- it[PreferencesKeys.MNC] = spoofedSimInfo.mnc
|
|
|
|
|
- it[PreferencesKeys.ICCID] = spoofedSimInfo.iccid
|
|
|
|
|
- it[PreferencesKeys.IMSI] = spoofedSimInfo.imsi
|
|
|
|
|
- it[PreferencesKeys.IMEI] = spoofedSimInfo.imei
|
|
|
|
|
- it[PreferencesKeys.COUNTRY] = spoofedSimInfo.country
|
|
|
|
|
- it[PreferencesKeys.AREA_CODE] = spoofedSimInfo.areaCode
|
|
|
|
|
- it[PreferencesKeys.AVAILABLE] = spoofedSimInfo.available
|
|
|
|
|
- it[PreferencesKeys.CARRIER_ID] = spoofedSimInfo.carrierId
|
|
|
|
|
- it[PreferencesKeys.CARRIER_NAME] = spoofedSimInfo.carrierName
|
|
|
|
|
- it[PreferencesKeys.SERIAL_NO] = spoofedSimInfo.serialNo
|
|
|
|
|
- it[PreferencesKeys.WIFI_MAC] = spoofedSimInfo.wifiMac
|
|
|
|
|
- it[PreferencesKeys.BSSID] = spoofedSimInfo.bssid
|
|
|
|
|
- it[PreferencesKeys.BT_MAC] = spoofedSimInfo.btMac
|
|
|
|
|
- it[PreferencesKeys.ETH_MAC] = spoofedSimInfo.ethMac
|
|
|
|
|
|
|
+ it[PreferencesKeys.NUMBER_ID] = spoofedInfo.numberId
|
|
|
|
|
+ it[PreferencesKeys.NUMBER] = spoofedInfo.number
|
|
|
|
|
+ it[PreferencesKeys.MCC] = spoofedInfo.mcc
|
|
|
|
|
+ it[PreferencesKeys.MNC] = spoofedInfo.mnc
|
|
|
|
|
+ it[PreferencesKeys.ICCID] = spoofedInfo.iccid
|
|
|
|
|
+ it[PreferencesKeys.IMSI] = spoofedInfo.imsi
|
|
|
|
|
+ it[PreferencesKeys.IMEI] = spoofedInfo.imei
|
|
|
|
|
+ it[PreferencesKeys.COUNTRY] = spoofedInfo.country
|
|
|
|
|
+ it[PreferencesKeys.AREA_CODE] = spoofedInfo.areaCode
|
|
|
|
|
+ it[PreferencesKeys.AVAILABLE] = spoofedInfo.available
|
|
|
|
|
+ it[PreferencesKeys.CARRIER_ID] = spoofedInfo.carrierId
|
|
|
|
|
+ it[PreferencesKeys.CARRIER_NAME] = spoofedInfo.carrierName
|
|
|
|
|
+ it[PreferencesKeys.SERIAL_NO] = spoofedInfo.serialNo
|
|
|
|
|
+ it[PreferencesKeys.WIFI_MAC] = spoofedInfo.wifiMac
|
|
|
|
|
+ it[PreferencesKeys.BSSID] = spoofedInfo.bssid
|
|
|
|
|
+ it[PreferencesKeys.BT_MAC] = spoofedInfo.btMac
|
|
|
|
|
+ it[PreferencesKeys.ETH_MAC] = spoofedInfo.ethMac
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
runCatching {
|
|
runCatching {
|
|
@@ -170,7 +182,7 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
)
|
|
)
|
|
|
FileUtils.writeStringToFile(
|
|
FileUtils.writeStringToFile(
|
|
|
jsonFile,
|
|
jsonFile,
|
|
|
- Json.encodeToString(spoofedSimInfo),
|
|
|
|
|
|
|
+ Json.encodeToString(spoofedInfo),
|
|
|
Charsets.UTF_8
|
|
Charsets.UTF_8
|
|
|
)
|
|
)
|
|
|
shellRun(
|
|
shellRun(
|
|
@@ -190,8 +202,8 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
val context = getContext()
|
|
val context = getContext()
|
|
|
|
|
|
|
|
runCatching {
|
|
runCatching {
|
|
|
- val plmn = spoofedSimInfo.mcc + spoofedSimInfo.mnc
|
|
|
|
|
- val plmnHex = SimEncoder.encPLMN(spoofedSimInfo.mcc + spoofedSimInfo.mnc)
|
|
|
|
|
|
|
+ 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 plmnwactHex = SimEncoder.encPLMNwAcT("$plmn:4000,$plmn:8000,$plmn:0080")
|
|
|
val fplmn =
|
|
val fplmn =
|
|
|
SimEncoder.encPLMN("46000,46001,46002,46006,46007,46011,46012,46015,46020")
|
|
SimEncoder.encPLMN("46000,46001,46002,46006,46007,46011,46012,46015,46020")
|
|
@@ -200,20 +212,20 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
val apduChannel = ApduChannel(telephonyManager, SIMView.AID_CUSTOM)
|
|
val apduChannel = ApduChannel(telephonyManager, SIMView.AID_CUSTOM)
|
|
|
apduChannel.select(SIMView.FID_MF)
|
|
apduChannel.select(SIMView.FID_MF)
|
|
|
apduChannel.select(SIMView.FID_EF_ICCID)
|
|
apduChannel.select(SIMView.FID_EF_ICCID)
|
|
|
- apduChannel.writeBinary(SimEncoder.encICCID(spoofedSimInfo.iccid))
|
|
|
|
|
|
|
+ apduChannel.writeBinary(SimEncoder.encICCID(spoofedInfo.iccid))
|
|
|
|
|
|
|
|
apduChannel.select(SIMView.FID_MF)
|
|
apduChannel.select(SIMView.FID_MF)
|
|
|
apduChannel.select(SIMView.FID_DF_TELECOM)
|
|
apduChannel.select(SIMView.FID_DF_TELECOM)
|
|
|
apduChannel.select(SIMView.FID_EF_MSISDN)
|
|
apduChannel.select(SIMView.FID_EF_MSISDN)
|
|
|
apduChannel.writeRecord(
|
|
apduChannel.writeRecord(
|
|
|
- 1, SimEncoder.encMSISDN(spoofedSimInfo.number)
|
|
|
|
|
|
|
+ 1, SimEncoder.encMSISDN(spoofedInfo.number)
|
|
|
.padStart(56, 'F')
|
|
.padStart(56, 'F')
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
apduChannel.select(SIMView.FID_MF)
|
|
apduChannel.select(SIMView.FID_MF)
|
|
|
apduChannel.select(SIMView.FID_DF_GSM)
|
|
apduChannel.select(SIMView.FID_DF_GSM)
|
|
|
apduChannel.select(SIMView.FID_EF_IMSI)
|
|
apduChannel.select(SIMView.FID_EF_IMSI)
|
|
|
- apduChannel.writeBinary(SimEncoder.encIMSI(spoofedSimInfo.imsi))
|
|
|
|
|
|
|
+ apduChannel.writeBinary(SimEncoder.encIMSI(spoofedInfo.imsi))
|
|
|
|
|
|
|
|
apduChannel.select(SIMView.FID_EF_PLMNSEL)
|
|
apduChannel.select(SIMView.FID_EF_PLMNSEL)
|
|
|
apduChannel.writeBinary(plmnHex.padEnd(120, 'f'))
|
|
apduChannel.writeBinary(plmnHex.padEnd(120, 'f'))
|
|
@@ -248,7 +260,7 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
apduChannel.close()
|
|
apduChannel.close()
|
|
|
|
|
|
|
|
val apduChannel1 = ApduChannel(telephonyManager, SIMView.AID_USIM)
|
|
val apduChannel1 = ApduChannel(telephonyManager, SIMView.AID_USIM)
|
|
|
- apduChannel1.writeMSISDN_USIM(spoofedSimInfo.number)
|
|
|
|
|
|
|
+ apduChannel1.writeMSISDN_USIM(spoofedInfo.number)
|
|
|
apduChannel.close()
|
|
apduChannel.close()
|
|
|
|
|
|
|
|
runCatching {
|
|
runCatching {
|
|
@@ -272,8 +284,8 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
val activeSubscriptionInfoList =
|
|
val activeSubscriptionInfoList =
|
|
|
subscriptionManager.activeSubscriptionInfoList
|
|
subscriptionManager.activeSubscriptionInfoList
|
|
|
activeSubscriptionInfoList?.forEach {
|
|
activeSubscriptionInfoList?.forEach {
|
|
|
- Log.i(TAG, "iccid:${it.iccId} target:${spoofedSimInfo.iccid}")
|
|
|
|
|
- if (it.iccId == spoofedSimInfo.iccid) {
|
|
|
|
|
|
|
+ Log.i(TAG, "iccid:${it.iccId} target:${spoofedInfo.iccid}")
|
|
|
|
|
+ if (it.iccId == spoofedInfo.iccid) {
|
|
|
Log.i(TAG, "rebootModem: success")
|
|
Log.i(TAG, "rebootModem: success")
|
|
|
return@rebootModem
|
|
return@rebootModem
|
|
|
}
|
|
}
|
|
@@ -328,7 +340,7 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
.firstOrNull()
|
|
.firstOrNull()
|
|
|
?.let {
|
|
?.let {
|
|
|
updateSpoofedSimInfo(
|
|
updateSpoofedSimInfo(
|
|
|
- SpoofedSimInfo(
|
|
|
|
|
|
|
+ SpoofedInfo(
|
|
|
numberId = 0,
|
|
numberId = 0,
|
|
|
number = it,
|
|
number = it,
|
|
|
mcc = "310",
|
|
mcc = "310",
|
|
@@ -345,7 +357,10 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
wifiMac = genMacAddress(),
|
|
wifiMac = genMacAddress(),
|
|
|
bssid = genMacAddress(),
|
|
bssid = genMacAddress(),
|
|
|
btMac = genMacAddress(),
|
|
btMac = genMacAddress(),
|
|
|
- ethMac = genMacAddress()
|
|
|
|
|
|
|
+ ethMac = genMacAddress(),
|
|
|
|
|
+ androidId = genAndroidId(),
|
|
|
|
|
+ gmsAid = genAndroidId(),
|
|
|
|
|
+ rootAid = genAndroidId()
|
|
|
),
|
|
),
|
|
|
suspend = false
|
|
suspend = false
|
|
|
)
|
|
)
|
|
@@ -360,7 +375,7 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
.firstOrNull()
|
|
.firstOrNull()
|
|
|
?.let {
|
|
?.let {
|
|
|
updateSpoofedSimInfo(
|
|
updateSpoofedSimInfo(
|
|
|
- SpoofedSimInfo(
|
|
|
|
|
|
|
+ SpoofedInfo(
|
|
|
numberId = 0,
|
|
numberId = 0,
|
|
|
number = it,
|
|
number = it,
|
|
|
mcc = "310",
|
|
mcc = "310",
|
|
@@ -377,7 +392,10 @@ class SpoofedInfoRepo private constructor(private val context: Context) {
|
|
|
wifiMac = genMacAddress(),
|
|
wifiMac = genMacAddress(),
|
|
|
bssid = genMacAddress(),
|
|
bssid = genMacAddress(),
|
|
|
btMac = genMacAddress(),
|
|
btMac = genMacAddress(),
|
|
|
- ethMac = genMacAddress()
|
|
|
|
|
|
|
+ ethMac = genMacAddress(),
|
|
|
|
|
+ androidId = genAndroidId(),
|
|
|
|
|
+ gmsAid = genAndroidId(),
|
|
|
|
|
+ rootAid = genAndroidId()
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|