天脉的源是比较有名名气的,由于有诸多限制一般人也玩不动,只能看大佬们嗮天脉源的图。
以下是超级看、超级直播大佬分享的天脉token的算法,懂的人自然会用。
<?php //ANONYMOUS("N","ANONYMOUS","匿名"), //STB("O","STB","运营版机顶盒"), //GESTB("Q","GESTB","通用版机顶盒"), //MT("R","MT","移动应用"), //WEIXIN("K","WEIXIN","微信应用"), //WEB("V","WEB","网页应用"), //PLUGIN("P","PLUGIN","插件应用"), //SHOW_MANAGE("L","SHOW_MANAGE","秀场管理"); function currentTimeMillis() { list($t1, $t2) = explode(' ', microtime()); return (float)sprintf('%.0f',(floatval($t1)+floatval($t2))*1000); } function base64UrlEncode($input){ return str_replace('=', '', strtr(base64_encode($input), '+/', '-_')); } function base64UrlDecode($input){ $remainder = strlen($input) % 4; if ($remainder) { $addlen = 4 - $remainder; $input .= str_repeat('=', $addlen); } return base64_decode(strtr($input, '-_', '+/')); } function getRandomString($length){ $tostr = ""; $pattern = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ"; $n = strlen($pattern); for($i=0;$i< $length;$i++) { $tostr .= $pattern{mt_rand(0, $n - 1)}; } return $tostr; } function pareNToken($acc_token){ $resp = array(); $clientIp = ""; $CODE_MAP = array(); $acinfo = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,-,_,@,."; $CODE_ARRAY = explode(",", $acinfo); for($i=0;$i < count($CODE_ARRAY);$i++){ $CODE_MAP[$CODE_ARRAY[$i]] = $i; } $s = base64UrlDecode($acc_token); $code = substr($s, 0, 1); $token = substr($s, 1); $token_lenth = strlen($token); $accountLength = intval(substr($token, 0, 2)); $encryptAccount = substr($token, 2, 2 + $accountLength); $keys = substr($token, $token_lenth - $accountLength); $version_tm = substr($token, $token_lenth - 13); $encryptLoginIp = substr($token, 2 + $accountLength, -13); for ($i = 0; $i < strlen($encryptLoginIp); $i++) { if (is_numeric($encryptLoginIp[$i])) { $clientIp .= $encryptLoginIp[$i]; } else { $clientIp .= "."; } } $accountStr = ""; for ($i = 0; $i < strlen($encryptAccount); $i++) { $a = $encryptAccount[$i]; if (isset($CODE_MAP[$a]) && isset($keys[$i]) && isset($CODE_MAP[$keys[$i]])){ $aIndex = $CODE_MAP[$a]; $keyValue = $CODE_MAP[$keys[$i]]; $bIndex = $aIndex + $keyValue; if($bIndex >= count($CODE_MAP)){ $bIndex = $bIndex - count($CODE_MAP); } $accountStr .= $CODE_ARRAY[$bIndex]; } else { $accountStr .= $a; } } $softwareVersion = substr($accountStr, strrpos($accountStr, "@") + 1); $accountStr = substr($accountStr, 0, strrpos($accountStr, "@")); $softwareCode = substr($accountStr, strrpos($accountStr, "@") + 1); $accountStr = substr($accountStr, 0, strrpos($accountStr, "@")); $resp['client_ip'] = $clientIp; $resp['version'] = $version_tm; $resp['account'] = $accountStr; $resp['software_code'] = $softwareCode; $resp['software_version'] = $softwareVersion; $resp['token'] = $acc_token; return $resp; } function getNToken($clientIp = "127.0.0.1", $account = "132020005012", $softwareCode = "SUNTV", $softwareVersion = "0.4.89", $prefix = "O"){ $ipbuf = array(); $CODE_MAP = array(); $acinfo = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,-,_,@,."; $CODE_ARRAY = explode(",", $acinfo); for($i=0;$i < count($CODE_ARRAY);$i++){ $CODE_MAP[$CODE_ARRAY[$i]] = $i; } $accountStr = $account."@".$softwareCode."@".$softwareVersion; for($i=0;$i < strlen($clientIp);$i++){ if ("." == $clientIp[$i]){ $ipbuf[]= chr(rand(97, 122)); } else { $ipbuf[] = $clientIp[$i]; } } $tm = currentTimeMillis(); $clientIp = join("", $ipbuf); $suffix = $clientIp.$tm; $accountLength = strlen($accountStr); if($accountLength > strlen($suffix)){ $cLength = $accountLength - strlen($suffix); $suffix = getRandomString($cLength) . $suffix; } $tokenbuf = ""; if($accountLength < 10){ $tokenbuf = $prefix."0".$accountLength; } else { $tokenbuf = $prefix.$accountLength; } $keys = substr($suffix, strlen($suffix) - $accountLength); for ($i = 0; $i < strlen($accountStr); $i++) { $a = $accountStr[$i]; if (isset($CODE_MAP[$a]) && isset($keys[$i]) && isset($CODE_MAP[$keys[$i]])){ $aIndex = $CODE_MAP[$a]; $keyValue = $CODE_MAP[$keys[$i]]; $bIndex = 0; if($aIndex >= $keyValue){ $bIndex = $aIndex - $keyValue; } else { $bIndex = count($CODE_ARRAY) + $aIndex - $keyValue; } $tokenbuf .= $CODE_ARRAY[$bIndex]; } else { $tokenbuf .= $a; } } $tokenbuf .= $suffix; return base64UrlEncode($tokenbuf); } $uidlist = ["142029001763","142029001915","142029001916","142029001976"]; $rand_keys = array_rand($uidlist); $access_token = getNToken(userip(), $uidlist[$rand_keys]); $stype = empty($_GET['type']) ? "ipsd" : trim($_GET['type']); $strUrl = sprintf("access_token=%s", $access_token);
此开源代码著作权归业界知名大佬 @龙共山高 所有。
用是用成功乐,但是好像生成之后也播放不了,不知道是不是内置得那4个账号给封了。
http://ttzx.tv/tvm.php?channel=
到底怎么用啊 这个现成的也不好使
“谁也不是一下生就会”
博客第二篇广告成功骗到我,牛。
要的就是这个效果 不过这个还是有明显区别的,感谢大佬的两毛钱。
看不懂啊,请指教!
显示以下错信息:
Fatal error: Call to undefined function userip() in /www/wwwroot/www.6sv.net/tvm.php on line 144
+1 同样的问题
Windows 8.1 x86???我是64位操作系统
根据我电脑上的访问情况改的,缺少更多样本 ..
老大的广告中阿里云一打开是404页面,应该是活动结束了。
啊啊啊,感谢反馈。
可以介绍一下怎么用吗?