This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

IP Control of LG TVs
#12
(24.12.2020, 08:58)admin Wrote: You can use loghex(data) to display binary data as hex. The receiving part of this example is incomplete. First 16 bytes of the reply contain the encrypted IV then one or more 16 byte blocks should follow. Receiving should stop if a decrypted block contains \n character.
ok i understand now, so if i read 32 bytes then split into 2 local var then use the iv in the first 16 bytes with the aes ecb, i will get the decrypted response then i need to split the string at \n to receive the full response

i have it with the below

Code:
reply = sock:receive(32)
     
      res_iv = string.sub(reply, 0, 16)
      enc_res = string.sub(reply, 17, 32)
   
      -- decript iv
      local aes_128_ecb, err = aes:new(key, nil, aes.cipher(128, 'ecb'), { iv = string.rep('\0', 16) }, nil, 0)
      local ivdec = aes_128_ecb:decrypt(res_iv)
     
      -- decrypt encryped reply
      local aes_128_cbcc, err = aes:new(key, nil, aes.cipher(128, 'cbc'), { iv = ivdec}, nil, 0)
      local datadec = aes_128_cbcc:decrypt(enc_res)
      loghex(datadec)
Reply


Messages In This Thread
IP Control of LG TVs - by jamesng - 16.12.2019, 15:05
RE: IP Control of LG TVs - by admin - 23.12.2019, 09:37
RE: IP Control of LG TVs - by AlexLV - 23.12.2019, 13:17
RE: IP Control of LG TVs - by jamesng - 24.12.2019, 01:26
RE: IP Control of LG TVs - by admin - 24.12.2019, 06:48
RE: IP Control of LG TVs - by benanderson_475 - 24.12.2020, 05:27
RE: IP Control of LG TVs - by jamesng - 29.12.2019, 10:26
RE: IP Control of LG TVs - by admin - 04.05.2020, 05:19
RE: IP Control of LG TVs - by lamgia99 - 17.10.2023, 10:19
RE: IP Control of LG TVs - by admin - 24.12.2020, 08:58
RE: IP Control of LG TVs - by benanderson_475 - 24.12.2020, 09:20
RE: IP Control of LG TVs - by admin - 25.12.2020, 14:08
RE: IP Control of LG TVs - by benanderson_475 - 26.12.2020, 09:12
RE: IP Control of LG TVs - by jlodvo - 26.03.2021, 22:37
RE: IP Control of LG TVs - by admin - 27.03.2021, 09:01
RE: IP Control of LG TVs - by admin - 17.10.2023, 10:27
RE: IP Control of LG TVs - by Igori - 26.04.2024, 14:54
RE: IP Control of LG TVs - by admin - 29.04.2024, 06:25
RE: IP Control of LG TVs - by Igori - 30.04.2024, 14:35

Forum Jump: