All Projects → yiShanXin → Android-hls

yiShanXin / Android-hls

Licence: other
最近公司产品需要,调研hls(m3u8) aes-128 解密播放 . 分析 51Cto, 慕课

Projects that are alternatives of or similar to Android-hls

p2p-cdn-sdk-android
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 39 (-46.58%)
Mutual labels:  player, hls, m3u8, exoplayer
Android P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 70 (-4.11%)
Mutual labels:  player, hls, m3u8, exoplayer
Ios P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 31 (-57.53%)
Mutual labels:  player, hls, m3u8
Starrysky
🔥A Powerful and Streamline MusicLibrary(一个丰富的音乐播放封装库,支持多种音频格式,完美解决你的问题。)
Stars: ✭ 1,022 (+1300%)
Mutual labels:  hls, m3u8, exoplayer
Sjmediacacheserver
A HTTP Media Caching Framework. It can cache FILE or HLS media. 音视频边播边缓存框架, 支持 HLS(m3u8) 和 FILE(mp4, mp3等).
Stars: ✭ 87 (+19.18%)
Mutual labels:  player, hls, m3u8
CBPlayer
一个内置P2P的神奇播放器
Stars: ✭ 60 (-17.81%)
Mutual labels:  player, hls, m3u8
Backoffice Administration
Stars: ✭ 89 (+21.92%)
Mutual labels:  player, hls, m3u8
Mediasdk
The library is working for downloading video while playing the video, the video contains M3U8/MP4
Stars: ✭ 164 (+124.66%)
Mutual labels:  hls, m3u8, exoplayer
Html5 Dash Hls Rtmp
🌻 HTML5播放器、M3U8直播/点播、RTMP直播、低延迟、推流/播流地址鉴权
Stars: ✭ 1,805 (+2372.6%)
Mutual labels:  player, hls, m3u8
flutter playout
AV Playout in Flutter
Stars: ✭ 129 (+76.71%)
Mutual labels:  player, hls, exoplayer
P2p Cdn Sdk Javascript
Free p2p cdn github javascript sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 158 (+116.44%)
Mutual labels:  player, hls, m3u8
Magicalexoplayer
The Easiest Way To Play/Stream Video And Audio Using Google ExoPlayer In Your Android Application
Stars: ✭ 171 (+134.25%)
Mutual labels:  player, hls, exoplayer
Video.js
Video.js - open source HTML5 & Flash video player
Stars: ✭ 32,478 (+44390.41%)
Mutual labels:  player, hls
Wjplayer
Video.js bundle that supports HLS, VAST/VMAP, 360-degree videos, and more.
Stars: ✭ 55 (-24.66%)
Mutual labels:  player, hls
Fantasy
A music player based exoplayer. exquisite and fluent.
Stars: ✭ 23 (-68.49%)
Mutual labels:  player, exoplayer
Nexplayer unity plugin
Stream videos in HLS & DASH with Widevine DRM using NexPlayer Video Streaming Player SDK for Unity on Android & iOS devices
Stars: ✭ 73 (+0%)
Mutual labels:  player, hls
hls-downloader
Download all video files from HLS (HTTP Live Streaming) VoD (Video on Demand) m3u8 playlist for local playback
Stars: ✭ 121 (+65.75%)
Mutual labels:  hls, m3u8
P2p Media Loader
An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page
Stars: ✭ 822 (+1026.03%)
Mutual labels:  player, hls
Hls.js
HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
Stars: ✭ 10,791 (+14682.19%)
Mutual labels:  player, hls
Zy Player Web
▶️ 跨平台浏览器端视频资源播放器. 简洁免费. 🎞 ZY Player 浏览器端。
Stars: ✭ 101 (+38.36%)
Mutual labels:  player, m3u8

第一步 反编译 Apk,找到解密播放器模块

  • enjarify 生成混搅的jar (来自 Google 推荐)。

     $ python3 -O -m enjarify.main 51cto.apk
    

   

  • Http 抓包 User-Agent 这个看到(具体查看Http是什么详细解释)

  • 通过 JD-GUI 查看 用到了 ExoPlayer 播放器

    51cto Code

       

