lukezzz / homeassistant-yunmi-kettle

16 stars 6 forks source link

求大神指教云米油烟机 #1

Open jiafengwang opened 5 years ago

jiafengwang commented 5 years ago

我用ettercap+wireshark抓到了包,但不知道怎么用,解码无从下手了,求大神指教

lukezzz commented 5 years ago

我用ettercap+wireshark抓到了包,但不知道怎么用,解码无从下手了,求大神指教 把抓包保存为json格式,用miio protocol 命令对抓包进行解码,应该就可以获得miio相关的命令,有了命令你可以试试miio protocol call,如果有效果可以讲call的内容和返回结果发给我,我可以尝试搞一个油烟机的

goto100 commented 5 years ago

能否详解下:把抓包保存为json格式 这一步具体怎么操作?已在wireshark中看到udp记录。

goto100 commented 5 years ago

我用 tshark -Y "udp.dstport == 54321 or udp.srcport == 54321" -T json > a.json 拿到数据了,但是 miio protocol json-dump 出来的全是 N/A

goto100 commented 5 years ago

miio protocol json-dump a.json --token xxx 这样

<- 192.168.0.124 data= N/A <- 192.168.0.124 data= N/A <- 192.168.0.124 data= N/A <- 192.168.0.124 data= N/A <- 192.168.0.124 data= N/A

lukezzz commented 5 years ago

Hi,

抓包下来的json,用下面的命令解析数据,后面的token一定要对才行,否则可能看到的就是na

miio protocol json-dump yunmi_kettle03 --token 17522738c1a979cefc8fxxxxxxxxx

Regards, Luke Zhang

On May 5, 2019, at 10:52 PM, goto100 notifications@github.com wrote:

能否详解下:把抓包保存为json格式 这一步具体怎么操作?已在wireshark中看到udp记录。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lukezzz/homeassistant-yunmi-kettle/issues/1#issuecomment-489433656, or mute the thread https://github.com/notifications/unsubscribe-auth/ABY6IUX7LCSSP2MYSTCVDGLPT3YEHANCNFSM4GY3LNJQ.

goto100 commented 5 years ago

token应该是对的,用 miio tokens update 192.168.0.124 xxx 可以正常配置进去,这个命令我试了一下如果 token 不对是配置不进去的。

而且我也有个云米的水吧,用你的插件已经正常工作了,但我尝试抓包结果也是一样的,全是 N/A。

goto100 commented 5 years ago

说一下我拿到 json 的流程:

ettercap:

Sniff->Unified Sniffing,选 en0(Wifi) Hosts->Scan for Hosts Hosts->Hosts list,选中云米油烟机的IP(192.168.0.124),Add to target 1,选中 192.168.0.1,Add to target 2 Mitm->ARP poisining,选中 Sniff remote connections. Start->Start sniffing

Wireshark:

开启promiscuous mode; filter:udp.dstport == 54321 or udp.srcport == 54321 可以看到很多 packet 停止抓包 File->Export Packet Dissections->As JSON,保存为 a.json

miio:

miio protocol json-dump a.json --token xxx

结果看到的全是 N/A

这个过程中有一点比较奇怪,我看到的所有 udp 连接全是单向的,只有发出的 packet,没有收到的 packet,不知道你那里正常不。

goto100 commented 5 years ago

关闭路了路由器的防ARP欺骗功能,可以看到双向 packet 了,但 dump 出来还是 N/A……开启debug看到 Invalid packet 的日志