duckwc / ECAMpy

Python tool for PrimmaDonna SOUL management
20 stars 2 forks source link

No keys.json #2

Open mod25 opened 8 months ago

mod25 commented 8 months ago

Hi @duckwc, thank you for your great work... I don't get that json file from google.it what am i doing wrong? Tested System MacOS and WIN11... Thank you for your help.

Traceback (most recent call last): File "/Users/mod25/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/mod25/GitHub/ECAMpy/webserver.py", line 360, in lankey = get_lankey(access_token) File "/Users/mod25/GitHub/ECAMpy/webserver.py", line 171, in get_lankey response = data.json() File "/Users/mod25/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

int0x19 commented 8 months ago

confirm status code 404 in response for requested with api_url = "https://ads-eu.aylanetworks.com/apiv1/devices/"+DSN+"/connection_config.json" in get_lankey function

duckwc commented 8 months ago

Yep, it seems that you have both the same issue. I guess that your app doesn't discuss through LAN with the coffee machine. I'd need to be able to reproduce this error to investigate it, but I have no clue in the way to do this...

int0x19 commented 8 months ago

yes, only via cloud the coffee machine Eletta Explore

duckwc commented 8 months ago

Mmmh, what would be the model in the json answer? My machine is a primadonna Soul, and the model is AY008ESP1. From what I'm reading here: https://docs.aylanetworks.com/docs/version-138 possibly, communication is different from one machine to another...

int0x19 commented 8 months ago
{
  "product_name": "AC000W0***01",
  "model": "AY008ESP1",
  "dsn": "AC000W0***01",
  "oem_model": "DL-striker-cb",
  "sw_version": "ADA 1.6 esp-idf-v3.3.1 2020-05-20 21:37:21 667ab48",
  "template_id": 27189,
  "mac": "24d7eb***",
  "unique_hardware_id": null,
  "lan_ip": "192.168.1.105",
  "connected_at": "2024-02-28T09:37:59Z",
  "key": 2485958,
  "lan_enabled": false,
  "connection_priority": [],
  "has_properties": true,
  "product_class": null,
  "connection_status": "Online",
  "lat": "41.*",
  "lng": "69.*",
  "locality": null,
  "device_type": "Wifi",
  "dealer": null
}

May be need switch lan_enabled to True, how do it?

mod25 commented 8 months ago

{ 'product_name': 'AC000W032245102', 'model': 'AY008ESP1', 'dsn': 'AC000W002', 'oem_model': 'DL-striker-cb', 'sw_version': 'ADA 1.6 esp-idf-v3.3.1 2020-05-20 21:37:21 667ab48', 'template_id': 27189, 'mac': '0cb815', 'unique_hardware_id': None, 'lan_ip': '192.168.178.55', 'connected_at': '2024-02-19T19:49:49Z', 'key': 2617653, 'lan_enabled': False, 'connection_priority': [], 'has_properties': True, 'product_class': None, 'connection_status': 'Online', 'lat': '51.', 'lng': '6.', 'locality': '***', 'device_type': 'Wifi', 'dealer': None }

My machine is also a Eletta Explore

shaarkys commented 8 months ago

Same here...

{'product_name': 'AC000W031401709',
'model': 'AY008ESP1',
'dsn': 'AC000W031401709',
'oem_model': 'DL-striker-cb',
'sw_version': 'ADA 1.6 esp-idf-v3.3.1 2020-05-20 21:37:21 667ab48',
'template_id': 27189,
'mac': '24d7ebb0cbe4',
'unique_hardware_id': None,
'lan_ip': '10.0.0.79',
'connected_at': '2024-03-02T19:46:49Z',
'key': 2393158,
'lan_enabled': False,
'connection_priority': [],
'has_properties': True,
'product_class': None,
'connection_status': 'Online',
'lat': '4x',
'lng': '1x', 
'locality': 'xxxxx', 
'device_type': 'Wifi',
 'dealer': None}
 lankey: {'Date': 'Sun, 03 Mar 2024 00:16:07 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Content-Security-Policy': "frame-ancestors 'none'", 'Error': 'Unavailable', 'Last-Modified': 'Wed, 14 Dec 2050 18:43:58 GMT', 'Status': '404 Not Found', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'DENY', 'X-Rack-Cache': 'miss', 'X-Request-Id': '3b318e20-d8f3-11ee-8f96-c54271b5a67d', 'X-Runtime': '0.03565', 'X-UA-Compatible': 'IE=Edge,chrome=1', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE,PATCH,OPTIONS', 'Access-Control-Allow-Headers': 'accept,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-csrf-token,Content-Disposition,X-Pingother', 'Access-Control-Max-Age': '1728000'}

Eletta Explore 450.65.G ...

shaarkys commented 7 months ago

@duckwc , any chances of some progress after such a very promising start ?

duckwc commented 7 months ago

@shaarkys , I have moved to other projects for the moment since it's working quite fine on my model (Primmadona soul) over Lan. There are still some aspects that I will investigate later about getting statistics from the machine. Those are apparently not sent through LAN. I saw that I'm also able to command the machine remotely using cloud, so I guess I could continue the investigation, but sniffing the cloud traffic may be a bit more complex than sniffing the LAN one. I may continue the investigation later, but don't hesitate to share if you are able to grab some message by sniffing your connections.

shaarkys commented 7 months ago

Thank you, I think it's mostly about missing keys.json, so for Eletta Explore 450.65.G it doesn't work. Any howto, which kind of details you would need ?

duckwc commented 7 months ago

keys.json won't make sense on a cloud connection, they are only used because the LAN traffic is sent over a non encrypted HTTP connection, and an AES encryption is used to mitigate that issue. In the case of pure cloud traffic, I suppose that the traffic will be encrypted during a standard SSL encryption, so the keys.json is not needed.

shaarkys commented 7 months ago

Well, local connectivity would be still best I guess. Anyway, not sure what we are supposed to do now ;-)

