-
-
Save SmokeNMirrors/4ac762c75177abe30ea9f4f7d9afbfdc to your computer and use it in GitHub Desktop.
Decode devices from a rooted device for tuya smart life app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you have a rooted phone and tuya's smart life app, the xml data can be found inside data/data/com.tuya.smartlife/shared_prefs | |
The file name is something akin to preferences_global_key<someid>.xml | |
TIP: Look for the file with the largest size. The actual data can be found in <map><string>. Something akin to a small script to parse it in node js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const xml2js = require('xml2js'); | |
const data = fs.readFileSync(path.join(__dirname, process.argv[2]), {encoding: 'UTF-8'}); | |
xml2js.parseString(data, (err, result) => { | |
const str = result.map.string[6]._; | |
console.log(str); | |
const s = JSON.parse(str); | |
const out = JSON.stringify(s.deviceRespBeen, null, 2); | |
console.log(out); | |
fs.writeFileSync('devices.json', out) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node decode.js preferences_global_key\<someid\>.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had to change the [6] to [0] on line 9 to get this to work. Not sure that's a result of Smart Life changes but using 3.6.1 to get the prefs xml.