-
Notifications
You must be signed in to change notification settings - Fork 43
Finish API documentation #3
Comments
I've tried a MITM proxy for these actions, too, with no luck. I did see something interesting while setting the mode: while on the same network as the Eufy hub, I couldn't see any obvious API calls, but the mode was successfully set; while on a cellular network (and, again, with the proxy in the middle), the mode changes never succeeded. No clue what that means. Any Android users out there who'd be willing to decompile the app and see what is going on? |
The APK is available online on APK Mirror. https://www.apkmirror.com/apk/anker/eufy-security/ |
I was able to decompile. On the hunt. EDIT: Well, after several hours, I'm reminded how difficult Java is. 😆I don't see any particular API that gets called when the mode ( Also worth noting that the web app doesn't appear to support modes currently. |
I had a quick look at the APK and it seems to have some MQTT classes. |
That would be fascinating if true. Would also likely be true for some of the settings/configuration then too. Still would think the calls would show up in HTTP(S) traffic. |
Fascinating! Most proxies aren't configured to handle raw TCP over TLS – they only look at HTTP traffic. Perhaps using a SOCKS proxy would be better, since that would redirect all traffic. Unfortunately, the Charles iOS app doesn't handle this yet. |
If you know of an android option I'm happy to give it a go. |
Will give it a go tonight if I have time. |
Still digging but looks like @joepadmiraal is on to something. Seeing traffic going to "security-mqtt.eufylife.com:8789". Trying to get details. Drony doesn't give out more details and I can't find a better working option that I can set up. Hit my limit for the evening, hope someone else can take the url at do some more sniffing. |
Hi |
I had a quick look at the decompiled APK. I think that the mode changes are handled by the The Also, in regards to MQTT it looks like Anker has hardcoded the passwords to their broker 🤦♂. Looks like there are thousands of topics, one per mobile device. Messages being sent over the wire appear to be connect/disconnect notifications with IP addresses embedded. |
I've looked into decompiled Android app and my understanding is that the doorbell communicates with the cloud via MQTT while the phone gets notifications via FCM with the directions on how to connect to cloud's MQTT broker. Static analysis wouldn't help here. I will try to MITM the app some time later. |
While I only have the Eufy Floodlight and not the doorbell to test with, I've been able to identify enough parts of the UDP-based P2P protocol to be able to successfully toggle the light outside of the app. The approach seems to use the same control plane that I think the app uses to talk to the Eufy HomeBase, but I don't have one to confirm. So far, the floodlight seems entirely independent of the MQTT pipeline that seems to exist for the doorbell only. |
@keshavdv This is great, do you have any snippets of code you can share, a gist would be enough. |
I’ll put something up in a bit, but it’s mostly based on a custom version of https://github.com/fbertone/lib32100 for the initial handshake and custom data packets. Interestingly, I tried the HTTP API you exposed in the other PR to set device params and while the property does seem to exist for the manual light state (1400) and is reported, flipping it only caused the app UI state to update but didn’t actually turn the light on or off. |
Have you checked what (other things) changes in the params when you flip the switch in the app? |
I was able to capture the contents of the app chatter with The app also talks with |
Alright! I have everything I need to start working on p2p part. Just added an endpoint here used to obtain private keys for p2p communication. |
@keshavdv What were you able to achieve so far? It seems that p2p communication after the handshake is different from the protocol implemented be the library. |
After the initial handshake, the protocol is indeed different, but replaying packet payloads that were generated from the app seems to work pretty reliably to do certain things (change light/detection settings). I've made progress on reversing the actual protocol itself and I think with the packet types I've decoded so far, we can change most of the boolean/string based parameters that are available in the app. So far, and a bit worryingly, it seems like most control actions are not encrypted/authenticated apart from the actual video stream itself (I think this is where the key returned by the endpoint you linked comes into play). |
Oh, you're right! I thought the settings are set via the API, but there's a P2P communication. Tried to disable the motion detection and that's what I got:
Do you also see those Not encrypting the data above is indeed concerning. |
I saw the option to open telnet in the app disassembly. It is probably meant for the base station though. Anyway, would be cool to get telnet access. |
Sweet, thanks for sharing! Since I only have one device, I couldn't tell what was user/device specific versus a constant, but it looks like the preamble (XYZH) is the same. Nice find on telnet! I'll see if I can enable it on my device since I think the doorbell and floodlights also act as independent "hubs/stations". |
The telnet command is 1247. I tried it via API but that didn't work. I think the API's params endpoint is just for the app and the actual command is sent via p2p. That explains why you weren't available to switch the floodlight. I'll implement the p2p option setting in the next few days. |
Any update on when floodlight cam Homebridge integration might be possible? Even if I could only turn the security lights on and off via HomeKit, that would be fantastic! 👍 |
Hi everyone! Thanks for the amazing project and the things you all have already discovered. I've implemented a small client in node/typescript to be able to look further. If anyone is interested in helping to find out more about the protocol / structure and so on, feel free to contact me! https://github.com/JanLoebel/eufy-node-client Has anyone tried to access firebase to receive notifications? MQTT seems not to be supported anymore. |
I've created a frida script to disable ssl pinning, intercept and log a some of the traffic (HTTPS / P2P) and a wireshark dissector to get more information already in wireshark. I've also tried to connect to FCM/GCM to receive push notifications but without any luck. I've tried to create a new "client" and register that with the register-push-token api-endpoint and open another session directly with the already registered push token from the running android app. Does anyone know how the encryption for the P2P packages work that will send or received from the cloud services? The packages are completely different after the "standard" discovery method.. |
@JanLoebel Mind sharing what you've got as a gist? As for P2P exchange, there's another PR that handles that. |
@nonsleepr Thanks, I've posted already before all what I have (wirshark, frida, node-client, ...), in my repository: https://github.com/JanLoebel/eufy-node-client The P2P exchange locally is handled by the PR I know, but for the Cloud P2P Part is only the discovery working. Sadly I can't easily post the requests because of the authentication/secrets etc.. I will check if I can easily hide/remove that from the logs and then upload also the communication. Update: I got the push notifications working, checkout the repo. |
Hi @keshavdv To run an RTSP stream from the eufy doorbell, the link that you have used is that the standard link? or would I have to find a different port in my case? thanks. |
I have the same problem, did you solve this? |
As I would love to have more features ending up in my HomeAssistant I digged trough other projects and found this one (which seems not to be mentioned here before): https://github.com/bropat/ioBroker.eufy-security Aside from battery status, which is cool, it seems like it is able to change at least the mode of the base station, which I would love! |
I also ran into the login 10000 error code specifically in hubitat. Using curl it worked fine. I got it to work in hubitat by setting |
Was hoping to download videos from the base station, and wondered if anyone has advice on where to go? Did some decompiling before finding this thread, and can see it uses the P2P connection to connect to base station, and that is where I should be able to download from the SDCard. Wondered if anyone has managed to do it yet? I tried calling get_history_records_all on api, and that returns empty (assumedly this is from cloud storage). Is there an equivalent on P2P? @keshavdv: have you made any progress since the PR? Would be happy to contribute / help out if I can |
@89jd I know that @bropat was working on it, but I don't know if he has finished that feature. Checkout https://github.com/bropat/ioBroker.eufy-security |
Cheers for reply. Doesn't look like it does, but looks close. Will dig deeper in to that code, thanks :) |
This feature is already implemented in the client library eufy-security-client (see here). |
@bropat Amazing. I have just been following the thread on the home assistant forum (that is what I am planning on integrating it into). So great work :). I did stumble upon the client library. Can you run the client directly as a micro-service? Just so I can interface directly? |
Unfortunately not, but there is here this project by @matijse, which provides an interface as a microservice via MQTT. PS: @matijse, if you need help, let me know. |
@bropat I deprecated my project and referred yours :) Great work! |
@JanLoebel ok, thanks :) if you want to contribute you are welcome ;) (or anybody else) |
@bropat I am happy putting this as a question on your page, but just wanted to check, Is there a way to list all events on sdcard, and bulk download (like the MacOS app does)? Thanks |
@89jd Yes, but only if you use the client library and program it yourself. ;) |
That's fine! Any pointers to where the command to list the files is? |
Good question, I checked now and saw that I haven't implemented that part (http api call) yet :P |
Nice one, no huge rush, happy to help with the dev, if you have the api it should be hitting! Out of interest, to get the file list, do you have to go via the eufy servers? Rather than through p2p directly? |
Yes, unfortunately it is. |
I have released the new version (0.7.2) which now includes the necessary HTTP Api calls. Basically, here's what you need to do now:
|
Brilliant. Much appreciated! That was a quick turn around :) |
We've got the basics regarding camera stream/images. Most important to me is the ability to control certain aspects of the cameras, like the schedule (ie disable motion sensor), and maybe even turn the chime on/off.
I've tried doing a MITM to try to uncover more but can't get it to work. Other ideas welcome.
The text was updated successfully, but these errors were encountered: