|
|
@@ -25,11 +25,13 @@ function buff2json(buf) {
|
|
|
class Interaction {
|
|
|
failure(err) {
|
|
|
console.error(err.message)
|
|
|
+ Java.use('android.util.Log').d('frida-system_server', err.message)
|
|
|
}
|
|
|
|
|
|
accepted(connection) {
|
|
|
console.warn('accepted')
|
|
|
connection.input.read(2000).then((data) => {
|
|
|
+ Java.use('android.util.Log').d('frida-system_server', data + '')
|
|
|
try {
|
|
|
const json = buff2json(data)
|
|
|
console.log('received', json)
|
|
|
@@ -174,15 +176,6 @@ setImmediate(() => {
|
|
|
|
|
|
// saveConfig({ a: 1 })
|
|
|
let config = readConfig()
|
|
|
- setTimeout(() => {
|
|
|
- new Interaction().start(23947, (msg) => {
|
|
|
- log(`received message: ${JSON.stringify(msg)}`)
|
|
|
- if (msg.action === 'saveConfig') {
|
|
|
- config = msg.data
|
|
|
- saveConfig(config)
|
|
|
- }
|
|
|
- })
|
|
|
- }, 10000)
|
|
|
|
|
|
const DeviceIdentifiersPolicy = Java.use(
|
|
|
'com.android.server.os.DeviceIdentifiersPolicyService$DeviceIdentifiersPolicy'
|
|
|
@@ -190,7 +183,7 @@ setImmediate(() => {
|
|
|
|
|
|
DeviceIdentifiersPolicy.getSerial.overload().implementation = function () {
|
|
|
const original = this.getSerial()
|
|
|
- const spoof = config.serialNo || original
|
|
|
+ const spoof = readConfig().serialNo || original
|
|
|
log(`DeviceIdentifiersPolicy.getSerial() called, returning: ${spoof}, original: ${original}`)
|
|
|
return spoof
|
|
|
}
|
|
|
@@ -198,7 +191,7 @@ setImmediate(() => {
|
|
|
DeviceIdentifiersPolicy.getSerialForPackage.overload('java.lang.String', 'java.lang.String').implementation =
|
|
|
function (callingPackage, callingFeatureId) {
|
|
|
const original = this.getSerialForPackage(callingPackage, callingFeatureId)
|
|
|
- const spoof = config.serialNo || original
|
|
|
+ const spoof = readConfig().serialNo || original
|
|
|
log(`DeviceIdentifiersPolicy.getSerialForPackage(${callingPackage}, ${callingFeatureId}) called`)
|
|
|
log(` ${original} -> ${spoof}`)
|
|
|
return spoof
|
|
|
@@ -210,7 +203,7 @@ setImmediate(() => {
|
|
|
const WifiServiceImpl = Java.use('com.android.server.wifi.WifiServiceImpl')
|
|
|
WifiServiceImpl.getFactoryMacAddresses.overload().implementation = function () {
|
|
|
const original = this.getFactoryMacAddresses()
|
|
|
- const spoof = [config.mac || randomMac()]
|
|
|
+ const spoof = [readConfig().mac || randomMac()]
|
|
|
log(`WifiServiceImpl.getFactoryMacAddresses() called`)
|
|
|
log(` ${original} -> ${spoof}`)
|
|
|
return spoof
|
|
|
@@ -222,8 +215,8 @@ setImmediate(() => {
|
|
|
const original = this.getConnectionInfo(callingPackage, callingFeatureId)
|
|
|
const originalMac = original.getMacAddress()
|
|
|
const originalBSSID = original.getBSSID()
|
|
|
- const spoofedMac = config.mac || randomMac()
|
|
|
- const spoofedBSSID = config.bssid || randomMac()
|
|
|
+ const spoofedMac = readConfig().mac || randomMac()
|
|
|
+ const spoofedBSSID = readConfig().bssid || randomMac()
|
|
|
original.setMacAddress(spoofedMac)
|
|
|
original.setBSSID(spoofedBSSID)
|
|
|
log(`WifiServiceImpl.getConnectionInfo(${callingPackage}, ${callingFeatureId}) called`)
|
|
|
@@ -231,5 +224,15 @@ setImmediate(() => {
|
|
|
log(` BSSID: ${originalBSSID} -> ${spoofedBSSID}`)
|
|
|
return original
|
|
|
}
|
|
|
+
|
|
|
+ // setTimeout(() => {
|
|
|
+ // new Interaction().start(23947, (msg) => {
|
|
|
+ // log(`received message: ${JSON.stringify(msg)}`)
|
|
|
+ // if (msg.action === 'saveConfig') {
|
|
|
+ // config = msg.data
|
|
|
+ // saveConfig(config)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }, 30000)
|
|
|
})
|
|
|
})
|