Skip to content

Instantly share code, notes, and snippets.

View kabbi's full-sized avatar

Dmitry Kabak kabbi

View GitHub Profile
Answer the following questions as best you can. You have access to the following tools:
calculator: Useful for getting the result of a math expression. The input to this tool should be a valid mathmatical expression that could be executed by a simple calculator.
Use the following format:
Question: the input question you must answer
Thought: you should always think about what to do
Action: the action to take, should be one of [calculator]
Action Input: the input to the action
@kabbi
kabbi / file.c
Created November 24, 2022 15:44
undefined4 WhatXX(byte *data,int v)
{
uint uVar1;
int iVar2;
uVar1 = 0x80;
for (iVar2 = 0; iVar2 < v % 8; iVar2 = iVar2 + 1) {
uVar1 = uVar1 >> 1;
#include <stdbool.h>
#include <stdint.h>
#include "api.h"
#include "mesh.h"
#include "libc.h"
#define KABBI_COMPANY_ID 0x9832
#define KABBI_STRIP_MODEL_ID 0x0001

V3 part list

@kabbi
kabbi / connect.js
Created August 16, 2020 01:32
Yeelight mesh bulb ble connection / auth PoC
const noble = require('@abandonware/noble');
const EC = require('elliptic').ec;
const hkdf = require('futoin-hkdf');
const { crc32 } = require('crc');
const ccm = require('aes-ccm');
const ec = EC('p256');
noble.on('stateChange', async (state) => {
if (state === 'poweredOn') {
@kabbi
kabbi / log.md
Last active August 15, 2020 23:27
Yeelight xiaomi mesh light bulb auth sequence dump

Service UUID 0000fe95-0000-1000-8000-00805f9b34fb

Model MJDP09UL, yeelink.light.mbulb3

Connection sequence:

  • read version
  • mtu to 247
  • write to [0010] a4
  • notified [0016] 0000040006f2
write: 18,1E
read: 18,00,00,00,00
write: 18,1C
read: 18,00,00
write: 18,00
read: 18,11
write: 18,7E,B6
write: 18,7C
read: 18,03
write: 18,7C,02
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family Fira Code
bold_font auto
@kabbi
kabbi / uwatch2-protocol.md
Last active March 13, 2020 12:11
Umidigy uwatch2 ble protocol reverse engineering notes

Packet format

0xfe - start byte
0xea - some kind of protocol version
0x10 - some kind of protocol version
1 byte of packet length, payload length + 4
variable length payload
@kabbi
kabbi / ota.ino
Created October 25, 2018 18:29
Base ArduinoOTA + WifiManager for esp8266
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
#include <ArduinoOTA.h>
#include <WebSocketsClient.h>
#include <DNSServer.h>
void setup() {
Serial.begin(115200);