Coder Social home page Coder Social logo

scooterhacking / ninebotcrypto Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 15.0 60 KB

An implementation of the NinebotCrypto protocol by majsi.

License: GNU Affero General Public License v3.0

C# 15.96% Kotlin 15.65% Swift 33.54% C++ 12.29% C 11.53% Rust 11.04%

ninebotcrypto's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ninebotcrypto's Issues

packets seem to encode/decode correctly but ES4 BLE v1.0.9(edit) fails to respond to second pairing packet

Bare in mind I have ported from the C# code to C (with mbedtls)

I eventually figured out that name is actually the device name (NBScooter0204 for me) and that there is no checksum (maybe the README needs updated to make this clearer)

So I set the name to 'NBScooter0204' (and zero pad to 16 bytes)
encode and send 3E215B00 to the dash
receive and decode 213E5B01 + bleKey + Serial Number

But when I encode and send 3E215C00 + 16x random bytes
The dash fails to respond.

Has anyone had success/traps/failures with this?

Obviously I figured I had mis-ported something, so have spent hours comparing my C version with the C#/Swift/Kotlin and it appears to be functionally the same.

IAP successfully connects, and I have compared it's packet log with mine, and it all decode successfully.

I'm happy to push the C port now/once its working. (just let me know how)

Crypto iterator bug results in communication problems/slowness

There is a bug in the initial C# implementation that causes the counter to be over-incremented after the first message.
After the 0x5B initial crypto message, the counter goes from 0 to 2. This wasn't disturbing the communication on earlier devices/firmware versions but on newer scooters like the G2, it causes you to encrypt and send every message twice to keep up and thus slows communication down.

This bug was jointly discovered by @ArchGryphon9362 and myself today while I was working on G2 support for the Utility app and while he was writing his improved Swift version as well.

It has been fixed in his version of the library (BetterNinebotCrypto.swift) and I also issued a fix for the Kotlin version. If you are using either of those two, then we'd recommend using the latest version. If you are using other versions, you might encounter this bug and its side effects. Please, take the time to send a pull request if you do fix it.

I will update this issue as other versions get updated.

Thanks and referall to lib for new BLE firmware

Hey guys, just wanted to leave props for sharing all of this information!

I have ported the lib to Python and integrated it into a command line utility for authorization with the legacy Nb and the new Mi EC protocol. It all works, tested on my own scooter.

Check it out and feel free to adapt SHCU for newer BLE firmware support: https://github.com/dnandha/miauth

DataBasic ByteArray

Hello everyone,
Does someone know from where the byte array data basic comes from?
I'm talking about this hex: 97CFB802844143DE56002B3B34780A5D

Regards,
Riccardo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.