├── .gitignore ├── README.md ├── hack-iqiyi.bat ├── hack-iqiyi.py └── tool ├── abcexport.exe ├── abcreplace.exe ├── asasm.patch ├── liblzma.dll ├── patch.exe ├── python27.dll ├── python27.exe ├── python27.zip ├── rabcasm.exe └── rabcdasm.exe /.gitignore: -------------------------------------------------------------------------------- 1 | MainPlayer* 2 | history.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hack-iqiyi 2 | 一款 Windows 下获取爱奇艺flash并输出 enc_key 的python小工具,自带精简版 python 2.7.8,无需另外安装。 3 | 4 | ## 软件说明: 5 | * 支持平台:Windows 6 | * 所需软件:chrome 内核浏览器 7 | * 下载地址:[点击下载](https://github.com/xyuanmu/hack-iqiyi/archive/master.zip) 8 | 9 | ![hack-iqiyi](https://cloud.githubusercontent.com/assets/12442896/12503954/1223df2e-c114-11e5-8a4c-4e8205cb97d9.png) 10 | 11 | ## 使用方法: 12 | * 首先安装 chrome 内核浏览器如 [七星浏览器](http://www.qixing123.com/)(以下简称浏览器),只要能安装第三方扩展即可。 13 | * 下载 [Hack-iQiYi.crx](http://xyuanmu.github.io/hack-iqiyi/Hack-iQiYi.crx) 保存到本地任意目录。 14 | * 运行浏览器,在地址栏输入:chrome://extensions,回车,将 Hack-iQiYi.crx 拖入窗口安装并启用。 15 | * 运行 hack-iqiyi.bat,会自动下载flash文件并打补丁。 16 | * 当CMD窗口出现:`Serving HTTP on 127.0.0.1 port 8036`,用浏览器播放爱奇艺视频,enc_key 会自动出来。 17 | * 最后一步,到浏览器禁用 Hack-iQiYi,不然就无法正常播放了:smile:! 18 | 19 | ## 相关内容: 20 | * Linux平台获取爱奇艺key:[yan12125/iqiyi-hack](https://github.com/yan12125/iqiyi-hack) 21 | * PHP环境解析爱奇艺视频:[parseiqiyi](https://github.com/xyuanmu/parseiqiyi) 22 | * python解析网站音乐和视频:[soimort/you-get](https://github.com/soimort/you-get) 23 | -------------------------------------------------------------------------------- /hack-iqiyi.bat: -------------------------------------------------------------------------------- 1 | @echo off & title Patch iqiyi swf and get enc key 2 | :do 3 | "%~dp0/tool/python27.exe" "%~dp0hack-iqiyi.py" 4 | pause -------------------------------------------------------------------------------- /hack-iqiyi.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import shutil 4 | from urllib2 import Request, urlopen 5 | import subprocess 6 | import socket 7 | 8 | 9 | PAGE_URL = "http://www.iqiyi.com/v_19rroonq48.html" 10 | SWF_NAME = "MainPlayer.swf" 11 | HISTORY = "history.txt" 12 | HOST = '127.0.0.1' 13 | PORT = 8036 14 | HEADER = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0'} 15 | 16 | 17 | def download_swf(): 18 | if os.path.isfile(SWF_NAME): 19 | os.remove(SWF_NAME) 20 | 21 | try: 22 | print "Downloading the page %s, please wait..." % PAGE_URL 23 | req = Request(PAGE_URL, headers=HEADER) 24 | page = urlopen(req, timeout=5).read() 25 | except: 26 | print "URL open failed, please confirm %s is exists!" % PAGE_URL 27 | return False 28 | 29 | try: 30 | swf_url = re.compile(r'flashurl="(http://[^\'"]+\d+/\w+.swf)').findall(page)[0] 31 | print 'swf url is %s' % swf_url 32 | history(swf_url) 33 | data = urlopen(swf_url, timeout=10).read() 34 | open(SWF_NAME, "wb").write(data) 35 | return True 36 | except: 37 | print "Download swf failed!" 38 | return False 39 | 40 | 41 | def patch_swf(): 42 | abc_path = '%s-0' % SWF_NAME.split('.')[0] 43 | remove_files(abc_path) 44 | 45 | try: 46 | subprocess.check_call(['tool/abcexport.exe', '%s' % SWF_NAME]) 47 | subprocess.check_call(['tool/rabcdasm.exe', '%s.abc' % abc_path]) 48 | subprocess.Popen(['tool/patch.exe', '-p0', '-bi', '../tool/asasm.patch'], cwd=abc_path).wait() 49 | subprocess.check_call(['tool/rabcasm.exe', '%s/%s.main.asasm' % (abc_path, abc_path)]) 50 | subprocess.check_call(['tool/abcreplace.exe', '%s' % SWF_NAME, '0', '%s/%s.main.abc' % (abc_path, abc_path)]) 51 | except: 52 | print 'Patch failed!' 53 | return False 54 | if os.path.isfile('%s/Zombie.class.asasm.orig' % abc_path): 55 | print 'Patch succeeded!' 56 | remove_files(abc_path) 57 | return True 58 | else: 59 | print 'Patch failed!' 60 | return False 61 | 62 | 63 | def history(swf_url): 64 | his_swf = re.split("\r|\n", open(HISTORY).read()) if os.path.isfile(HISTORY) else [] 65 | if swf_url not in his_swf: 66 | open(HISTORY, 'a').write(swf_url + "\n") 67 | 68 | 69 | def remove_files(abc_path): 70 | try: 71 | os.remove('%s.abc' % abc_path) 72 | shutil.rmtree(abc_path) 73 | except: 74 | pass 75 | 76 | 77 | def run_server(): 78 | #Read flash, put into HTTP response data 79 | swf_content = ''' 80 | HTTP/1.x 200 ok 81 | Content-Type: application/x-shockwave-flash 82 | 83 | ''' 84 | swf_content += open(SWF_NAME, 'rb').read() 85 | 86 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 87 | sock.bind((HOST, PORT)) 88 | sock.listen(100) 89 | 90 | print "Serving HTTP on", HOST, "port", PORT, "..." 91 | 92 | while True: 93 | conn, addr = sock.accept() 94 | request = conn.recv(1024) 95 | try: 96 | method = request.split()[0] 97 | src = request.split()[1] 98 | except: 99 | pass 100 | if method == 'GET': 101 | if src == '/%s' % SWF_NAME: 102 | content = swf_content 103 | else: 104 | content = "Hello World!" 105 | elif method == 'POST': 106 | form = request.split('\r\n') 107 | entry = form[-1] 108 | content = entry 109 | if len(entry) == 32: 110 | print "the enc key is: %s" % entry 111 | os._exit(0) 112 | else: 113 | continue 114 | conn.sendall(content) 115 | conn.close() 116 | 117 | 118 | if __name__ == '__main__': 119 | swf = download_swf() 120 | patch = patch_swf() if swf else False 121 | if patch: run_server() -------------------------------------------------------------------------------- /tool/abcexport.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/abcexport.exe -------------------------------------------------------------------------------- /tool/abcreplace.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/abcreplace.exe -------------------------------------------------------------------------------- /tool/asasm.patch: -------------------------------------------------------------------------------- 1 | --- Zombie.class.asasm.old 2015-09-23 23:07:38.877262083 +0800 2 | +++ Zombie.class.asasm 2015-09-23 23:08:05.883929652 +0800 3 | @@ -1046,7 +1046,29 @@ 4 | callproperty QName(PackageNamespace("flash.utils"), "getTimer"), 0 5 | convert_u 6 | setslot 34 7 | 8 | + findpropstrict QName(PackageNamespace("flash.net"),"URLRequest") 9 | + pushstring "http://127.0.0.1:8036" 10 | + constructprop QName(PackageNamespace("flash.net"),"URLRequest"), 1 11 | + coerce QName(PackageNamespace("flash.net"),"URLRequest") 12 | + setlocal 1 13 | + getlocal 1 14 | + getscopeobject 1 15 | + getslot 17 16 | + pushstring "" 17 | + callproperty QName(Namespace("http://adobe.com/AS3/2006/builtin"), "join"), 1 18 | + setproperty QName(PackageNamespace(""),"data") 19 | + getlocal 1 20 | + pushstring "POST" 21 | + setproperty QName(PackageNamespace(""),"method") 22 | + findpropstrict QName(PackageNamespace("flash.net"),"URLLoader") 23 | + constructprop QName(PackageNamespace("flash.net"),"URLLoader"), 0 24 | + coerce QName(PackageNamespace("flash.net"),"URLLoader") 25 | + setlocal 2 26 | + getlocal 2 27 | + getlocal 1 28 | + callpropvoid QName(PackageNamespace(""),"load"), 1 29 | + 30 | getscopeobject 1 31 | getslot 2 32 | getglobalscope 33 | -------------------------------------------------------------------------------- /tool/liblzma.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/liblzma.dll -------------------------------------------------------------------------------- /tool/patch.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/patch.exe -------------------------------------------------------------------------------- /tool/python27.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/python27.dll -------------------------------------------------------------------------------- /tool/python27.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/python27.exe -------------------------------------------------------------------------------- /tool/python27.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/python27.zip -------------------------------------------------------------------------------- /tool/rabcasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/rabcasm.exe -------------------------------------------------------------------------------- /tool/rabcdasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyuanmu/hack-iqiyi/f9b28aa4fe55d47a760affbe0bce46f1ed348180/tool/rabcdasm.exe --------------------------------------------------------------------------------