Cookies op Tweakers

Tweakers is onderdeel van DPG Media en maakt gebruik van cookies, JavaScript en vergelijkbare technologie om je onder andere een optimale gebruikerservaring te bieden. Ook kan Tweakers hierdoor het gedrag van bezoekers vastleggen en analyseren. Door gebruik te maken van deze website, of door op 'Cookies accepteren' te klikken, geef je toestemming voor het gebruik van cookies. Wil je meer informatie over cookies en hoe ze worden gebruikt? Bekijk dan ons cookiebeleid.

Meer informatie

Acties:
  • 0Henk 'm!

  • Amersfoort
  • Registratie: april 2009
  • Laatst online: 15:43
bjp schreef op dinsdag 25 mei 2021 @ 23:05:
extra referenties hier:
have fun: https://github.com/bp-ouhaha/ICS2000-Python

code:
code:
1
2
3
4
5
6
7
while(True):
  current = hub.get_device_check(p1_module)
  if len(current) > 5:
    print("Consumption ", int(current[4])," W - Production ", int(current[5]), " W")
  else:
    print("reply too short")
  time.sleep(10)
Interessant!
Doordat ik geen developer ben, maar wel graag de P1 module met de ICS2000 wil uitlezen, probeer ik de api via een URL uit te lezen en met json te ontrafelen.
De URL lukt al met https://trustsmartcloud2....assword_hash=jewachtwoord.
Wat kan ik met het json resultaat doen met versleutelde data? Ik ken/heb Python niet, maar ken PowerApps wel.

Acties:
  • 0Henk 'm!

  • Amersfoort
  • Registratie: april 2009
  • Laatst online: 15:43
