Skip to content

Commit 6d957de

Browse files
committed
init
0 parents  commit 6d957de

8 files changed

+937
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
node_modules

Readme.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Xiaomi Cloud Tokens Extractor
2+
3+
This tool/script retrieves tokens for all devices connected to Xiaomi cloud and encryption keys for BLE devices.
4+
5+
You will need to provide Xiaomi Home credentials:
6+
- username (email or Xiaomi Cloud account ID)
7+
- password
8+
- Xiaomi's server region (`cn` - China, `de` - Germany etc.). Leave empty to check all available
9+
10+
In return all of your devices connected to account will be listed, together with their name and IP address.

extract-cli.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const inquirer = require("inquirer");
2+
let { AuthMiIO, ApiMiIO } = require('./index');
3+
4+
let authMiIO = new AuthMiIO;
5+
let apiMiIO = new ApiMiIO;
6+
7+
let inputPrompt = [
8+
{
9+
name: 'country',
10+
message: 'Your country: ',
11+
type: 'list',
12+
default: "cn",
13+
choices: [
14+
{ name: "China", value: "cn"},
15+
{ name: "Russia", value: "ru"},
16+
{ name: "USA", value: "us"},
17+
{ name: "Taiwan", value: "tw"},
18+
{ name: "Singapore", value: "sg"},
19+
{ name: "Germany", value: "de"},
20+
{ name: "India", value: "in"},
21+
{ name: "India", value: "i2"},
22+
]
23+
},
24+
{
25+
name: 'login',
26+
message: 'Your login (userId/email/phone):',
27+
type: 'string',
28+
},
29+
{
30+
name: 'password',
31+
message: 'Your password: ',
32+
type: 'password',
33+
},
34+
];
35+
36+
(async () => {
37+
let { login, password, country } = await inquirer.prompt(inputPrompt);
38+
console.log('Auth...');
39+
let { userId, token, ssecurity } = await authMiIO.login(login, password);
40+
41+
console.log('Get devises list...');
42+
let devices = await apiMiIO.getDeviceList(userId, ssecurity, token, country);
43+
devices = devices.map(device => {
44+
let { did, token, name, localip, model, mac } = device;
45+
return { did, token, name, localip, model, mac };
46+
});
47+
48+
console.log(devices);
49+
})();

index.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const AuthMiIO = require('./src/Auth');
2+
const ApiMiIO = require('./src/Api');
3+
4+
module.exports = { AuthMiIO, ApiMiIO };

0 commit comments

Comments
 (0)