phpjm解密程序,也适用于其他混淆加密的破解
阅读原文时间:2023年07月11日阅读:1
0){ $code = str\_replace('eval(', $replace.'(', $code); }else{ preg\_match("/@\\\\$(.\*)\\(\\\\$(.\*),(.\*)\\(/isU", $code, $res); $code = str\_replace($res\[3\], "'$replace", $code); } $code = preg\_replace('/\\\\$(.\*)=false;(.\*?)\\(\\);/', '', $code); //上一版本 $code = preg\_replace('/\\|\\|@\\\\$(.\*?)\\(\\);/', '|| print("ok");', $code); $code = destr($code); $tmp\_file = 'detmp'.$n.'.php'; file\_put\_contents($tmp\_file, $code); include($tmp\_file); $val = 'decode'.$n; $str = $$val; unlink($tmp\_file); if(strpos($str, ';?>') === 0){ $decode = $str; break; } $str = "", $decode); file\_put\_contents($file.'.de.php' ,$decode); unlink('0\_'.$file); echo 'done'; //////////// function val\_replace($code, $val, $deval){ $code = str\_replace('$'.$val.',', '$'.$deval.',', $code); $code = str\_replace('$'.$val.';', '$'.$deval.';', $code); $code = str\_replace('$'.$val.'=', '$'.$deval.'=', $code); $code = str\_replace('$'.$val.'(', '$'.$deval.'(', $code); $code = str\_replace('$'.$val.')', '$'.$deval.')', $code); $code = str\_replace('$'.$val.'.', '$'.$deval.'.', $code); $code = str\_replace('$'.$val.'/', '$'.$deval.'/', $code); $code = str\_replace('$'.$val.'>', '$'.$deval.'>', $code); $code = str\_replace('$'.$val.'<', '$'.$deval.'<', $code); $code = str\_replace('$'.$val.'^', '$'.$deval.'^', $code); $code = str\_replace('$'.$val.'||', '$'.$deval.'||', $code); $code = str\_replace('($'.$val.' ', '($'.$deval.' ', $code); return $code; } function fmt\_code($code){ global $vals,$funs; preg\_match\_all("/\\\\$\[0-9a-zA-Z\\\[\\\]'\]+(,|;)/iesU", $code, $res); foreach($res\[0\] as $v){ $val = str\_replace(array('$',',',';'), '', $v); $deval = destr($val, 1); $vals\[$val\] = $deval; $code = val\_replace($code, $val, $deval); } preg\_match\_all("/\\\\$\[0-9a-zA-Z\\\[\\\]'\]+=/iesU", $code, $res); foreach($res\[0\] as $v){ $val = str\_replace(array('$','='), '', $v); $deval = destr($val, 1); $vals\[$val\] = $deval; $code = val\_replace($code, $val, $deval); } preg\_match\_all("/function\\s\[0-9a-zA-Z\\\[\\\]\]+\\(/iesU", $code, $res); foreach($res\[0\] as $v){ $val = str\_replace(array('function ','('), '', $v); $deval = destr($val, 1); $funs\[$val\] = $deval; $code = str\_replace('function '.$val.'(', 'function '.$deval.'(', $code); $code = str\_replace('='.$val.'(', '='.$deval.'(', $code); $code = str\_replace('return '.$val.'(', 'return '.$deval.'(', $code); } return $code; } function strdecode($str){ $len = strlen($str); $newstr = ''; for($i=0; $i<$len; $i++){ $n = ord($str\[$i\]); $newstr .= decode($n); } return $newstr; } function decode($dec){ if(($dec > 126 || $dec<32) && $dec<>13 && $dec<>10){ return '\['.$dec.'\]'; }else{ return chr($dec); } } function destr($str, $val=0){ $k = 0; $num = ''; $n = strlen($str); $code = ''; for($i=0; $i<$n; $i++){ if($str\[$i\] == '\[' && ($str\[$i+1\]==1 || $str\[$i+1\]==2)){ $k = 1; }elseif($str\[$i\] == '\]' && $k==1){ $num = intval($num); if($val==1){ $num = 97 + fmod($num, 25); } $code .= chr($num); $k = 0; $num = null; }else{ if($k == 1){ $num .= $str\[$i\]; }else{ $code .= $str\[$i\]; } } } return $code; } ?> ', $decode); $str = explode('?>'; echo $decode; file\_put\_contents($file.'.de.php' ,$decode); ////////////////////////////// function de1($de1,$str2=''){ global $c1,$c2; if(!$str2)return(base64\_decode(destr($de1))); $s9=de1($c2); for($i=0;$i140&&ord($de1{$i})<245)?chr(ord($de1{$i})/2):$de1{$i}):""; return(base64\_decode($s9)); } function de2(&$de2){ global $c5; if(strstr($de2,$c5)){ $de2=str\_replace($c5,'',$de2); $de2=gzuncompress($de2); } if(strstr($de2,$c5)){ $de2=str\_replace($c5,'',$de2); de2($de2); } } ///////////////////////////// function strdecode($str){ $len = strlen($str); $newstr = ''; for($i=0; $i<$len; $i++){ $n = ord($str\[$i\]); $newstr .= decode($n); } return $newstr; } function decode($dec){ if(($dec > 126 || $dec<32)){ return '\['.$dec.'\]'; }else{ return chr($dec); } } function destr($str){ $k = 0; $num = ''; $n = strlen($str); $code = ''; for($i=0; $i<$n; $i++){ if($str\[$i\] == '\['){ $k = 1; }elseif($str\[$i\] == '\]'){ $num = intval($num); $code .= chr($num); $k = 0; $num = null; }else{ if($k == 1){ $num .= $str\[$i\]; }else{ $code .= $str\[$i\]; } } } return $code; } ?>