Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpts committed Apr 30, 2021
0 parents commit 6d957de
Show file tree
Hide file tree
Showing 8 changed files with 937 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
node_modules
10 changes: 10 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Xiaomi Cloud Tokens Extractor

This tool/script retrieves tokens for all devices connected to Xiaomi cloud and encryption keys for BLE devices.

You will need to provide Xiaomi Home credentials:
- username (email or Xiaomi Cloud account ID)
- password
- Xiaomi's server region (`cn` - China, `de` - Germany etc.). Leave empty to check all available

In return all of your devices connected to account will be listed, together with their name and IP address.
49 changes: 49 additions & 0 deletions extract-cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const inquirer = require("inquirer");
let { AuthMiIO, ApiMiIO } = require('./index');

let authMiIO = new AuthMiIO;
let apiMiIO = new ApiMiIO;

let inputPrompt = [
{
name: 'country',
message: 'Your country: ',
type: 'list',
default: "cn",
choices: [
{ name: "China", value: "cn"},
{ name: "Russia", value: "ru"},
{ name: "USA", value: "us"},
{ name: "Taiwan", value: "tw"},
{ name: "Singapore", value: "sg"},
{ name: "Germany", value: "de"},
{ name: "India", value: "in"},
{ name: "India", value: "i2"},
]
},
{
name: 'login',
message: 'Your login (userId/email/phone):',
type: 'string',
},
{
name: 'password',
message: 'Your password: ',
type: 'password',
},
];

(async () => {
let { login, password, country } = await inquirer.prompt(inputPrompt);
console.log('Auth...');
let { userId, token, ssecurity } = await authMiIO.login(login, password);

console.log('Get devises list...');
let devices = await apiMiIO.getDeviceList(userId, ssecurity, token, country);
devices = devices.map(device => {
let { did, token, name, localip, model, mac } = device;
return { did, token, name, localip, model, mac };
});

console.log(devices);
})();
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const AuthMiIO = require('./src/Auth');
const ApiMiIO = require('./src/Api');

module.exports = { AuthMiIO, ApiMiIO };
Loading

0 comments on commit 6d957de

Please sign in to comment.