-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6d957de
Showing
8 changed files
with
937 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
node_modules |
This file contains 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
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. |
This file contains 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
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); | ||
})(); |
This file contains 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
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 }; |
Oops, something went wrong.