站点地址
视频教程
相关代码
Python代码
# -*- coding: utf-8 -*-
# @Author: Null119 微信公众号/网站:治廷君
# @Desc: { 饭团影视解析 }
# @Date: { 2022/9/16 }
import requests,re,json
import base64
from Crypto.Cipher import AES
class Aes:
def __init__(self, block_size=16):
"""
:param block_size: 填充的块大小,默认为16,有些是8
"""
self.__block_size = block_size
self.__modes = {
'CBC': AES.MODE_CBC,
'ECB': AES.MODE_ECB
}
self.__padding_s = {
'pkcs7': self.__pkcs7padding,
'pkcs5': self.__pkcs5padding,
'zero': self.__zeropadding,
}
def __pkcs7padding(self, plaintext):
"""
明文使用PKCS7填充
:param plaintext: 明文
"""
block_size = self.__block_size
text_length = len(plaintext)
bytes_length = len(plaintext.encode('utf-8'))
len_plaintext = text_length if (bytes_length == text_length) else bytes_length
return plaintext + chr(block_size - len_plaintext % block_size) * (block_size - len_plaintext % block_size)
def __pkcs5padding(self, plaintext):
"""
PKCS5Padding 的填充
:param plaintext: 明文
"""
block_size = self.__block_size
text_length = len(plaintext)
bytes_length = len(plaintext.encode('utf-8'))
len_plaintext = text_length if (bytes_length == text_length) else bytes_length
return plaintext + chr(block_size - len_plaintext % block_size) * (block_size - len_plaintext % block_size)
def __zeropadding(self, plaintext):
"""
zeropadding 的填充
:param plaintext: 明文
"""
block_size = self.__block_size
text_length = len(plaintext)
bytes_length = len(plaintext.encode('utf-8'))
len_plaintext = text_length if (bytes_length == text_length) else bytes_length
return plaintext + chr(0) * (block_size - len_plaintext % block_size)
@staticmethod
def __unpad(plaintext):
pad_ = ord(plaintext[-1])
return plaintext[:-pad_]
def aes_encrypt(self, padding: str, plaintext: str, key: str, mode: str, iv=None, *args):
"""
:param padding: 填充方式,
:param plaintext: 明文
:param key:
:param mode:
:param iv:
:param args: 跟AES.new 的参数一样
:return:
"""
key = key.encode('utf-8')
iv = iv.encode('utf-8')
if mode == 'ECB':
aes = AES.new(key, self.__modes[mode], *args)
else:
aes = AES.new(key, self.__modes[mode], iv, *args)
content_padding = self.__padding_s[padding](plaintext) # 处理明文, 填充方式
encrypt_bytes = aes.encrypt(content_padding.encode('utf-8')) # 加密
return str(base64.b64encode(encrypt_bytes), encoding='utf-8') # 重新编码
def aes_decrypt(self, padding: str, ciphertext: str, key: str, mode: str, iv=None, *args):
key = key.encode('utf-8')
iv = iv.encode('utf-8')
if mode == 'ECB':
aes = AES.new(key, self.__modes[mode], *args)
else:
aes = AES.new(key, self.__modes[mode], iv, *args)
ciphertext = base64.b64decode(ciphertext)
plaintext = aes.decrypt(ciphertext).decode('utf-8')
if padding == 'zero':
return plaintext
return self.__unpad(plaintext)
def get_video(url):
resp=requests.get(url,verify=False).text
url=re.search(r'player_aaaa=(\{.*?\})<',resp).group(1)
rjson=json.loads(url)
nurl=rjson['url']
id=rjson['id']
sid=rjson['sid']
nid=rjson['nid']
headers = {
'Referer': 'https://www.fantuanhd.com/'
}
url=f'https://dp.1010dy.cc/?url={nurl}&next=&id={id}&nid={nid}&from=uploadixigua'
resp=requests.get(url,headers=headers,verify=False).text
urls=re.search(r'urls = "(.*?)"',resp).group(1)
key='Of84ff0clf252cba'
iv='c487ebl2e38a0faO'
a = Aes(block_size=16)
deurl = a.aes_decrypt('zero', urls, key, 'CBC', iv)
print('视频地址:',deurl)
if __name__ == '__main__':
url='https://www.fantuanhd.com/play/id-6268-1-1.html'
get_video(url)
V5字符串还原
const fs=require('fs')
const esprima=require('esprima')
const estraverse=require('estraverse')
const escodegen=require('escodegen')
const iconv=require('iconv-lite')
var content=fs.readFileSync('./en.js',{encoding:'binary'});
var buf=new Buffer.from(content,'binary')
var code=iconv.decode(buf,'utf-8')
var ast=esprima.parse(code)
//大数组+解密function(直接从混淆JS里复制就行了)
//大数组+解密function结束
ast=estraverse.replace(ast,{
enter:function(node,parent){
if(node.type=='CallExpression' &&
node.callee.name=='_0x4c0f' && //解密function
node.arguments.length==2){
var val=_0x4c0f(node.arguments[0].value,node.arguments[1].value); //调用执行解密函数还原字符串
return{
type:esprima.Syntax.Literal,
value:val,
raw:val
}
}
}
})
code=escodegen.generate(ast)
console.log('完成.')
fs.writeFile("./de.js",code,(err)=>{})
本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习使用,请在下载后24小时内删除,严禁商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
【注意:本站发布资源来源于网络搜集,均有较强时效性,请在下载前注意查看文章资源发布或更新时间,距离当前时间太久的资源不建议下载,特别是安卓专区相关资源,会有大概率失效无法使用】
评论(0)