第二步 了解 ExoPlayer

51cto hls

  • com.google.android.exoplayer2.source.hls.HlsChunkSource

        setEncryptionData
    
        newEncryptionKeyChunk
    
  • com.google.android.exoplayer2.source.hls.HlsChunkSource

第四步 准备 Xposed Hook 环境

  - 鉴于有的小伙伴 Android 设备没办法安装 Xposed环境 , 以及需要自己写基于 Xposed Hook代码 ,下面有个视频教程可以达到这个 hook 效果

可能需要梯子(Fan qiang), 文件是在google 服务器

  - 通过 Inspeckage 去Hook 方法名称, 减少不懂怎么Hook入门

  # java Hook 代码 片段 (PS:不方便刚想写Hook同学,部分代码如下)所以推荐工具

Inspeckage 部分代码如下

 

 

     static void hook(HookItem item, ClassLoader classLoader) {

          try {
              Class<?> hookClass = findClass(item.className, classLoader);

              if (hookClass != null) {

                  if (item.method != null && !item.method.equals("")) {
                      for (Method method : hookClass.getDeclaredMethods()) {
                          if (method.getName().equals(item.method) && !Modifier.isAbstract(method.getModifiers())) {
                              XposedBridge.hookMethod(method, methodHook);
                          }
                      }
                  } else {
                      for (Method method : hookClass.getDeclaredMethods()) {
                          if(!Modifier.isAbstract(method.getModifiers())) {
                              XposedBridge.hookMethod(method, methodHook);
                          }
                      }
                  }

                  if (item.constructor) {
                      for (Constructor<?> constructor : hookClass.getDeclaredConstructors()) {
                          XposedBridge.hookMethod(constructor, methodHook);
                      }
                  }

              } else {
                  log(TAG + "class not found.");
              }
          } catch (Error e) {
              Module.logError(e);
          }
      }

 经过hook 数据后 , 发现解密key存在SharePreference 里encrypt_chapter_perfercence.xml 是存在是经过二次(正在看是怎么换算的)混搅过得,so !!! 那就看播放界面是怎么处理 key的吧。机续通过 JD-GUI看代码吧!

51cto player

  • com.google.android.exoplayer.core.PlayerActivity

  • com.google.android.exoplayer.core.PlayerFragment

        onPlayOnLine (处理在线播放)
             
        onPlayLocal (处理本地缓存播放)
             
        playSpecificChapter 
    

找到了关键点,只需要 Hook这个信息,就可以知道 key = 3SRSS6TS14GR9RN6, 但是 openssl 解密必须是一个32位的十六进制字符串,自己写个字符串转16进制的方法,

 public static String string2HexString(String strPart) {
     StringBuffer hexString = new StringBuffer();
       for (int i = 0; i < strPart.length(); i++) {
          int ch = (int) strPart.charAt(i);
          String strHex = Integer.toHexString(ch);
          hexString.append(strHex);
       }
     return hexString.toString();
}
  • 得到结果 33535253533654533134475239524e36

 - 加密 类型 aes-128-ecb

51cto vlc 加解密

第五步 写个批量解密 ts 切片脚本  如果没有 out_16 目录新建一个文件夹

  `for i in `cat high.m3u8| grep ts `;do openssl aes-128-ecb -v -p  -K 33535253533654533134475239524e36 -d -in $i -out "out_16/"$i;done`

shell 批量解析m3u8 来自于同事Feng 同学的代码

说明 上图代码段如果不知道这么写的道理 建议好好 opnssl help, 以及源代码处理大致逻辑,这个原理很重要

51cto vlc 播放         把16930根目录 high.m3u8复制到 out_16文件夹里面,然后直接用 vlc 打开就是可以正常播放了解密后的视频,这次 Hook 之旅完成了.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].