要玩坏啦~用图床传视频

有MJJ突发奇想发现图床可以这么用~了解一点m3u8的同学会知道,一大段视频是由很多个小段 .ts文件组成的,那摩如果某个图床接口没能正确过滤文件格式仅是以后缀判断的话,这事情就好办了,你可以将大视频切片成ts——伪装成jpg图片——通过接口上传——包装成M3u8 就可以成功完成整个步骤啦~

粘帖了某大佬写的php代码,完整使用步骤请参考大佬原文 视频完美切片存储方案 附自动化处理脚本

<?php $v_path = $argv[1]; //切片路径 $v_name = $argv[2]; //带切片的视频路径名称 $s = 5; //切片秒 ts 切片必须小于 5MB if (empty($v_path) || empty($v_name)) { echo "请填写完整参数"; exit; } if ($v_path == '/' || $v_path == '\') { $v_path = ''; } else { mkFolder($v_path); $v_path = $v_path . "/"; } //这是 FFmpeg 处理命令大家自行更改 exec("ffmpeg -i $v_name -c copy -map 0 -f segment -segment_list " . $v_path . "playlist.m3u8 -segment_time $s " . $v_path . "player%03d.ts"); $m = file_get_contents('./' . $v_path . 'playlist.m3u8'); preg_match_all('/player(.*?).ts/', $m, $arr); foreach ($arr[1] as $key => $value) {
	echo "处理第" . $value . '个切片' . "n";
	$ali = upload('./' . $v_path . 'player' . $value . '.ts');
	$m = str_replace('player' . $value . '.ts', $ali, $m);
	file_put_contents('./' . $v_path . 'play.m3u8', $m);
}
 
echo "处理完毕" . "n";
echo "播放链接为:/" . $v_path . 'play.m3u8';
 
function upload($file) {
	$post['file'] = file_path($file);
	$post['scene'] = 'aeMessageCenterV2ImageRule';
	$post['name'] = 'player.jpg';
	$rel = get_curl('https://kfupload.alibaba.com/mupload', $post, 'iAliexpress/6.22.1 (iPhone; iOS 12.1.2; Scale/2.00)');
	$rel = json_decode($rel, true);
 
	return $rel['url'];
}
 
function get_curl($url, $post = 0, $ua = 0) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	// 不验证证书
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
	// 最大执行时间
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
	curl_setopt($ch, CURLOPT_TIMEOUT, 120);
	$httpheader[] = "Accept:application/json";
	$httpheader[] = "Accept-Encoding:gzip,deflate,sdch";
	$httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";
	$httpheader[] = "Connection:close";
	$ip = mt_rand(48, 140) . "." . mt_rand(10, 240) . "." . mt_rand(10, 240) . "." . mt_rand(10, 240); //随机 ip
	$httpheader[] = 'CLIENT-IP:' . $ip;
	$httpheader[] = 'X-FORWARDED-FOR:' . $ip;
	curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
	if ($post) {
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
	}
 
	if ($ua) {
		curl_setopt($ch, CURLOPT_USERAGENT, $ua);
	} else {
		curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0");
	}
	curl_setopt($ch, CURLOPT_ENCODING, "gzip");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$ret = curl_exec($ch);
	curl_close($ch);
	return $ret;
}
function mkFolder($path) {
	if (!is_readable($path)) {
		is_file($path) or mkdir($path, 0700);
	}
}
function file_path($file) {
	if (class_exists('CURLFile')) {
		return $post['file'] = new CURLFile(realpath($file));
	} else {
		return $post['file'] = '@' . realpath($file);
	}
}

更新,又有大佬分.py版本,看来被玩坏已是板上钉钉了 链接点这里

#!/usr/bin/python3
# -*- coding: UTF-8 -*-
 
import requests, os
from urllib3 import encode_multipart_formdata
from concurrent.futures import ThreadPoolExecutor, as_completed
 
def m_upload(filename):
    fakename = os.path.splitext(filename)[0] + '.jpg'
    payload = {'scene':'aeMessageCenterV2ImageRule', 'name':fakename, 'file': (fakename,open(filename,'rb').read())}
    encode_data = encode_multipart_formdata(payload)
    data = encode_data[0]
    headers['Content-Type'] = encode_data[1]
    for _ in range(3):
        try:
            r = requests.post(url, headers=headers, data=data, timeout = 20)
        except:
            print('Failed to upload ' + filename)
            continue
        if r and 'url' in r.text:
            print(filename + " upload")
            return r.json()['url']
        else:
            print('Failed to upload ' + filename)
    return filename + ' ERROR'
 
if __name__ == '__main__':
    for file in os.listdir():
        if '.m3u8' in file:
            m3u8 = open(file)
            break
    new_m3u8 = open('output.m3u8', 'w')
    headers = {'user-agent':'iAliexpress/6.22.1 (iPhone; iOS 12.1.2; Scale/2.00)', 'Accept':'application/json', 'Accept-Encoding':'gzip,deflate,sdch', 'Connection':'close'}
    url = 'https://kfupload.alibaba.com/mupload'
    file_upload = {t.strip():'' for t in m3u8.readlines() if t[0]!='#'}
    m3u8.seek(0)
    executor = ThreadPoolExecutor(max_workers=8)
    futures = {executor.submit(m_upload, filename):filename for filename in file_upload.keys()}
    for future in as_completed(futures):
        file_upload[futures[future]] = future.result()
    for line in m3u8:
        if line[0] != '#':
            new_m3u8.write(file_upload[line.strip()] + 'n')
        else:
            new_m3u8.write(line)
    print("Complete")

题外话,自从大佬公开了滥用步骤,小破站真的该准备迁移全站图片到其他图床了。。。MMP

 
         

给Linux VPS折腾上totp(两步验证)用于登录验证

之前提到过使用密钥登录SSH,这种方式禁用了密码,安全性上是没问题的。。。除非,你的私钥也泄露啦~不怕,为了应对这种极端情况,我们不妨弄个2FA组成“多重...

用Telegram 搭建图床?这个可以有

万物皆可图床!今天来介绍用利用Telegram搭建网盘的开源项目:tgfilestream 。我这里用的是fork版,这里推荐使用这个或者这个。这里推荐“TG-Files-to-Link”这...

推荐几个2020年可用的免费SSL证书

推荐几个2020年可用的免费ssl证书,现在给网站上小绿锁是大势所趋,SSL证书一般价格都不菲,如果非特殊需求用免费的SSL证书就够用了~ 亚洲诚信一年域名 网...

自建密码管理器:强烈推荐bitwarden_rs

今天推荐个密码管理程序bitwarden的第三方版bitwarden_rs,是时候抛弃chrome自带的密码管理啦~要问我为什么转投bitwarden的怀抱?其实很简单,chrome浏览器自...

吃螃蟹~试着在debian上使用xanmod内核,

听说升级linux内核会有安全和性能上的加成,目前小鸡用的是Linux version 4.9.0-12-amd64内核,本着“吃螃蟹”的态度,今天试试更新到5.6.14版本的内核,看看有...

测试-【フィクサー】呪術廻戦【MAD】

转载自Youtube,看起来播放速度还不错~ 这个MAD制作真的很精良,结合字幕来看,歌词莫名和漫画剧情很搭233.另外说下,呪術廻戦 已经在TV筹划中啦,喜欢的可惜...