|
|
@@ -131,7 +131,7 @@ setImmediate(() => {
|
|
|
|
|
|
function readConfig() {
|
|
|
const configFile = File.$new('/data/system/config.json')
|
|
|
- log(`read config from ${configFile.getAbsolutePath()}`)
|
|
|
+ // log(`read config from ${configFile.getAbsolutePath()}`)
|
|
|
const json = readFile(configFile)
|
|
|
if (!json) {
|
|
|
return {}
|
|
|
@@ -145,7 +145,7 @@ setImmediate(() => {
|
|
|
const configFile = File.$new('/data/system/config.json')
|
|
|
log(`save config to ${configFile.getAbsolutePath()}`)
|
|
|
const json = JSON.stringify(config)
|
|
|
- log(`config: ${json}`)
|
|
|
+ // log(`config: ${json}`)
|
|
|
writeFile(configFile, json)
|
|
|
}
|
|
|
|
|
|
@@ -213,43 +213,65 @@ setImmediate(() => {
|
|
|
// log(res)
|
|
|
// return res
|
|
|
// }
|
|
|
+ const networkTypes = [
|
|
|
+ 'TYPE_MOBILE',
|
|
|
+ 'TYPE_WIFI',
|
|
|
+ 'TYPE_MOBILE_MMS',
|
|
|
+ 'TYPE_MOBILE_SUPL',
|
|
|
+ 'TYPE_MOBILE_DUN',
|
|
|
+ 'TYPE_MOBILE_HIPRI',
|
|
|
+ 'TYPE_WIMAX',
|
|
|
+ 'TYPE_BLUETOOTH',
|
|
|
+ 'TYPE_DUMMY',
|
|
|
+ 'TYPE_ETHERNET',
|
|
|
+ 'TYPE_MOBILE_FOTA',
|
|
|
+ 'TYPE_MOBILE_IMS',
|
|
|
+ 'TYPE_MOBILE_CBS',
|
|
|
+ 'TYPE_WIFI_P2P',
|
|
|
+ 'TYPE_MOBILE_IA',
|
|
|
+ 'TYPE_MOBILE_EMERGENCY',
|
|
|
+ 'TYPE_PROXY',
|
|
|
+ 'TYPE_VPN',
|
|
|
+ 'TYPE_TEST'
|
|
|
+ ]
|
|
|
ConnectivityService.getNetworkInfo.overload('int').implementation = function (networkType) {
|
|
|
- log('getNetworkInfo')
|
|
|
+ log(`ConnectivityService.getNetworkInfo(${networkTypes[networkType]})`)
|
|
|
const res = this.getNetworkInfo(networkType)
|
|
|
- log(res)
|
|
|
+ log(' ' + res)
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
const InterfaceParams = Java.use('android.net.connectivity.com.android.net.module.util.InterfaceParams')
|
|
|
InterfaceParams.getByName.overload('java.lang.String').implementation = function (name) {
|
|
|
- log('getByName')
|
|
|
const res = this.getByName(name)
|
|
|
- log(res)
|
|
|
+ log(`InterfaceParams.getByName(${name}) -> ${res}`)
|
|
|
return res
|
|
|
}
|
|
|
InterfaceParams.getMacAddress.overload('java.net.NetworkInterface').implementation = function (
|
|
|
networkInterface
|
|
|
) {
|
|
|
- log('getMacAddress')
|
|
|
const res = this.getMacAddress(networkInterface)
|
|
|
- log(res)
|
|
|
+ log(`InterfaceParams.getMacAddress(${networkInterface}) -> ${res}`)
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
const NetworkInterface = Java.use('java.net.NetworkInterface')
|
|
|
NetworkInterface.$init.overload().implementation = function () {
|
|
|
- log('NetworkInterface')
|
|
|
+ log(`NetworkInterface.new -> ${res}`)
|
|
|
const res = this.$new()
|
|
|
- log(res)
|
|
|
return res
|
|
|
}
|
|
|
NetworkInterface.$init.overload('java.lang.String', 'int', '[Ljava.net.InetAddress;').implementation =
|
|
|
function (name, index, addrs) {
|
|
|
- log('NetworkInterface')
|
|
|
const res = this.$new(name, index, addrs)
|
|
|
- log(res)
|
|
|
+ log(`NetworkInterface.new(${name}, ${index}, ${addrs}) -> ${res}`)
|
|
|
return res
|
|
|
}
|
|
|
+ NetworkInterface.getNetworkInterfaces.overload().implementation = function () {
|
|
|
+ const res = this.getNetworkInterfaces()
|
|
|
+ log(`NetworkInterface.getNetworkInterfaces() -> ${res}`)
|
|
|
+ return res
|
|
|
+ }
|
|
|
|
|
|
const wifiClassLoader = classLoaders.find((i) => i.toString().includes('wifi'))
|
|
|
Java.classFactory.loader = wifiClassLoader
|
|
|
@@ -261,22 +283,22 @@ setImmediate(() => {
|
|
|
log(` ${original} -> ${spoof}`)
|
|
|
return spoof
|
|
|
}
|
|
|
- // WifiServiceImpl.getConnectionInfo.overload('java.lang.String', 'java.lang.String').implementation = function (
|
|
|
- // callingPackage,
|
|
|
- // callingFeatureId
|
|
|
- // ) {
|
|
|
- // const original = this.getConnectionInfo(callingPackage, callingFeatureId)
|
|
|
- // const originalMac = original.getMacAddress()
|
|
|
- // const originalBSSID = original.getBSSID()
|
|
|
- // const spoofedMac = readConfig().mac || randomMac()
|
|
|
- // const spoofedBSSID = readConfig().bssid || randomMac()
|
|
|
- // original.setMacAddress(spoofedMac)
|
|
|
- // original.setBSSID(spoofedBSSID)
|
|
|
- // log(`WifiServiceImpl.getConnectionInfo(${callingPackage}, ${callingFeatureId}) called`)
|
|
|
- // log(` MAC: ${originalMac} -> ${spoofedMac}`)
|
|
|
- // log(` BSSID: ${originalBSSID} -> ${spoofedBSSID}`)
|
|
|
- // return original
|
|
|
- // }
|
|
|
+ WifiServiceImpl.getConnectionInfo.overload('java.lang.String', 'java.lang.String').implementation = function (
|
|
|
+ callingPackage,
|
|
|
+ callingFeatureId
|
|
|
+ ) {
|
|
|
+ const original = this.getConnectionInfo(callingPackage, callingFeatureId)
|
|
|
+ const originalMac = original.getMacAddress()
|
|
|
+ const originalBSSID = original.getBSSID()
|
|
|
+ const spoofedMac = readConfig().mac || randomMac()
|
|
|
+ const spoofedBSSID = readConfig().bssid || randomMac()
|
|
|
+ original.setMacAddress(spoofedMac)
|
|
|
+ original.setBSSID(spoofedBSSID)
|
|
|
+ log(`WifiServiceImpl.getConnectionInfo(${callingPackage}, ${callingFeatureId}) called`)
|
|
|
+ log(` MAC: ${originalMac} -> ${spoofedMac}`)
|
|
|
+ log(` BSSID: ${originalBSSID} -> ${spoofedBSSID}`)
|
|
|
+ return original
|
|
|
+ }
|
|
|
|
|
|
const btClassLoader = classLoaders.find((i) => i.toString().includes('service-bluetooth'))
|
|
|
Java.classFactory.loader = btClassLoader
|