Skip to content

Commit

Permalink
refactor: dependencyless & bun
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMartinDev committed May 31, 2024
1 parent d186ae3 commit 45f1de1
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 1,940 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

21 changes: 13 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: oven-sh/setup-bun@v1
with:
node-version: '12.x'
registry-url: 'https://npm.pkg.github.com'
bun-version: 1.1.10
- name: Install dependencies
run: npm ci
- name: Build binaries
run: npm run build
run: bun install
- name: Build Linux
run: bun build --minify ./src/index.js --compile --target=bun-linux-x64 --outfile ./build/token-extractor-linux
- name: Build Windows
run: bun build --minify ./src/index.js --compile --target=bun-windows-x64 --outfile ./build/token-extractor-windows.exe
- name: Build MacOS ARM
run: bun build --minify ./src/index.js --compile --target=bun-darwin-arm64 --outfile ./build/token-extractor-macos-arm64
- name: Build MacOS x64
run: bun build --minify ./src/index.js --compile --target=bun-darwin-x64 --outfile ./build/token-extractor-macos-x64
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./build/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,53 @@

A simple script to extract Xiaomi Home devices tokens from an unencrypted iOS backup.

> Only tested on MacOS Catalina
> Only tested on MacOS.
## Installation

### MacOS

**macOS x64**
```sh
curl -o- https://github.com/LeoMartinDev/Mi-Home-token-extractor/releases/latest/download/mi-home-token-extractor-linux | bash
```
```sh
wget -qO- https://github.com/LeoMartinDev/Mi-Home-token-extractor/releases/latest/download/mi-home-token-extractor-linux | bash
curl -o- https://github.com/LeoMartinDev/Mi-Home-token-extractor/releases/latest/download/mi-home-token-extractor-macos-x64 | bash
```

Alternatively, clone the repo, switch to Node v12, run `npm i` and launch the script `npm start` !

**macOS arm64**
```sh
curl -o- https://github.com/LeoMartinDev/Mi-Home-token-extractor/releases/latest/download/mi-home-token-extractor-macos-arm64 | bash
```
> ./mi-home-token-extractor --help

Usage: mi-home-token-extractor [options]
### Linux

Options:
-V, --version output the version number
-s, --ssid <ssid> filter devices by SSID
-n, --name <name> filter devices by name
-h, --help display help for command
```sh
curl -o- https://github.com/LeoMartinDev/Mi-Home-token-extractor/releases/latest/download/mi-home-token-extractor-linux | bash
```

You can simply run `./mi-home-token-extractor` without options to get a list of your Mi Home devices with corresponding decrypted `token`.
### Windows

```sh
curl -o- https://github.com/LeoMartinDev/Mi-Home-token-extractor/releases/latest/download/mi-home-token-extractor-windows | bash
```
> ./mi-home-token-extractor

Lampe de bureau - Livebox-Z300
[TOKEN] a40264428ecc981f8eecb381116c50b8
[IP] 192.168.1.12 - [MAC] 5C:5C:5C:5C:5C:5C
Alternatively, clone the repo, run `bun install` and launch the script `bun start` !

Lampe de chevet de Léo - Livebox-Z300
[TOKEN] a40264428ecc981f8eecb381116c50b8
[IP] 192.168.1.14 - [MAC] 5C:5C:5C:5C:5C:5C
```
## Usage

`--ssid`option allows you to filter devices based on which SSID they are connected to which can be helpful when you have several homes attached to your Mi Home application.
1. Connect your Xiaomi Home devices in the Xiaomi app.
2. Create an unencrypted iOS backup: https://support.apple.com/en-us/118426#computer
3. Run `token-extractor`.
4. Profit!

## How to get my Xiaomi Home devices tokens ?
```sh
> ./token-extractor-macos-arm64

1. Download __Xiaomi Home token extractor__
2. Create an unencrypted iOS backup https://support.apple.com/en-us/HT203977#computer
3. Run `./mi-home-token-extractor`
Found 1 backups
Using backup iPhone de Léo (2024-05-29T14:11:51.000Z)
Found 1 devices

> There is other methods to find your devices tokens, check https://github.com/Maxmudjon/com.xiaomi-miio/blob/master/docs/obtain_token.md
DEVICE My device
TOKEN unencrypted_token
MAC CC:CC:CC:CC:CC:CC
LOCAL IP 0.0.0.0
SSID MY_SSID
```
Binary file added bun.lockb
Binary file not shown.
Loading

0 comments on commit 45f1de1

Please sign in to comment.