Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

HLS Stream : Encrypted TS

(http://stream-recorder.com/forum/showthread.php?t=23637)

Pozz 10-26-2017 03:13 AM

HLS Stream : Encrypted TS


 
Hi everybody,

I'm trying to download a video from a website wich uses hls stream protocol. I managed to get the playlist file and all the ts files, but when I try to concatenate them with ffmpeg, it doesn't works obviously.
In the playlist file, there a URI link to the key:

Code:

#EXT-X-KEY:METHOD=AES-128,URI="link to the key",IV=0x3838c5776a2114c7233d9099fb7d7bf2
There's a python script on the forum (Here) but when I execute it, it says to me this error:
Code:

AttributeError: 'M3U8' object has no attribute 'key'
The key given by the website is a 16 bytes incomprehensible word :
Code:

D×><
AiB?a±?U<Á

If you want more information about the website, send me a pm, I'm trying not to get the attention from them.
Thanks!

vanminhland87 10-26-2017 10:36 AM

Re: HLS Stream : Encrypted TS


 
Dá»± ??n cao cá??p quá?*n 9 Rio Vista nh?* phố v?* biệt thá»± l?* dá»± ??n nh?* á»? cao cá??p cá»§a tá?*p Ä‘o?*n MIK Group. Ná?±m tá??i Khu biệt thá»± Khang Ä?iá»?n, ph?°á»?ng Ph?°á»›c Long B, quá?*n 9, Tp.HCM. Rio Vista l?* niá»?m tá»± h?*o tiá??p theo cá»§a MIK Group sau nhá»?ng dá»± ??n Ä‘?¬nh Ä‘??m tr?°á»›c Ä‘?? bao gồm: Villa Park quá?*n 9, Park Riverside, Park Riverside Premium & River Park.



T??n dá»± ??n: Khu d??n c?° cao cá??p Rio Vista Quá?*n 9

Chá»§ Ä‘á?§u t?°: Tá?*p Ä?o?*n MIK GROUP

Quy m?´: 4.8 ha vá»›i số l?°á»?ng nh?* phố 234 cÄ?n v?* diện t?*ch má??ng xanh & tiện ?*ch ná»™i khu: 1 ha

Loá??i h?¬nh nh?* á»?: nh?* á»?, nh?* phố th?°??ng má??i v?* biệt thá»±.

B?*n giao: Ho?*n thiện ngo?*i s� h�u sổ hồng vĩnh viễn v?* b?*n giao :4/2018



Dá»± ??n Rio Vista ná?±m tr??n Ä‘?°á»?ng D?°??ng Ä??¬nh Há»™i, Ph?°á»?ng Ph?°á»›c Long B, Quá?*n 9,TPHCM . Dá»± ??n ná?±m gá?§n khu biệt thá»± Gia H??a, khu Khang Ä?iá»?n, khu biệt thá»± Valora Nam Long .

Dá»± ??n cÄ?n há»™ Rio Vista vá»›i nhiá»?u chức nÄ?ng nhá?±m Ä‘??p ứng nhu cá?§u cá»§a cuá»™c sống hiện Ä‘á??i v?* tiá??t kiệm tối Ä‘a thá»?i gian Ä‘i lá??i v?* nghỉ ng??i cá»§a c?° d??n m?* kh?´ng phá??i cá?§n Ä‘i Ä‘??u xa. Khu trung t??m th?°??ng má??i mua sá??m rá»™ng lá»›n Ä‘á?§y đủ tiện ?*ch khu c?´ng vi??n, c?? nhiá»?u má??ng xanh gi??p cho kh??ch h?*ng c?? nhá»?ng gi??y ph??t th?° giá??n tuyệt vá»?i b??n gia Ä‘?¬nh cafe sang trá»?ng v?* dịch vá»? chÄ?m s??c sức khá»?e: gym, spa… Ph??ng sinh hoá??t cá»™ng đồng dịch vá»? bá??o vệ chuy??n nghiệp 24/24 an ninh tuyệt đối, khu vui ch??i cho trá?» em, BBQ ngo?*i trá»?i cho cá?? gia Ä‘?¬nh ….

Gi?? b??n dá»± kiá??n nh?* phố Rio Vista : (Xem cÄ?n há»™ thá»±c tá??)

– Nh?* phố Rio Vista: 5?—15 – Gi?? 3,1 – 3,3 tá»·/cÄ?n (Ä??? VAT) ,

– Biệt thá»± g??c Rio Vista – Gi?? 5 – 7 tá»·/cÄ?n (Ä??? VAT) ,

– Shophouse Rio Vista : 5?—20 – Gi?? 4,5 – 5 tá»·/cÄ?n (Ä??? VAT)
>>>Gá»?i ngay Ä‘á»? nhá?*n ngay bá??ng gi?? ?°u Ä‘??i<<<Chá»§ Ä?á?§u T?° Hotline :0911.3433.22

Pozz 10-26-2017 12:37 PM

Re: HLS Stream : Encrypted TS


 
Yes but the key looks very weird, don't you think? There' no extension in the key url and it looks like this:

Pozz 10-26-2017 01:09 PM

Re: HLS Stream : Encrypted TS


 
So if I understand right, the hexadecimal converted key should looks like this:
Code:

44c3973e3cda416942c2a361c2b1c3a03553cc381
Using the script available on the forum, I use the key and the iv directly because for some reason the m3u8 library doesn't work for me:

Code:

import m3u8
from Crypto.Cipher import AES
f = open('file.ts','rb')
playlist = m3u8.loads(playlist)
key = '44c3973e3cda416942c2a361c2b1c3a03553cc381'
iv = '3838c5776a2114c7233d9099fb7d7bf2' # For the iv I guess I didn't have to put '0x' in front of it.
aes = AES.new(key, AES.MODE_CBC, iv)
for x in playlist.segments :
        r = urllib2.urlopen(x.uri)
        d = r.read()
        d = aes.decrypt(d)
        f.write(d)
f.close()

When executing the script, I got this error:

Code:

ValueError: AES must be either 16, 24, or 32 bytes long
I guess I've done something wrong with the key.
Thanks for your time!

Pozz 10-26-2017 02:13 PM

Re: HLS Stream : Encrypted TS


 
2 Attachment(s)
I've tried this way, but there's still a problem with the key. ffmpeg says "Invalid data found when processing output". You can see here that they had the same problem (comments at the end).
I've uploaded the key files I'm using, the thing is that I don't know what's wrong in it.
Thanks

Pozz 10-28-2017 04:55 PM

Re: HLS Stream : Encrypted TS


 
There's a thread on this forum that was dealing about the same thing (Here).
I had to use Fiddler to intercept and download the key, and then use ffmpeg with the playlist file as input.

JonDough 10-29-2017 04:39 PM

Re: HLS Stream : Encrypted TS


 
Quote:

Originally Posted by Pozz (Post 94934)
There's a thread on this forum that was dealing about the same thing (Here).
I had to use Fiddler to intercept and download the key, and then use ffmpeg with the playlist file as input.

Thanks for your assistance with this! The difference here is that the key is fetched over https, unlike the site in that forum thread.


All times are GMT -6. The time now is 05:09 PM.