//index.php
<?php
//xsm
$access_token = "001089f380e71c5c8e41ee643c3308210e3699e5ae0d964a3979642adb84e905dd2198348c3a458374a804af97a569ea89d";
$user_id = 39232238528814;
//6s 173
$access_token = "00511821f3abe90df8c37e3c5faf4a247bc67425cdddbe469dda64d3cc5e2e90655d107c5e3d2890ca86e695a802b0cbbe4a";
$user_id = 2220662327882958;
//lanlan
// $access_token = "002f4f82e164308ba90912d5f54d9b848dd6831671617f7abcbd9933d2a002d16121da9692a7512fe626d26c55e9d92af6a";
// $user_id = 3051899993732648;
require_once "aaaafeiliaoCode.php";
$money = isset($_REQUEST["money"]) ? $_REQUEST["money"] : "0.03"; //money
$greetings = isset($_REQUEST["greetings"]) ? $_REQUEST["greetings"] : "恭喜发财"; //greetings
$cmd = isset($_REQUEST["cmd"]) ? $_REQUEST["cmd"] : ""; //cmd
$jm = isset($_REQUEST["jm"]) ? $_REQUEST["jm"] : ""; //cmd
if($cmd == "send"){
$retPayurl = sendHongBao($money,$greetings);
// if($retPayurl == "110"){
// createQun(); //创建群聊
// echo sendHongBao($money,$greetings);
// return;
// }else if($retPayurl == "112"){
// echo "群nil";
// return;
// }
echo $retPayurl;
exit();
}elseif ($cmd."" == "mi") {
$s1 = isset($_REQUEST["s1"]) ? $_REQUEST["s1"] : "0"; //money
$s2 = isset($_REQUEST["s2"]) ? $_REQUEST["s2"] : "0"; //money
$hes1=getSunHexFL($s1);
$hes2=getSunHexFL($s2);
//10 CB89E0E8A3F59D01 10 B795E09D93F5C903
//echo getSunHexFL(strlen($hes1)) . $hes1 . getSunHexFL(strlen($hes2)) . $hes2;
echo "10". $hes1 . "10" . $hes2;
exit();
}elseif($jm){
echo getSunHexFLtest($jm);
exit();
}
echo "用户ID:".getUserInfo();//获取用户信息
//--------------------------------------------------------------
// $testText = "黑凤梨哟";
// echo "<br>$testText=" . strToHex($testText);
echo "<br><br><br><br><br>";
// $testText = "恭喜发财001";
// echo "<br>$testText=" . strToHex($testText);
// $testText = "@@@2";
// echo "<br>$testText=" . strToHex($testText);
//--------------------------------------------------------------
// $meo = 2220662327882958;//CEE9E0E9E3F5F803
// $meo = 1394;//F20A
// $meo = 10987756316354;//C2CDBFCAE4BF02
// $meo = 6844872656039215117;//8D8082E0A3EDF7FE5E
// $meo = 6844872090110230535;//
// echo "<br>$meo=" . getSunHexFL($meo);
// $meo = 6844879773898900494;//
// echo "<br>$meo=" . getSunHexFL($meo);
$testText = "0800100018F403224870726F746F3A20437265617465436F6E766572736174696F6E563252657175657374426F64793A20776972657479706520656E642067726F757020666F72206E6F6E2D67726F757028003A2232303230303731393034353834353031303031323036343031363145323846374142";
echo "<br>$testText=".strToHex($testText);
echo "<br><br><br>$testText=<br>".hexToStr($testText)."<br><br><br>";
//6840074047997346308
echo "<br>6840074047997346308=848480E2B3E3B4F65E";
$meo = 6831298491650671112;//
echo "<br>$meo=" . getSunHexFLtest($meo);
echo "<br>$meo /2=" . $meo/2;
$meo = 2013932507630263;//
echo "<br>$meo=" . getSunHexFL($meo);
$meo = 29791246783135;//
echo "<br>$meo=" . getSunHexFL($meo);
$hexSun ="80897A";//CC08 =1100 A09C01=20000
echo "<br>$hexSun=" . HexSunToint($hexSun);
//--------------------------------------------------------------
//json_encode( $string) === 'null'来判断。如果字符串中含有乱码,json_encode该字符串就会返回null。
$string = "恭喜发财0.7465867846369284";
// $string ="柶翳介";
echo "<br>是否中文=$string=" . (json_encode($string)?"正常文字": 'null');
// echo "<br>";
// echo strToUpper(dechex($meo));
// echo "<br>";
// getHongBaoOpen("6844903803192508424","6844618312828060430");
get_by_favorite(true);//获取群聊 是否打印日志
getHongBaoList(true);//获取红包列表 是否自动打开红包
// getHongBaoinfo("6844759957733277703");
// createQun(); //创建群聊
//--------------------------------------------------------------
// echo strlen("别别别别别别别别别别别别别别别");return;一个汉 占3
// echo bin2hex(200);
// echo "<br>" . strToUpper(dechex(45));return;
// $Hex = substrText($payMsg,"010A13","10021A");
// $str = hexToStr($Hex);
// $Hex = strToHex("6844466753532068621");
//数值到十六进制
function getSunHexFLtest($meo) {
//小于128的直接返回
if($meo < 128) {
$meoHex = strToUpper(dechex($meo));
if(strlen($meoHex) == 1) {
$meoHex = "0" . $meoHex;
}
return $meoHex;
}
//====================
$jc=0;
$tpHex = "";
$ssss = $meo;
while ($ssss > 127) {
$jc++;
// 循环条件为 如:true 执行
$s1 = ($ssss % 128) + 128;
// 一位 余数
$s2 = intval( $ssss / 128);
// 二位 倍数 倍数*128 + 余数
if($jc == 2){
$s1 = $s1 - 4;
}
//echo "<br>" . $s1 . "_" . $s2 . "<br>";
$s1meoHex = strToUpper(dechex($s1));
$s2meoHex = strToUpper(dechex($s2));
if(strlen($s2meoHex) == 1) {
$s2meoHex = "0" . $s2meoHex;
}
$ssss = $s2;
if($s2 > 127) {
$tpHex = $tpHex . $s1meoHex;
} else {
$tpHex = $tpHex . $s1meoHex . $s2meoHex;
}
}
return $tpHex;
}
function HexSunToint($hex){
$sun = strlen($hex);
if($sun>=$sun){
// echo
}
$hexTP = $hex;
$wei = 0;
$zhj = 0;
for ($i=0; $i < strlen($hexTP)-1; $i+=2){
$tpjz = substr($hexTP, -2-$i,2); // EE
$sss = hexdec($tpjz);//56
if($i == "0"){
$i+=2;
$tpjz2 = substr($hexTP, -2-$i,2); // EE
$sss2 = hexdec($tpjz2);//56
if($sss2 > 127){
$ys = $sss2-128;
}
$wei = ($sss * 128) -128+$ys;
echo "<br>---s-----He=".$tpjz .",tr2=$tpjz2 ys=$ys int=($sss -1) x 128=$wei ----<br>";
}else if( $i+2 < strlen($hexTP) ){
$zhj =$zhj + ($sss * 128) - 128;
echo "<br>---z-----He=".$tpjz ." int=$sss x128=$zhj ----<br>";
}else{
$ttt = $zhj;
$zhj =$zhj +$sss;
echo "<br>---n-----He=".$tpjz ." int=$sss + $ttt=$zhj ----<br>";
}
$cdd = ($sss * 128) - 128;
}
echo $wei==0?0:$wei;
echo "<br>(".($zhj+$wei).")<br>";
//dechex
// echo hexdec("CC");
}
?>
//aaaafeiliaoCode.php
<?php
$fileName = "FaiLaoiog/";//文件名称
//十六进制到数值
function HexSunToints($hex){
$sun = strlen($hex);
if(2>=$sun){
return hexdec($hex);
}
$hexTP = $hex;
$wei = 0;
$zhj = 0;
for ($i=0; $i < strlen($hexTP)-1; $i+=2){
$tpjz = substr($hexTP, -2-$i,2); // EE
$sss = hexdec($tpjz);//56
if($i == "0"){
$wei = ($sss * 128) - 128;
// echo "<br>---s-----He=".$tpjz ." int=($sss -1) x 128=$wei ----<br>";
}else if( $i+2 < strlen($hexTP) ){
$zhj =$zhj + ($sss * 128) - 128;
// echo "<br>---z-----He=".$tpjz ." int=$sss x128=$zhj ----<br>";
}else{
$ttt = $zhj;
$zhj =$zhj +$sss;
// echo "<br>---n-----He=".$tpjz ." int=$sss + $ttt=$zhj ----<br>";
}
// $cdd = ($sss * 128) - 128;
}
// echo $wei==0?0:$wei;
// echo "<br>(".($zhj+$wei).")<br>";
return ($zhj+$wei);
//dechex
// echo hexdec("CC");
}
//数值到十六进制
function getSunHexFL($meo){
//小于128的直接返回
if($meo < 128){
$meoHex = strToUpper(dechex($meo));
if(strlen($meoHex) == 1){
$meoHex= "0" . $meoHex;
}
return $meoHex;
}
// $meo = 2220662327882958;
// $meo = 1349;
$tpHex = "";
// do{
// }while($meo <= 10);// 先循环一次,在循环条件为 如:true 执行
$ssss = $meo;
while ($ssss > 127) {// 循环条件为 如:true 执行
$s1 = ($ssss % 128) + 128; // 一位 余数
$s2 = intval( $ssss / 128);// 二位 倍数 倍数*128 + 余数
$s1meoHex = strToUpper(dechex($s1));
$s2meoHex = strToUpper(dechex($s2));
if(strlen($s2meoHex) == 1){
$s2meoHex = "0" . $s2meoHex;
}
$ssss = $s2;
if($s2 > 127){
$tpHex = $tpHex . $s1meoHex;
}else{
$tpHex = $tpHex . $s1meoHex . $s2meoHex;
}
}
return $tpHex;
}
//发送红包
function sendHongBao($money,$greetings){
$money=$money?$money:"0.01";
$meo = $money * 100;
if($meo <2){
$meo = 2;
}
$order = $greetings?$greetings:getRandomStr(55);//备注
global $fileName;
//获取-群聊ID
$arrqun_id = get_by_favorite();
if(!$arrqun_id){
return "群 nil";
}
//随机-群聊
$qunid = $arrqun_id[array_rand($arrqun_id, 1)];
//加密-备注长度
$desclengHex = getSunHexFL(strlen($order));
//加密-金额
$meoHex = getSunHexFL($meo);
//十六进制-备注
$descHex = strToHex($order);
//十六进制-群号
$qunidHex = strToHex($qunid);
//红包类型 03=手气,02=普通 [ 金额 * 个数 = 普通总金额 ]
$hb_type = "03";
//红包个数 十六进制
$hb_coun = "01";
if($meo == "2"){
$hb_coun = "02";
}
//----------------金额-------------个数--------长度13=19----群ID--------------备注长度------ 备注-----------------------06群昵称长度--群聊*3
$HexMai = "08" . $meoHex . "10" . $hb_coun . "1A13" . $qunidHex . "22" . $desclengHex . $descHex . "28" . $hb_type . "3206E7BEA4E8818A";
$str = hexToStr($HexMai);
$url = "https://rocket.snssdk.com/rp/normal/send/v1/?version_code=1.7.8&app_name=flipchat&vid=asd1F3-7BC1-41F2-A134-asdsad&device_id=70asdsa5526&channel=App%20Store&resolution=1242*2688&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=asdasdasd4a1501287d0c5f74657149399fe4&update_version_code=17802&install_id=asdasd83551842317&idfv=asdasd-7BC1-41F2-A134-DF0E37501111&ac=WIFI&os_version=12.3.1&device_platform=iphone&update_version_name=17802&iid=2asdasd551842317&device_type=iPhone%20XS%20Max&idfa=asdasd-9628-44D0-8491-FD101C292057";
$payMsg = HttppostTx($url,$str);
$paydata = substrText($payMsg,"alipay_sdk=alipay","&version=1.0");
if(stripos($str, "暂停红包") > 0){
return "群聊不够";//行为异常,系统已暂停红包功能
}
if(stripos($str, "出群聊") > 0){
return "群聊退出";//出群聊,无法发送红包
}
return "alipay_sdk=alipay".$paydata . "&version=1.0";
}
//查询红包 发送记录list
function getHongBaoList($isOpenHB=false){
global $fileName;
$bas64 = "CAIoKA==";//{ 0x08, 0x02, 0x28, 0x28 };
$str = base64_decode($bas64);
// echo $str;
$url = "https://rocket.snssdk.com/rp/wallet/get/v1/?version_code=1.7.8&app_name=flipchat&vid=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&device_id=Fk5BNwkNtG6&channel=App%20Store&resolution=750*1334&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=a43784ce442284f5d9de6e87f271b92b5f4a0b84&update_version_code=17802&install_id=518624465917927&idfv=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&ac=WIFI&os_version=10.3.1&device_platform=iphone&update_version_name=17802&iid=518624465917927&device_type=iPhone%206S&idfa=898502F6-A012-4BB7-93BC-5B6F72B1A86D";
//========== 28=40
// $str = "08012828";//收到
// $str = "08022828";//发送
$strHex = "08022828";//发送
$str = hexToStr($strHex);
$reText = HttppostTx($url, $str);
// echo $reText;
$reTextHex = strToHex($reText);
// echo $reTextHex;
//byte[] arrOutput = { A2E58C85721F 单号 7A13 conver_id { 125B0803100138 };
$arr = explode("A2E58C85721F",$reTextHex);
$num = count($arr);
//byte[] arrOutput = { 0x12, 0x5B, 0x08, 0x03, 0x10 金额 38}; 获取金额
//$arrMoney = explode("125B080310",$reTextHex);
$arrMoney = explode("0310",$reTextHex);
$counMoney = count($arrMoney);
for($i=1;$i<$num;++$i){
$value = "xxxxxx" . $arr[$i];
$valueMoney = "xxxxxx" . $arrMoney[$i];
//金额截取
$je_tp = substr( $arrMoney[$i],0,8);
$endsun = 倒找文本($je_tp,"38");//得到下标
$je_He = substr($je_tp,0,$endsun);
if(strstr($je_He,"38")){
$endsun = 倒找文本($je_He,"38");//得到下标
$je_He = substr($je_tp,0,$endsun);
}
$je_Txt = HexSunToints($je_He);
$je_Txt = $je_Txt/100;
$je_Txt = sprintf("%.2f",$je_Txt);
// echo $valueMoney . "<br>";
// echo $je_tp . " = $endsun = $je_He <br>";
$cj_order_Hex = substrText($value,"xxxxxx", "7A13");
//-----003------------------------------------125B0803105838D
//-----002------------------------------------125B08031008389AABFBF7055
// $conve_id_Hex = substrText($value,"7A13", "125B0803100138");
// $conve_id_Hex = substrText($value,"7A13", "125B0803");
$conve_id_Hex = substrText($value,"7A13", "125B080310");
$conve_id_Hex = substrText($value,"7A13", "125");
// echo $value." <br>";//18D50E2
if(!$conve_id_Hex){
// echo $value." <br>";//18D50E2
//$conve_id_Hex = substrText($value,"7A13", "18D50E2");
$conve_id_Hex = substrText($value,"7A13", "18");
if(!$conve_id_Hex){
echo $value." <br>";//18D50E2
}
}
$cj_order_Tex = hexToStr($cj_order_Hex);
$conve_id_Tex = hexToStr($conve_id_Hex);
//6844872656039215117 =19
$rp_order_id = substr($cj_order_Tex, -19);
$rp_order_Hex= getSunHexFL($rp_order_id);
// $arrRet[] = $qTxt;
// echo "rp_order_id=".$rp_order_id." cj_order_Hex=".$cj_order_Tex ." conver_id=". $conve_id_Tex." Hex=".$rp_order_Hex." <br>";
if($isOpenHB == true){
if(getHongBaoOpen($rp_order_id, $conve_id_Tex) != "ok"){
//红包打开失败
// echo $value." <br>";
}
}
//获取红包备注
$desc = getHongBaoinfo($rp_order_id);
echo "rp_id=".$rp_order_id ." conver_id=". $conve_id_Tex." 备注=".$desc." 金额=$je_Txt<br>";
}
// print_r ($arr);
}
//打开红包
function getHongBaoOpen($hb_order,$conver_id=""){
global $fileName;
global $user_id;
$hb_order_flie = $fileName . $hb_order . "open";
if(!$conver_id || $conver_id == ""){
return "con nli";
}
if(file_exists($hb_order_flie)){
return "ok";
}
$hb_order_Hex = getSunHexFL($hb_order);
$user_id_Hex = getSunHexFL($user_id);
$conver_id_Hex = strToHex($conver_id);
$url = "https://rocket.snssdk.com/rp/normal/open/v1/?version_code=1.7.8&app_name=flipchat&vid=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&device_id=V6NFr7nUSSD&channel=App%20Store&resolution=750*1334&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=a43784ce442284f5d9de6e87f271b92b5f4a0b84&update_version_code=17802&install_id=518624465917927&idfv=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&ac=WIFI&os_version=10.3.1&device_platform=iphone&update_version_name=17802&iid=518624465917927&device_type=iPhone%206S&idfa=898502F6-A012-4BB7-93BC-5B6F72B1A86D";
// $url = "https://rocket.snssdk.com/rp/normal/open/v1/?version_code=1.7.8&app_name=flipchat&vid=5AF0B1F3-7BC1-41F2-A134-DF0E37501111&device_id=70838725526&channel=App%20Store&resolution=1242*2688&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=9ba42ba8cce44a1501287d0c5f74657149399fe4&update_version_code=17802&install_id=2400983551842317&idfv=5AF0B1F3-7BC1-41F2-A134-DF0E37501111&ac=WIFI&os_version=12.3.1&device_platform=iphone&update_version_name=17802&iid=2400983551842317&device_type=iPhone%20XS%20Max&idfa=6B369BA0-9628-44D0-8491-FD101C292057";
$url = "https://rocket.snssdk.com/rp/normal/open/v1/?version_code=1.7.8&app_name=flipchat&vid=5AF0B1F3-7BC1-41F2-A134-DF0E37501111&device_id=V6NFr7nUfeD&channel=App%20Store&resolution=1242*2688&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=9ba42ba8cce44a1501287d0c5f74657149399fe4&update_version_code=17802&install_id=518000000917927&idfv=5AF0B1F3-7BC1-41F2-A134-DF0E37501111&ac=WIFI&os_version=12.3.1&device_platform=iphone&update_version_name=17802&iid=2400983551842317&device_type=iPhone%20XS%20Max&idfa=6B369BA0-9628-44D0-8491-FD101C292057";
$device_id = getRandomStr(11);
$install_id = rand(111,999) . "000000" . rand(11111,99999);
$vid = getRandomStr(8) . "-" . getRandomStr(4) . "-" . getRandomStr(4) . "-" . getRandomStr(4) . "-" . getRandomStr(12);
$idfa = getRandomStr(8) . "-" . getRandomStr(4) . "-" . getRandomStr(4) . "-" . getRandomStr(4) . "-" . getRandomStr(12);
$idfv = getRandomStr(8) . "-" . getRandomStr(4) . "-" . getRandomStr(4) . "-" . getRandomStr(4) . "-" . getRandomStr(12);
$iid = getRandomStr(16);
$openudid = getRandomStr(40);
$url = "https://rocket.snssdk.com/rp/normal/open/v1/?version_code=1.7.7&app_name=flipchat&vid=$vid&device_id=$device_id&channel=App%20Store&resolution=1242*2688&aid=1394&app_id=1394&fl_update_version_name=1.7.7.01&openudid=$openudid&update_version_code=17802&install_id=$install_id&idfv=$idfv&ac=WIFI&os_version=12.3.1&device_platform=iphone&update_version_name=17802&iid=$iid&device_type=iPhone%20XS%20Max&idfa=$idfa";
//byte[] arrOutput = { 0x08, 0x87, 0x80, 0x86, 0xC0, 0xE7, 0xDC, 0xF7, 0xFE, 0x5E, 0x12, 0x13, 0x36, 0x38, 0x34, 0x34, 0x36, 0x31, 0x36, 0x31, 0x34, 0x39, 0x33, 0x30, 0x39, 0x35, 0x38, 0x38, 0x32, 0x33, 0x37, 0x1A, 0x04, 0x40, 0x40, 0x40, 0x32, 0x20, 0xCE, 0xE9, 0xE0, 0xE9, 0xE3, 0xF5, 0xF8, 0x03, 0x28, 0x8E, 0x88, 0x80, 0xEC, 0xB7, 0xBC, 0xF9, 0xFE, 0x5E };
//rp_order_id=6844872090110230535 conver_id=6844616149309588237 Hex=黑凤梨哟
//6844872090110230535=878086C0E7DCF7FE5E
//2220662327882958;//CEE9E0E9E3F5F803
//@@@2=40404032
//6844879773898900494=8E8880ECB7BCF9FE5E
$strHex = "0x08, 红包ID , 0x12, 0x13, conver_id , 0x1A, 0x04, 0x40, 0x40, 0x40, 0x32, 0x20, userid , 0x28, 0x8E, 0x88, 0x80, 0xEC, 0xB7, 0xBC, 0xF9, 0xFE, 0x5E";
//----------------红包号-----群id长度13---conver_id----------长度04------群昵称------------userid--------------------msgid
$strHex = "08" . $hb_order_Hex . "1213". $conver_id_Hex ."1A" . "04" . "40404040" . "20". $user_id_Hex . "28" . "8E8880ECB7BCF9FE5E";
$str = hexToStr($strHex);
// echo $reText;
$reText = HttppostTx($url, $str);
//Success
if(strpos($reText,"Success") > 0){
xdd_file($hb_order_flie,"ok");
return "ok";
}elseif (strpos($reText,"账户存在异常") > 0){
//账户存在异常,无法领取红包
echo "<br>账户存在异常,无法领取红包<br>" ;
}
else{
echo "<br>红包打开失败=$reText<br>" ;
}
return $reText;
}
//红包详细信息【二级】
function getHongBaoinfo($hb_order){
global $user_id;
global $fileName;
$hb_order_flie = $fileName.$hb_order;
$tempDesc = xdd_file($hb_order_flie);
if($tempDesc){
return $tempDesc;
}
$url = "https://rocket.snssdk.com/rp/normal/get/v1/?version_code=1.7.8&app_name=flipchat&vid=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&device_id=xG4KyPFw7s3&channel=App%20Store&resolution=750*1334&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=a43784ce442284f5d9de6e87f271b92b5f4a0b84&update_version_code=17802&install_id=518624465917927&idfv=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&ac=WIFI&os_version=10.3.1&device_platform=iphone&update_version_name=17802&iid=518624465917927&device_type=iPhone%206S&idfa=898502F6-A012-4BB7-93BC-5B6F72B1A86D";
$hb_order_Hex = getSunHexFL($hb_order);
$user_id_Hex = getSunHexFL($user_id);
//8D8082E0A3EDF7FE5E
//CEE9E0E9E3F5F803
//byte[] arrOutput = { 0x08, 0x02, 0x10, 0x8D, 0x80, 0x82, 0xE0, 0xA3, 0xED, 0xF7, 0xFE, 0x5E, 0x18, 0xCE, 0xE9, 0xE0, 0xE9, 0xE3, 0xF5, 0xF8, 0x03, 0x28, 0x64 };
$strHex = "0x08,(0x02 序号) 0x10, hb_order 0x18, user 0x2864";
$strHex = "080210" . $hb_order_Hex . "18" . $user_id_Hex . "2864";
$str = hexToStr($strHex);
$reText = HttppostTx($url, $str);
// echo $reText;
//E9BB91E587A4E6A2A8E5939F
$reText_Hex = strToHex($reText);
// $desc_Hex = substrText($reText_Hex,"520C", "58");
// $desc_Hex = substrText($reText_Hex,"F705520F","58" . $hb_order_Hex);
// $desc_Hex = substrText($reText_Hex,"05520F","58" . $hb_order_Hex);
$desc_Hex = substrText($reText_Hex, "52", "58" . $hb_order_Hex);
$jc = 0;
while(strlen($desc_Hex)>90){
$tp_reText_Hex = $desc_Hex . "58" . $hb_order_Hex;
$desc_Hex = substrText($tp_reText_Hex,"52", "58" . $hb_order_Hex);
$jc++;
if($jc > 10){
return "nil";
}
}
//取出后面位
$desc_Hex = substr($desc_Hex, - (strlen($desc_Hex)-2) );
$desc = hexToStr($desc_Hex);
//判断是否乱码
if(! json_encode($desc) ){
return $desc;
}
//写入缓存
xdd_file($hb_order_flie,$desc);
// echo "<br>desc_Hex是=".$desc_Hex . "<br>";
// echo "<br>备注是=".$desc . "<br>";
// echo "<br>hb_order_He是=".$hb_order_Hex . "<br>";
// echo "<br>reText_Hex是=".$reText_Hex . "<br>";
return $desc;
}
function xdd_file($filename,$text=""){
try {
if(!$text || $text == ""){
if(file_exists($filename)){
return file_get_contents($filename);
}
return "";
}else{
return file_put_contents($filename, $text);
}
} catch (Exception $e) {
// return $e;
}
}
//获取群聊arr
function get_by_favorite($isDBUG=false){
global $user_id;
$bas64 = "COMEELiK59z2uwIaDDAuNi4wLWJldGExMCgCOgwyMDE4MDkyNTE3NTZCA5omAEoLMzU4NjE4NzM4NjFSCUFwcCBTdG9yZVoGaXBob25lYglpUGhvbmUgNlNqBjEwLjMuMXIFMS43LjiCASQ1QURFQ0VGNy1FRUIwLTRGNEItQUY3OS1FN0FERDgxRTQ5OEaQAc7p4Onj9fgDmAHyCg==";
$bas64 = "COMEEMLNv8rkvwIaDDAuNi4wLWJldGExMCgCOgwyMDE4MDkyNTE3NTZCA5omAEoLMzU4NjE4NzM4NjFSCUFwcCBTdG9yZVoGaXBob25lYglpUGhvbmUgNlNqBjEwLjMuMXIFMS43LjiCASQ1ODZDRTA0Ny0zMzU1LTQ1RkMtQTQ5QS1GQjYyQ0UwOTYwNTKQAc7p4Onj9fgDmAHyCg==";
$str = base64_decode($bas64);
//echo strToHex($str);return;
$url = "https://rocket.snssdk.com/conversation/v2/get_by_favorite/?version_code=1.7.8&app_name=flipchat&vid=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&device_id=Q4lExJRFdXg&channel=App%20Store&resolution=750*1334&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=a43784ce442284f5d9de6e87f271b92b5f4a0b84&update_version_code=17802&install_id=518624465917927&idfv=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&ac=WIFI&os_version=10.3.1&device_platform=iphone&update_version_name=17802&iid=518624465917927&device_type=iPhone%206S&idfa=898502F6-A012-4BB7-93BC-5B6F72B1A86D";
//$meo = 2220662327882958;//CEE9E0E9E3F5F803//用户ID
// $meo = 1394;//F20A //版本
// $meo = 10987756316354;//C2CDBFCAE4BF02//请求ID
// $meo = 2220662327882958;//16
// $meo = 39232238528814;
$meo = $user_id;
$useridHex = getSunHexFL($meo);
$strHex = "08E30410C2CDBFCAE4BF021A0C302E362E302D62657461313028023A0C32303138303932353137353642039A26004A0B333538363138373338363152094170702053746F72655A066970686F6E6562096950686F6E652036536A0631302E332E317205312E372E3882012435383643453034372D333335352D343546432D413439412D4642363243453039363035329001CEE9E0E9E3F5F8039801F20A";
$strHex = "08E30410C2CDBFCAE4BF021A0C302E362E302D62657461313028023A0C32303138303932353137353642039A26004A0B333538363138373338363152094170702053746F72655A066970686F6E6562096950686F6E652036536A0631302E332E317205312E372E3882012435383643453034372D333335352D343546432D413439412D4642363243453039363035329001".$useridHex."9801F20A";
$str = hexToStr($strHex);
$reText = HttppostTx($url, $str);
$payMsgHex = strToHex($reText);
$arr = explode("020A13",$payMsgHex);
$arrRet;
//19 * 2 = 38
// foreach($arr as $value){
// $qHex = substr($value,0,38);
// $qTxt = hexToStr($qHex);
// echo $qTxt . " <br>";
// }
$num = count($arr);
for($i=1;$i<$num;++$i){
$value = $arr[$i];
$qHex = substr($value,0, 38);
$qTxt = hexToStr($qHex);
$arrRet[] = $qTxt;
// echo $qTxt . " <br>";
}
if(!$arrRet&&$isDBUG){
echo " <br>群聊数据" . "<br>";
echo $reText;
echo " <br>end" . "<br>";
}
if( $isDBUG){
echo " <br>群聊ID=" .count($arrRet). "个<br>";
print_r ($arrRet);
echo "<br>群聊 end" . "<br>";
// print_r (explode("020A13",$payMsgHex));
}
// echo $reText;
// echo $payMsgHex;
return $arrRet;
}
//获取用户信息
function getUserInfo(){
$url = "https://rocket.snssdk.com/passport/account/info/?version_code=1.7.8&app_name=flipchat&vid=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&vendor_id=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&device_id=35861873861&channel=App%20Store&resolution=750%2A1334&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&install_id=518624465917927&openudid=a43784ce442284f5d9de6e87f271b92b5f4a0b84&update_version_code=17802&idfv=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&ac=WIFI&os_version=10.3.1&ssmix=a&device_platform=iphone&update_version_name=17802&iid=518624465917927&device_type=iPhone%206S&idfa=898502F6-A012-4BB7-93BC-5B6F72B1A86D";
$retText = HttppostTx($url);
$j = json_decode($retText,true);
$user_id_str = $j["data"]["user_id_str"];
// echo $user_id_str;
return $user_id_str;
}
//创建群聊
function createQun(){
global $fileName;
$bas64 = "COUEEI/GgY2EqwIaDDAuNi4wLWJldGExMCgCOgwyMDE4MDkyNTE3NTZCJqomIwgCEh/O6eDp4/X4A+fv8L6X9LoBzung6eP1+AOu0pC95/UISgszNTg2MTg3Mzg2MVIJQXBwIFN0b3JlWgZpcGhvbmViCWlQaG9uZSA2U2oGMTAuMy4xcgUxLjcuOIIBJEEwNDJGQjI2LTI3MDUtNDFEMS1BRjBGLUEwOTZBRjVGQjQwQYoBFQGCai4t9RVfiYnYhj9M09q1Uu/YD5ABzung6eP1+AOYAfIK";
$url = "https://rocket.snssdk.com/conversation/v3/create/?version_code=1.7.8&app_name=flipchat&vid=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&device_id=mb86C4ailYY&channel=App%20Store&resolution=750*1334&aid=1394&app_id=1394&fl_update_version_name=1.7.8.02&openudid=a43784ce442284f5d9de6e87f271b92b5f4a0b84&update_version_code=17802&install_id=518624465917927&idfv=DFEEFBAD-FB89-44D6-BFC8-E95822D4FD51&ac=WIFI&os_version=10.3.1&device_platform=iphone&update_version_name=17802&iid=518624465917927&device_type=iPhone%206S&idfa=898502F6-A012-4BB7-93BC-5B6F72B1A86D";
$str = base64_decode($bas64);
$reText = HttppostTx($url, $str);
$payMsgHex = strToHex($reText);
// $payMsg = "08E504108FC6818D84AB0222024F4B328701AA2683010A80010A133638343436303130303035313131343437313210021A320A0B08CEE9E0E9E3F5F80318010A1108E7EFF0BE97F4BA0110D8D0F3F70518030A1008AED290BDE7F50810D8D0F3F70518032003280192032E0A1336383434363031303030353131313434373132180250CEE9E0E9E3F5F8038201080801100218012001A001033A223230323030373032303334373335303130303132303632323133303335393246423848CEE9E0E9E3F5F803";
$Hex = substrText($payMsgHex,"010A13","10021A");
$str = hexToStr($Hex);
// echo "qun=".$str;
if($str && strlen($str)==19){
file_put_contents($fileName, $str);
}
return $str;
}
function substrText($str="", $zText="", $yText=""){
// $result = strstr($tempText,'ticket=',1);//取前面
$result = $zText?strpos($str, $zText,0):0;//位置
$resuly = $yText?strpos($str, $yText,0):0;//位置
$s1=$result+strlen($zText);
$s2=$resuly-$s1;
if(!$yText ){
$reText = substr($str, $s1 );
}else{
$reText = substr($str, $s1 , $s2);
}
return $reText;
}
function HttppostTx($url='', $post_data = '', $ContentType="a:a",$timeout = 5)
{
global $access_token;
// curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
if ($post_data != '') {
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_POST, 1);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-protobuf',
'sdk-version: 1',
$ContentType,
'User-Agent: msg 1.7.8 rv:1.7.8.02 (iPhone; iOS 12.3.1; zh_CN) Cronet',
// 'x-Tt-Token: 001089f380e71c5c8e41ee643c3308210e3699e5ae0d964a3979642adb84e905dd2198348c3a458374a804af97a569ea89d',
'x-Tt-Token: '.$access_token,
));
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
/**
*十六进制转字符串函数[解密]
*@pream string $hex='616263';
*/
// function hexToStr($hex)
// {
// $str = "";
// for ($i = 0; $i < strlen($hex) - 1; $i += 2) {
// $str .= chr(hexdec($hex[$i] . $hex[$i + 1]));
// }
// return $str;
// }
/**
*字符串转十六进制函数[加密]
*@pream string $str='abc';
*/
// function strToHex($str)
// {
// $hex = "";
// for ($i = 0; $i < strlen($str); $i++) {
// $hex .= dechex(ord($str[$i]));
// }
// $hex = strtoupper($hex);
// return $hex;
// }
function strToHex($string){
$hex = '';
for ($i=0; $i<strlen($string); $i++){
$ord = ord($string[$i]);
$hexCode = dechex($ord);
$hex .= substr('0'.$hexCode, -2);
}
return strToUpper($hex);
}
function hexToStr($hex){
$string='';
for ($i=0; $i < strlen($hex)-1; $i+=2){
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
return $string;
}
/**
* 获得随机字符串
* @param $len 需要的长度
* @param $special 是否需要特殊符号
* @return string 返回随机字符串
*/
function getRandomStr($len, $special=false){
$chars = array(
"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", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
);
if($special){
$chars = array_merge($chars, array(
"!", "@", "#", "$", "?", "|", "{", "/", ":", ";",
"%", "^", "&", "*", "(", ")", "-", "_", "[", "]",
"}", "<", ">", "~", "+", "=", ",", "."
));
}
$charsLen = count($chars) - 1;
shuffle($chars); //打乱数组顺序
$str = '';
for($i=0; $i<$len; $i++){
$str .= $chars[mt_rand(0, $charsLen)]; //随机取出一位
}
return $str;
}
/**
* 函数的含义说明
*
* @access 倒找文本
* @explain 指定一文本在另一文本中最后出现的位置,位置值从0开始,utf8汉字为3个字节 gpk为2个字节
* @param string $string 要搜索的字符串
* @param string $find 要查找的字符
* @param integer $start 开始搜索的位置 默认为0
* @param boolean $bool 是否区分大小写,默认为假
* @return integer 返回字符串所在位置
*/
function 倒找文本($string,$find,$start = -1,$bool=false){
if ($start == -1){$start = strlen($string);}
$stringa = substr($string,0,$start);
if($bool){
$jg = @strripos ($stringa, $find);
}else{
$jg = @strrpos ($stringa, $find);
}
if(is_int($jg)){
return $jg;
}
return -1;
}
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)