PDA

View Full Version : How to Decrypt .ts Files (Key is available)


MoonLaf
07-13-2017, 12:26 AM
Hi,

I have a Sat Box on which there is a service to download movies/series from the internet into the hard disk inside the Sat Box.

I managed to obtain the downloading link for one of the movies/series and downloaded it to my hard disk.

There was a decryption file key along with the downloaded movie file.

I would like to ask now if there is a way to De-crypt this video file based on the available key file.

I can watch the video file on VLC or MPC, but it is scrambled.

Below is the details of this video file from Media Info:


General
ID : 0 (0x0)
Complete name : D:\!Temp\Temp_DL.nds
Format : MPEG-TS
File size : 977 MiB
Duration : 20 min 41 s
Overall bit rate mode : Variable
Overall bit rate : 6 598 kb/s
FileExtension_Invalid : ts m2t m2s m4t m4s tmf ts tp trp ty

Video
ID : 2064 (0x810)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, RefFrames : 2 frames
Codec ID : 27
Duration : 29 s 40 ms
Bit rate mode : Constant
Bit rate : 6 000 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 FPS
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type, store method : Separated fields
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.116
Stream size : 20.8 MiB (2%)
Encryption : Encrypted
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio #1
ID : 2068 (0x814)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 4
Duration : 20 min 39 s
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 18.9 MiB (2%)
Language : English
Encryption : Encrypted

Audio #2
ID : 2069 (0x815)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 4
Duration : 20 min 39 s
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 18.9 MiB (2%)
Language : Chinese
Encryption : Encrypted

Text
ID : 2073 (0x819)
Menu ID : 1 (0x1)
Format : DVB Subtitle
Codec ID : 6
Duration : 20 min 30 s
Delay relative to video : 1 s 70 ms
Language : Chinese


Kind Regards,
Mouna.

PayNow
07-13-2017, 06:58 AM
You can use livestreamer, or streamlink or even ffmpeg does support key decryption.

MoonLaf
07-13-2017, 10:11 AM
You can use livestreamer, or streamlink or even ffmpeg does support key decryption.

Thanks for your reply.

Is there any guides on how to use streamlink or ffmpeg to decrypt the video file?

Yelloworanges
07-13-2017, 11:47 AM
Thanks for your reply.

Is there any guides on how to use streamlink or ffmpeg to decrypt the video file?
It looks like you downloaded a single video file that was never in hls format (m3u8 playlist with ts segments).

If this is correct, then the "drm" is likely something other than hls-aes.

Look at the beginning of the file that you download with a hex editor for clues about the type of drm.

MoonLaf
07-13-2017, 12:55 PM
It looks like you downloaded a single video file that was never in hls format (m3u8 playlist with ts segments).

If this is correct, then the "drm" is likely something other than hls-aes.

Look at the beginning of the file that you download with a hex editor for clues about the type of drm.

Can't we figure the Encryption type from the Decryption File:


<?xml version="1.0" encoding="UTF-8" ?>
<Client_ECMs version="1.0"><Total_Session_ECMs>2</Total_Session_ECMs>
<CryptoPeriod Sequence_Number="1"><CryptoStart>5</CryptoStart><ECMStructure>AQAXCOQRW9IL6AAAXl8Q84FwYwAAARaiAjYDAAAA/3Uh4AEAAfwBDAIAgwD5SH4QdRwaK4Q66KD+aJXHi8SesZA0wIH snbmDZjdy8lC4ImETT/7xnlGEviATpjRS/58XcHEYw5dH8jY87JcFIvz6hRnqWWHtSA==</ECMStructure><Parity>129</Parity></CryptoPeriod><CryptoPeriod Sequence_Number="2"><CryptoStart>720565</CryptoStart><ECMStructure>AQAXCOQRW9IL6AAAXl8VwYBwYwAAARaiAjYDAAAA/3Uh4AEAAfwBDAIAgwD5SH4QKf0TQfW0qdhdEVfLlfRjWpA0wIH snbmDZjdy8lC4ImETT/7xnlGEviATpjRS/58XcHEYw5dH8jY87JcFIvz6hRnqWWHtSA==</ECMStructure><Parity>128</Parity></CryptoPeriod></Client_ECMs>