[{"home_id":"11111","id":"17087827","version_status":"0","version_data":"29","status":null,"data":"0\/Yrf3IjgfSi4k7Qlg1tI8Tve5ULiYrjpnAkCTqWYLi4YMToB9eEJWqAf9bM0x3QnGCWDlgpDC44mY1QiGYYxW9Er8XMJTmHssOElvxHOBVlNHvl11ytFujsWt5Hmgt8cgdAAWDAphV8JkZWTneO9bCcc9Jd2zfuGx6mviTAx50nWLmpjCnqi\/fhjCILxCMAOjUbjLMeSOiHe66D5ePiav5YI4\/+qTI7wpm6eydmWt8PG9VzY0UJ\/+dCsnT\/uet7QH9GaVkoS6T4QoqAnnOC5KMUA86jSz6VV1yokvtnm+0=","time_added":"2021-04-30 08:06:47"},{"home_id":"11111","id":"19672034","version_status":"28827","version_data":"13","status":"GXFIEiWEIeXhgXROpDk5IsdkvsyWq011+w2u8rIMRktoIjdjz1tlNec1GDiwwKVmCNF2t2iceiKe0S0g8DVPkw==","data":"0u0YHJ8O3XSaq\/vYP8KlxGiHm8oZc2aK\/FyhMO2xyzWYryHlbMfS0F+K7cNqvW2O0mu2nAgRxb1JJpQzuCkMJ02lZZFzvx8982985\/V6B8Fo59Drkj11P7T3jjZNuHqKZRFStMyWONsnGwrCvKApyh1QNQ8LeRRYbQdjgGKa5dfabjpkUvnlbTUqpw5AIacHWp9lEjL4uM1nyKaW22qv7gQwqhUUWNCTWNaHujqRrrVOoiToS+w1m8URxC3atvHt2adtYxhe\/YoRUE7ZedCz53TAHg\/qkBMxkZpBZu10YUY=","time_added":"2020-06-16 17:26:03"},{"home_id":"11111","id":"21744776","version_status":"28828","version_data":"16","status":"qmZ+upSBsuwACwSGny4HSU3aDArbs1tNAOCsFSegi3M\/\/IFyv2av5Uva14GDh9p90+7VE56kqAS3Rj6RSCqZrQ==","data":"bhByWoEwFGZObuiA7mFxywADA8JTN1Lbwku\/CV5uAQD7BCfeD0kxspgJaaTFZaRawAxKCnsAncdvsId9+FB+uQDdyMolF0ldIBgQaPSvm8R6dmnDjcdyKbQyjMywipwwcrNm7teCXk41rn+0ltFxw9pTvohOB8uTKkFyl+exThBv9FHvKghyC4aOAEQhaYur+NhQY8XXCRhe4Ox2Yzc5lSVpSCjU+QTnpClInAPK5yY7oUaIqtxPLt5\/SQs8Tllm+kISsLWix35Cz1x8Iw7NPCWb35veJ\/iWQV75r62z3wk=","time_added":"2020-06-16 17:26:51"},{"home_id":"11111","id":"30990135","version_status":"0","version_data":"29","status":null,"data":"6xw9x2wNBkJWIY6ZWhESbVTFYIrTsPGwazncaFdHf3lz+pzz0EX3Z0\/s1byxa9Ii3FWYr\/FarWQf8sbIeBmLn9lFqhc3Gkdin9b\/WROivQ96PfbiXshY31S+koRPx3wHcsrg4CAoAosgrONnnriizM4VP1xZasaB1TQfYWVQP\/HbVJLS5EzXcc4TDkpWl++ti6tKP7QEdEijYjO\/dJ+LV6f95+4F4F3ajUpMhr53iG4Nrh8EsTY0JwU632kxYTLrQ2Fvc9YqGLEpgrbBegrbO0AIhxhE\/bCqKQ5VPOrocR5O+FRzdySm+uzDfkY9qwBE","time_added":"2020-07-04 21:17:05"},{"home_id":"11111","id":"100663297","version_status":"34260","version_data":"0","status":"nVC0gzGdentCkPCicnSEPugizLQmgqTbQXVq5sldEzAuzqng9GrQIPg+T1O9T3KXGBH7UdKmq+GN9fDrj2yiu9HxEnbrVAMs7GIOysuLA5CQWpFlHtXhR9aOR5DqorfbyCIHM1eZcVkGliYFNYfAuIA7t3AIqlH8OkRrjKnMWRA=","data":"KboJHiggRc0oU9LDi2u5MHY5Bu6lMuy0aQexOCdn1\/7Sq\/bYBlr9iI3FERXY7Ive0vFkIQ7axv0OdT0Crze7K10D3P1CkyluwXmHCemTx94=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663299","version_status":"34279","version_data":"0","status":"eOsdAy9fvJqEocTfdQzfvRUimw8PGNAAvXK13rCbHfQJIW5atkJ0o+yi4GvEmiR4vtpT\/uZmiG2nZdxoElRdb9s1PiT1kr6ReyMrMwW0xw+GICSkRcfImwQAVBb9xyvn","data":"3iZwrvLyxWeIL9nvMrPw2\/EoD4uJDlDkLy2697uipT8qk7WnrIa95GCmawKtKWnyCQd7DJhWmHW4KsVPlrXXY\/iHa2HormSG0i6rA1YdKyk=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663300","version_status":"0","version_data":"0","status":null,"data":"HkwXQSNbOAUzGL5k7muRKrsFbGSZRGjVaDNtsJ4N8T9Sgp6Is5lEul00iDqqjfKtoqKyEdJ53McTI8JV8Up49WNbU8jO\/pTjRsoMj9O+jd4=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663301","version_status":"0","version_data":"0","status":null,"data":"EdVd5fU2dUdDgYDa+FEBCWq3fq7HUgw6fRIhEVqcZllVZ7RCh3RzquQ9s7t5QoPOkHTCdbBmeAhaNKGh1DIywpQCeKk7kOvYN6MUlGaRL4IyDCQwO3LT843FuFuqPUbM","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663302","version_status":"34279","version_data":"0","status":"v255ugn6duQiJ6UYbxO69uyH10Bbvj0E1uSdFj3fjVZ8Lk8AWkt9xXd6rdE2nCgJci+fQUhf5DlmDBh3SZHjgLhBro6xOIPm57KqzYssVfo1hqKCb+8kV4Hz+w5ArueZZ1kWQllKiSJFHP3heekcXg==","data":"BbJ3+pMq41IHhxkBVAFB7nNRz1AsEGGTghGGseVAXKZ1AsCJQnoLxnMOSlubcz+YKhiCj4YIfOlsdqXgn7C4wdjzK8aOlRHzDHBFwfejNTk=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"37921771","version_data":"30","version_status":"3319","data":"652u+8OR\/eWpEi7CvP9X396VZ12vie2lp8l03\/Gmf1poquv60rove0InYYKF\/1MzY37nrBNCWVF3rGnewWxGIxWuwvbN5h6LM8Kg2qhDleFKngV1CtTWUwzm99x2qrLmcJSopQqtLyOMunPRhBFSo9zs4wJ\/kMNHRfCgzQ3z91M5eue4DSrD34Q8xIO4oFIkgNXfTznhyPrWg6hvxBnH4DEJxrzq4BrxKxuhccMpgWh8ypgpjBu020fuLLiFwzCOIAGOvaCaVFQgKtReTB8poBRCPwc9+nuvC9kd3d9tMd396Bj\/DqHd1fAdxCEO4oDxdxHJDk8JnSU+7FnNmqIy2AvBBguBKSv36TLO9gRyylw=","status":"Ffl4tFA8xyCRi7r0\/N7jIXxONSIEaqBRd1\/+ztnVXdfgvsA6ZCO0Zgc6gTeOTqDaN7Z4ubflfvLxtiCg0Pa68Lyhk\/xdCmqgjxsz5JLf\/\/c="},{"home_id":"11111","id":"42188130","version_data":"30","version_status":"11472","data":"Xt5viRNpTXv9fZ3TD4rxlNtCElGMobHXwUBf2KnWk1o9k4s4er9s+217APdayzokqME6wSS1xdP+HvLkGCSyaOagBznveGZvo3vz41A60LZtccX20yUPWtiIUQESpLLDRSmWLDcjH4ZPCBZ5f56krhX1207P3MlPNa3dPSJ7ywzZBpP0a9P6AOatDBvAT+hwj9LPPxN0CajTEQSETQcbvjhohFbL4wK5H3hZMF\/qj6bbmg6hLA0zowLW3lWRqEDJnQsLMkuMkR9ii+AsVho0fKLzC49OR7cOVgbpR5koRHArBxhBYHdOG6sdmC3s+zr8o46f4f15RS5mpYPoMOnPIuAAGE5i3UwAVAuq2\/4uEjw=","status":"z4KJjzlRDwTIBIAxNIKX\/YMMIbQzbOcBvTTlBtNWJK8Ttog0nkFXAigMtZlceVf6rIY+jdUfpaRqWM\/barj3tyADoSDOaTxx3OMlX9WGcZM="},{"home_id":"11111","id":"44755901","version_data":"27","version_status":"11471","data":"kJ3LMzLS7R1PsTwzQBJTaOrl2A1YWcIsmzK2gB+oa+o1CNRQc1F33FT23HFWJyksjaj7T57mvpYyeFZ\/NevS4vpqUtjUL8LV3uH9uDCpNanRzm172JsESsU5EvD2jHg934GjQc1C6eDMuH\/sMpD1vJQ7wa2HgPFbrlaJ0XhUVj5sSH3UmzxS2GxVEsLq+HfR596FfI74rBaMxraUAl9Cg98AhwL+k\/e6fYAZ0+zof5dzQEKR1iynFJjABd0lq+Ud+ta\/60VGXL3iXJTnnnoIAHqHVcFoZlVYNZaa5uTQ+hivqWdvFuu9vyg4g30F71IJ4PGhKpWxKJ9NBXuih09BMw==","status":"Av\/DA3qAVAmpYTCMFBAPJ3fPjq6NYiJe0\/490SKCVl2Qxelf8KrTkXUXcrfSjCjM5LQ3dkHec+c5V1LIEPKHCh9ZbVhkoiCJ3N8Nsrj1UHU="},{"home_id":"11111","id":"72882030","version_data":"49","data":"TqgPvsUKmxbSXwgfgn4v8WfYk1icTm3WTLsI33\/cLqOGhfk8zq37FqxcB+ZmUXfd3rE4c1O3jbUuodGLuESmcQdg6pP4z+\/uyeCo0bzWRN0Phkju6VlFw22NmQtMEPqiH1DP+HRtmzO+RVdlgqYNDSVO6wdoPrj5Ar06j3+zX6sSYmPQXUypIr65m+ujmfKUZAoGkLsQjsynJBds2pe8q+HLXLxBp5\/pA02efEgU7a3RTNBcqvyRC7b6za8yNgX2","created":"2020-06-16 17:25:43"},{"home_id":"11111","id":"79822951","version_data":"42","data":"78gNtVUILJ8lOtdISY+ctpdrOyUonWzN2Wg2TvJITjtCzt55xD99H0IsGQFZvOAf9FMkPQ1LTG54aCM+pMG\/bRNtA9f+k4gvL1pCtj231iCLnKtPvHMEbQr4T484tsGzw1Tr2xWcHwzWZNbjoKu0k\/RXuw8NW9b9fEYM4u6qUiiZNK7nhiWixZ\/LGkenUEtkp\/yJwOox6\/ZZJxR\/o5MrPt3PEKIgdCdurJ7s3VB47cc=","created":"2020-06-16 17:10:42"}]","id":"17087827","version_status":"0","version_data":"29","status":null,"data":"0\/Yrf3IjgfSi4k7Qlg1tI8Tve5ULiYrjpnAkCTqWYLi4YMToB9eEJWqAf9bM0x3QnGCWDlgpDC44mY1QiGYYxW9Er8XMJTmHssOElvxHOBVlNHvl11ytFujsWt5Hmgt8cgdAAWDAphV8JkZWTneO9bCcc9Jd2zfuGx6mviTAx50nWLmpjCnqi\/fhjCILxCMAOjUbjLMeSOiHe66D5ePiav5YI4\/+qTI7wpm6eydmWt8PG9VzY0UJ\/+dCsnT\/uet7QH9GaVkoS6T4QoqAnnOC5KMUA86jSz6VV1yokvtnm+0=","time_added":"2021-04-30 08:06:47"},{"home_id":"11111","id":"19672034","version_status":"28827","version_data":"13","status":"GXFIEiWEIeXhgXROpDk5IsdkvsyWq011+w2u8rIMRktoIjdjz1tlNec1GDiwwKVmCNF2t2iceiKe0S0g8DVPkw==","data":"0u0YHJ8O3XSaq\/vYP8KlxGiHm8oZc2aK\/FyhMO2xyzWYryHlbMfS0F+K7cNqvW2O0mu2nAgRxb1JJpQzuCkMJ02lZZFzvx8982985\/V6B8Fo59Drkj11P7T3jjZNuHqKZRFStMyWONsnGwrCvKApyh1QNQ8LeRRYbQdjgGKa5dfabjpkUvnlbTUqpw5AIacHWp9lEjL4uM1nyKaW22qv7gQwqhUUWNCTWNaHujqRrrVOoiToS+w1m8URxC3atvHt2adtYxhe\/YoRUE7ZedCz53TAHg\/qkBMxkZpBZu10YUY=","time_added":"2020-06-16 17:26:03"},{"home_id":"11111","id":"21744776","version_status":"28828","version_data":"16","status":"qmZ+upSBsuwACwSGny4HSU3aDArbs1tNAOCsFSegi3M\/\/IFyv2av5Uva14GDh9p90+7VE56kqAS3Rj6RSCqZrQ==","data":"bhByWoEwFGZObuiA7mFxywADA8JTN1Lbwku\/CV5uAQD7BCfeD0kxspgJaaTFZaRawAxKCnsAncdvsId9+FB+uQDdyMolF0ldIBgQaPSvm8R6dmnDjcdyKbQyjMywipwwcrNm7teCXk41rn+0ltFxw9pTvohOB8uTKkFyl+exThBv9FHvKghyC4aOAEQhaYur+NhQY8XXCRhe4Ox2Yzc5lSVpSCjU+QTnpClInAPK5yY7oUaIqtxPLt5\/SQs8Tllm+kISsLWix35Cz1x8Iw7NPCWb35veJ\/iWQV75r62z3wk=","time_added":"2020-06-16 17:26:51"},{"home_id":"11111","id":"30990135","version_status":"0","version_data":"29","status":null,"data":"6xw9x2wNBkJWIY6ZWhESbVTFYIrTsPGwazncaFdHf3lz+pzz0EX3Z0\/s1byxa9Ii3FWYr\/FarWQf8sbIeBmLn9lFqhc3Gkdin9b\/WROivQ96PfbiXshY31S+koRPx3wHcsrg4CAoAosgrONnnriizM4VP1xZasaB1TQfYWVQP\/HbVJLS5EzXcc4TDkpWl++ti6tKP7QEdEijYjO\/dJ+LV6f95+4F4F3ajUpMhr53iG4Nrh8EsTY0JwU632kxYTLrQ2Fvc9YqGLEpgrbBegrbO0AIhxhE\/bCqKQ5VPOrocR5O+FRzdySm+uzDfkY9qwBE","time_added":"2020-07-04 21:17:05"},{"home_id":"11111","id":"100663297","version_status":"34260","version_data":"0","status":"nVC0gzGdentCkPCicnSEPugizLQmgqTbQXVq5sldEzAuzqng9GrQIPg+T1O9T3KXGBH7UdKmq+GN9fDrj2yiu9HxEnbrVAMs7GIOysuLA5CQWpFlHtXhR9aOR5DqorfbyCIHM1eZcVkGliYFNYfAuIA7t3AIqlH8OkRrjKnMWRA=","data":"KboJHiggRc0oU9LDi2u5MHY5Bu6lMuy0aQexOCdn1\/7Sq\/bYBlr9iI3FERXY7Ive0vFkIQ7axv0OdT0Crze7K10D3P1CkyluwXmHCemTx94=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663299","version_status":"34279","version_data":"0","status":"eOsdAy9fvJqEocTfdQzfvRUimw8PGNAAvXK13rCbHfQJIW5atkJ0o+yi4GvEmiR4vtpT\/uZmiG2nZdxoElRdb9s1PiT1kr6ReyMrMwW0xw+GICSkRcfImwQAVBb9xyvn","data":"3iZwrvLyxWeIL9nvMrPw2\/EoD4uJDlDkLy2697uipT8qk7WnrIa95GCmawKtKWnyCQd7DJhWmHW4KsVPlrXXY\/iHa2HormSG0i6rA1YdKyk=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663300","version_status":"0","version_data":"0","status":null,"data":"HkwXQSNbOAUzGL5k7muRKrsFbGSZRGjVaDNtsJ4N8T9Sgp6Is5lEul00iDqqjfKtoqKyEdJ53McTI8JV8Up49WNbU8jO\/pTjRsoMj9O+jd4=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663301","version_status":"0","version_data":"0","status":null,"data":"EdVd5fU2dUdDgYDa+FEBCWq3fq7HUgw6fRIhEVqcZllVZ7RCh3RzquQ9s7t5QoPOkHTCdbBmeAhaNKGh1DIywpQCeKk7kOvYN6MUlGaRL4IyDCQwO3LT843FuFuqPUbM","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"100663302","version_status":"34279","version_data":"0","status":"v255ugn6duQiJ6UYbxO69uyH10Bbvj0E1uSdFj3fjVZ8Lk8AWkt9xXd6rdE2nCgJci+fQUhf5DlmDBh3SZHjgLhBro6xOIPm57KqzYssVfo1hqKCb+8kV4Hz+w5ArueZZ1kWQllKiSJFHP3heekcXg==","data":"BbJ3+pMq41IHhxkBVAFB7nNRz1AsEGGTghGGseVAXKZ1AsCJQnoLxnMOSlubcz+YKhiCj4YIfOlsdqXgn7C4wdjzK8aOlRHzDHBFwfejNTk=","time_added":"2020-06-16 17:10:30"},{"home_id":"11111","id":"37921771","version_data":"30","version_status":"3319","data":"652u+8OR\/eWpEi7CvP9X396VZ12vie2lp8l03\/Gmf1poquv60rove0InYYKF\/1MzY37nrBNCWVF3rGnewWxGIxWuwvbN5h6LM8Kg2qhDleFKngV1CtTWUwzm99x2qrLmcJSopQqtLyOMunPRhBFSo9zs4wJ\/kMNHRfCgzQ3z91M5eue4DSrD34Q8xIO4oFIkgNXfTznhyPrWg6hvxBnH4DEJxrzq4BrxKxuhccMpgWh8ypgpjBu020fuLLiFwzCOIAGOvaCaVFQgKtReTB8poBRCPwc9+nuvC9kd3d9tMd396Bj\/DqHd1fAdxCEO4oDxdxHJDk8JnSU+7FnNmqIy2AvBBguBKSv36TLO9gRyylw=","status":"Ffl4tFA8xyCRi7r0\/N7jIXxONSIEaqBRd1\/+ztnVXdfgvsA6ZCO0Zgc6gTeOTqDaN7Z4ubflfvLxtiCg0Pa68Lyhk\/xdCmqgjxsz5JLf\/\/c="},{"home_id":"11111","id":"42188130","version_data":"30","version_status":"11472","data":"Xt5viRNpTXv9fZ3TD4rxlNtCElGMobHXwUBf2KnWk1o9k4s4er9s+217APdayzokqME6wSS1xdP+HvLkGCSyaOagBznveGZvo3vz41A60LZtccX20yUPWtiIUQESpLLDRSmWLDcjH4ZPCBZ5f56krhX1207P3MlPNa3dPSJ7ywzZBpP0a9P6AOatDBvAT+hwj9LPPxN0CajTEQSETQcbvjhohFbL4wK5H3hZMF\/qj6bbmg6hLA0zowLW3lWRqEDJnQsLMkuMkR9ii+AsVho0fKLzC49OR7cOVgbpR5koRHArBxhBYHdOG6sdmC3s+zr8o46f4f15RS5mpYPoMOnPIuAAGE5i3UwAVAuq2\/4uEjw=","status":"z4KJjzlRDwTIBIAxNIKX\/YMMIbQzbOcBvTTlBtNWJK8Ttog0nkFXAigMtZlceVf6rIY+jdUfpaRqWM\/barj3tyADoSDOaTxx3OMlX9WGcZM="},{"home_id":"11111","id":"44755901","version_data":"27","version_status":"11471","data":"kJ3LMzLS7R1PsTwzQBJTaOrl2A1YWcIsmzK2gB+oa+o1CNRQc1F33FT23HFWJyksjaj7T57mvpYyeFZ\/NevS4vpqUtjUL8LV3uH9uDCpNanRzm172JsESsU5EvD2jHg934GjQc1C6eDMuH\/sMpD1vJQ7wa2HgPFbrlaJ0XhUVj5sSH3UmzxS2GxVEsLq+HfR596FfI74rBaMxraUAl9Cg98AhwL+k\/e6fYAZ0+zof5dzQEKR1iynFJjABd0lq+Ud+ta\/60VGXL3iXJTnnnoIAHqHVcFoZlVYNZaa5uTQ+hivqWdvFuu9vyg4g30F71IJ4PGhKpWxKJ9NBXuih09BMw==","status":"Av\/DA3qAVAmpYTCMFBAPJ3fPjq6NYiJe0\/490SKCVl2Qxelf8KrTkXUXcrfSjCjM5LQ3dkHec+c5V1LIEPKHCh9ZbVhkoiCJ3N8Nsrj1UHU="},{"home_id":"11111","id":"72882030","version_data":"49","data":"TqgPvsUKmxbSXwgfgn4v8WfYk1icTm3WTLsI33\/cLqOGhfk8zq37FqxcB+ZmUXfd3rE4c1O3jbUuodGLuESmcQdg6pP4z+\/uyeCo0bzWRN0Phkju6VlFw22NmQtMEPqiH1DP+HRtmzO+RVdlgqYNDSVO6wdoPrj5Ar06j3+zX6sSYmPQXUypIr65m+ujmfKUZAoGkLsQjsynJBds2pe8q+HLXLxBp5\/pA02efEgU7a3RTNBcqvyRC7b6za8yNgX2","created":"2020-06-16 17:25:43"},{"home_id":"11111","id":"79822951","version_data":"42","data":"78gNtVUILJ8lOtdISY+ctpdrOyUonWzN2Wg2TvJITjtCzt55xD99H0IsGQFZvOAf9FMkPQ1LTG54aCM+pMG\/bRNtA9f+k4gvL1pCtj231iCLnKtPvHMEbQr4T484tsGzw1Tr2xWcHwzWZNbjoKu0k\/RXuw8NW9b9fEYM4u6qUiiZNK7nhiWixZ\/LGkenUEtkp\/yJwOox6\/ZZJxR\/o5MrPt3PEKIgdCdurJ7s3VB47cc=","created":"2020-06-16 17:10:42"}]
Resultaat van de api call via een url.

Acties:
  • 0Henk 'm!

  • bjp
  • Registratie: januari 2010
  • Laatst online: 21-06 16:39
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def get_device_check(self, entity) -> []:
        url = base_url + "/entity.php"
        params = {"action": "check", "email": self._email, "mac": self.mac.replace(":", ""),
                  "password_hash": self._password, "entity_id": str(entity)}
        resp = requests.get(url, params=params)
        arr = json.loads(resp.text)
        if len(arr) == 4:
            # 0: data-version
            # 1: data
            # 2: status-version
            # 3: status
            try:
              dcrpt = json.loads(decrypt(arr[3], self.aes))
              if "module" in dcrpt and "functions" in dcrpt["module"]:
                  return dcrpt["module"]["functions"]
            except TypeError:
              pass
            except json.decoder.JSONDecodeError:
              pass
        return []


uit de resp.text wordt een JSON load gedaan. Hierin in het 4de element nemen, decrypten, terug JSON load... en daarin heb je dan de nodige data ;)

code:
1
2
3
4
5
6
def decrypt(string: str, aes: str) -> str:
    base = base64.b64decode(string)
    iv = base[:16]
    inp = base[16:]
    cipher = AES.new(bytes.fromhex(aes), AES.MODE_CBC, iv)
    return unpad(cipher.decrypt(inp), 16).decode(encoding)

[Voor 11% gewijzigd door bjp op 04-06-2021 14:57]


  • Amersfoort
  • Registratie: april 2009
  • Laatst online: 15:43
bjp schreef op vrijdag 4 juni 2021 @ 14:56:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def get_device_check(self, entity) -> []:
        url = base_url + "/entity.php"
        params = {"action": "check", "email": self._email, "mac": self.mac.replace(":", ""),
                  "password_hash": self._password, "entity_id": str(entity)}
        resp = requests.get(url, params=params)
        arr = json.loads(resp.text)
        if len(arr) == 4:
            # 0: data-version
            # 1: data
            # 2: status-version
            # 3: status
            try:
              dcrpt = json.loads(decrypt(arr[3], self.aes))
              if "module" in dcrpt and "functions" in dcrpt["module"]:
                  return dcrpt["module"]["functions"]
            except TypeError:
              pass
            except json.decoder.JSONDecodeError:
              pass
        return []


uit de resp.text wordt een JSON load gedaan. Hierin in het 4de element nemen, decrypten, terug JSON load... en daarin heb je dan de nodige data ;)