shaarkys commented 7 months ago

Or are you saying that it should be possible to control coffee machine now not locally but still via cloud ? I would need to re-check then, seems I misunderstood

shaarkys commented 7 months ago

I thought that keys.json is essential for making it work... this is however what I get :

webinter

pressing Turn On, Get status...nothing happens.

{'access_token': 'REMOVED', 'expires_in': 86399, 'refresh_token': 'REMOVED', 'role': 'EndUser', 'role_tags': []} {'product_name': 'AC000W031401709', 'model': 'AY008ESP1', 'dsn': 'AC000W031401709', 'oem_model': 'DL-striker-cb', 'sw_version': 'ADA 1.6 esp-idf-v3.3.1 2020-05-20 21:37:21 667ab48', 'template_id': 27189, 'mac': '25d8ebb0cbe4', 'unique_hardware_id': None, 'lan_ip': '10.0.0.79', 'connected_at': '2024-03-25T17:30:03Z', 'key': 2393158, 'lan_enabled': False, 'connection_priority': [], 'has_properties': True, 'product_class': None, 'connection_status': 'Online', 'lat': '49.3345', 'lng': '16.482', 'locality': '664 24', 'device_type': 'Wifi', 'dealer': None} Error: Response is not in JSON format. Status Code: 404 Response: connect to http://127.0.0.1:10280/index.html /status 127.0.0.1 - - [25/Mar/2024 21:18:16] "GET /status HTTP/1.1" 200 - /turn_on /get_properties <Response [404]> 127.0.0.1 - - [25/Mar/2024 21:18:22] "GET /get_properties?name=d302_monitor HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:22] "GET /status HTTP/1.1" 200 - <Response [404]> 127.0.0.1 - - [25/Mar/2024 21:18:25] "GET /turn_on HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:27] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:32] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:37] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:42] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:47] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:52] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:18:57] "GET /status HTTP/1.1" 200 - /index.html 127.0.0.1 - - [25/Mar/2024 21:19:01] "GET /index.html HTTP/1.1" 200 - /css/style.css 127.0.0.1 - - [25/Mar/2024 21:19:01] "GET /css/style.css HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:01] "GET /status HTTP/1.1" 200 - /favicon.ico 127.0.0.1 - - [25/Mar/2024 21:19:01] "GET /favicon.ico HTTP/1.1" 404 - /status 127.0.0.1 - - [25/Mar/2024 21:19:02] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:07] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:07] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:12] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:12] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:17] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:17] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:22] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:23] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:27] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:28] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:33] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:33] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:38] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:38] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:43] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:43] "GET /status HTTP/1.1" 200 - /get_properties <Response [404]> 127.0.0.1 - - [25/Mar/2024 21:19:45] "GET /get_properties?name=d302_monitor HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:48] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:48] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:53] "GET /status HTTP/1.1" 200 - /status 127.0.0.1 - - [25/Mar/2024 21:19:53] "GET /status HTTP/1.1" 200 -

shaarkys commented 7 months ago

Strange is that it says : 'connection_status': 'Online',

duckwc commented 7 months ago

Yes, it does, but what is your problem is probably the "'lan_enabled': False," which probably means that your coffee machine is not setup to be controlled over LAN, only through cloud.

70mmy commented 6 months ago

Got myself a Eletta Explore hopping I can get this working, but it looks like this model communicates only over cloud

After just some very basic sniffing of the network it looks like it communicates with a AWS EC2 instance ec2-3-122-72-123.eu-central-1.compute.amazonaws.com

@duckwc would you happen to notice a URL like that in any of the responses? I decompiled the android app and I can change strings in it and put it on a device, but of course that URL is not in the app, so I imagine the app receives that URL from one of the other endpoints

My plan is to overwrite the ec2 url with one of my own, and see the requests the app makes

LE: Nevermind that is the ads-eu.aylanetworks.com tcpdump was reporting it as the host of the underlying server used by ayla