MoonLaf
07-14-2017, 01:48 AM
I digged into the issue and found the below information:

Encryption Type: PlayReady

and found also the below line:


"drmToken":"AAAEADaQNMCBaRWsfKxlUmvys4GISYjx4FT+rw4kY6YBIndnKY KBu/ykjQVTmsKOTkA/pnrfs0DU0uk=","drmFree":false

Yelloworanges
07-14-2017, 03:15 AM
I don't know of any solution for PlayReady. Is the service offered on the web or on any other platform besides "Sat Box".
If it is offered on some other platform, there might be weaker forms of drm used.

Reversing PlayReady would likely take a lot of work and skill.

MoonLaf
07-14-2017, 04:05 AM
I don't know of any solution for PlayReady. Is the service offered on the web or on any other platform besides "Sat Box".
If it is offered on some other platform, there might be weaker forms of drm used.

Reversing PlayReady would likely take a lot of work and skill.

I don't think we need to do encryption reversing.

The key is already available.

I downloaded (2) main files:

1. video_file.nds
2. key_file.xml

there was another file that has some information like this:


"physicalContentId":"video_file.nds"
"keyfileUrl":"http://Sat_Provider_Website/key_file.xml"
"fileSize":1024080871
"drmToken":"AAAEADaQNMCBaRWsfKxlUmvys4GISYjx4FT+rw4kY6YBIndnKY KBu/ykjQVTmsKOTkA/pnrfs0DU0uk="
"drmFree":false


and what about the key_file.xml content itself:


<?xml version="1.0" encoding="UTF-8" ?>
<Client_ECMs version="1.0"><Total_Session_ECMs>2</Total_Session_ECMs>
<CryptoPeriod Sequence_Number="1"><CryptoStart>5</CryptoStart><ECMStructure>AQAXCOQRW9IL6AAAXl8Q84FwYwAAARaiAjYDAAAA/3Uh4AEAAfwBDAIAgwD5SH4QdRwaK4Q66KD+aJXHi8SesZA0wIH snbmDZjdy8lC4ImETT/7xnlGEviATpjRS/58XcHEYw5dH8jY87JcFIvz6hRnqWWHtSA==</ECMStructure><Parity>129</Parity></CryptoPeriod><CryptoPeriod Sequence_Number="2"><CryptoStart>720565</CryptoStart><ECMStructure>AQAXCOQRW9IL6AAAXl8VwYBwYwAAARaiAjYDAAAA/3Uh4AEAAfwBDAIAgwD5SH4QKf0TQfW0qdhdEVfLlfRjWpA0wIH snbmDZjdy8lC4ImETT/7xnlGEviATpjRS/58XcHEYw5dH8jY87JcFIvz6hRnqWWHtSA==</ECMStructure><Parity>128</Parity></CryptoPeriod></Client_ECMs>


Is there any way to use the available information to decrypt the video file?

Yelloworanges
07-14-2017, 05:24 AM
I don't think we need to do encryption reversing.
I said "Reversing PlayReady", meaning the PlayReady system - including file structure, methodology and implementation.
Some custom tools or scripts would likely be required.

The key is already available.

I downloaded (2) main files:

1. video_file.nds
2. key_file.xml
You make it sound so easy. Please do go on and explain more.

MoonLaf
07-15-2017, 03:08 AM
I said "Reversing PlayReady", meaning the PlayReady system - including file structure, methodology and implementation.
Some custom tools or scripts would likely be required.


You make it sound so easy. Please do go on and explain more.

Sorry if I misunderstood what you've said.

I didn't say it is easy. I just want to know the approach that I should follow to decrypt the file based on the available information.

MoonLaf
07-18-2017, 05:51 AM
If there is no way to decrypt the vidoe file, is there a way to play it using the decryption key?