code:
1
2
3
4
5
6
def decrypt(string: str, aes: str) -> str:
    base = base64.b64decode(string)
    iv = base[:16]
    inp = base[16:]
    cipher = AES.new(bytes.fromhex(aes), AES.MODE_CBC, iv)
    return unpad(cipher.decrypt(inp), 16).decode(encoding)
Als ik het goed begrijp (ik ben geen developer) neem ik uit de json file de waarde van het element "status", en die moet ik gaan decrypten. Doordat ik geen kennis heb van Python, blijf ik hier hangen.
Ik denk dat de eerste stap is deze "status" waarde met base64 te decoderen (hetgeen mij nog onleesbare data geeft). Kun je functioneel aangeven wat er daarna moet gebeuren?
Bij het element "data" zie ik ook gecodeerde waarden. Kan ik hier nog iets mee doen?

Sorry voor de wellicht basic vraag, maar ik moet het naar PowerApps vertalen en die heeft andere functies.
Pagina: 1 2 Laatste


Apple iPad Pro (2021) 11" Wi-Fi, 8GB ram Microsoft Xbox Series X LG CX Google Pixel 5a 5G Sony XH90 / XH92 Samsung Galaxy S21 5G Sony PlayStation 5 Nintendo Switch Lite

Tweakers vormt samen met Hardware Info, AutoTrack, Gaspedaal.nl, Nationale Vacaturebank, Intermediair en Independer DPG Online Services B.V.
Alle rechten voorbehouden © 1998 - 2021 Hosting door True