Skip to content

A nice library and CLI tool to handle Ninebot firmware encryption/decryption

License

Notifications You must be signed in to change notification settings

scooterhacking/NinebotTEA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NinebotTEA


Project Overview

NinebotTEA is an open-source command-line tool and library designed for the encryption and decryption needs of Ninebot manufactured scooter firmware. It is based on the Tiny Encryption Algorithm (TEA), tailored specifically to meet the requirements of Ninebot scooter firmware.

Features

  • Command-line interface for easy encryption and decryption of firmware data.
  • Library capabilities for integration into scooter firmware development projects.
  • Supports Ninebot scooters and Xiaomi scooters manufactured by Ninebot.
  • Customizable encryption keys.
  • Optimized for handling ZIP firmware archives.

Installation

pip install git+https://github.com/scooterhacking/NinebotTEA.git

Usage

CLI Usage:

  • Encrypt Firmware Data:

    ninebottea encrypt <input_path> <output_path> --key <hex_key>
  • Decrypt Firmware Data:

    ninebottea decrypt <input_path> <output_path> --key <hex_key>

Library Usage:

For firmware development, include NinebotTEA in your project to aid in the creation of ready to flash firmware packages:

from ninebottea import NinebotTEA

# Initialize the TEA algorithm with an optional key
tea = NinebotTEA(key=your_optional_bytes_key)

# To encrypt data
encrypted_data = tea.encrypt(data_to_encrypt)

# To decrypt data
decrypted_data = tea.decrypt(encrypted_data)

An example code of how complete firmware packages can be created with the aid of this library can be found here.

Examples

  • Encrypting Firmware Data via CLI:

    python NinebotTEA.py encrypt firmware_original.bin firmware_encrypted.bin --key 1a2b3c4d5e6f7890a1b2c3d4e5f60708
  • Decrypting Firmware Data via CLI:

    python NinebotTEA.py decrypt firmware_encrypted.bin firmware_decrypted.bin --key 1a2b3c4d5e6f7890a1b2c3d4e5f60708
  • Using in a Firmware Project:

    # Assuming tea is an instance of NinebotTEA
    encrypted_zip = tea.encrypt(zip_content)

Contributing

We encourage contributions from those knowledgeable in encryption, scooter firmware, and scooter hacking in general. To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a pull request.

License

Distributed under the MIT License. See LICENSE for more information.

Getting Help

For any issues or questions, especially related to the use of NinebotTEA with Ninebot and Xiaomi scooter firmware or ZIP firmware archives, please file an issue on the project's GitHub issue tracker, or reach out to us on the ScooterHacking Assembly.


About

A nice library and CLI tool to handle Ninebot firmware encryption/decryption

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages