Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > Video stream recording
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #1  
Old 10-26-2017, 04:13 AM
Pozz Pozz is offline
Junior Member
 
Join Date: Sep 2017
Posts: 6
Pozz is on a distinguished road
Default

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!
Reply With Quote
  #2  
Old 10-26-2017, 11:36 AM
vanminhland87 vanminhland87 is offline
Junior Member
 
Join Date: Aug 2017
Posts: 17
vanminhland87 is on a distinguished road
Default

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
Reply With Quote
  #3  
Old 10-26-2017, 01:37 PM
Pozz Pozz is offline
Junior Member
 
Join Date: Sep 2017
Posts: 6
Pozz is on a distinguished road
Default

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:
Reply With Quote
  #4  
Old 10-26-2017, 02:09 PM
Pozz Pozz is offline
Junior Member
 
Join Date: Sep 2017
Posts: 6
Pozz is on a distinguished road
Default

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!
Reply With Quote
  #5  
Old 10-26-2017, 03:13 PM
Pozz Pozz is offline
Junior Member
 
Join Date: Sep 2017
Posts: 6
Pozz is on a distinguished road
Default

Re: HLS Stream : Encrypted TS


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
Attached Files
File Type: txt key.txt (22 Bytes, 0 views)
File Type: txt key_hex.txt (41 Bytes, 0 views)
Reply With Quote
  #6  
Old 10-28-2017, 05:55 PM
Pozz Pozz is offline
Junior Member
 
Join Date: Sep 2017
Posts: 6
Pozz is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 10-29-2017, 05:39 PM
JonDough JonDough is offline
Member
 
Join Date: Feb 2016
Posts: 90
JonDough is on a distinguished road
Default

Re: HLS Stream : Encrypted TS


Quote:
Originally Posted by Pozz View Post
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.
Reply With Quote
Reply Post New Thread
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons