base64+gzinflate 압축 인코딩(암호화) 파일은 일반적으로 헤더가 <? eval(gzinflate(base64_decode())인 PHP 파일입니다. 인코딩 및 디코딩 코드는 기사에 나와 있습니다.
암호:
<?php
함수 encode_file_contents($filename) {
$type=strtolower(substr(strrchr($filename,'.'),1));
if('php'==$type && is_file($filename) && is_writable($filename)){// PHP 파일이고 쓰기 가능한 경우 압축하고 인코딩합니다.
$contents = file_get_contents($filename); // 파일이 인코딩되었는지 확인
$pos = strpos($contents,'/*草namehttp://www.crazyi.cnCryptation*/' 에 의해 보호됨);
if(false === $pos || $pos>100){ // 파일 크기를 줄이기 위해 PHP 파일에서 주석과 공백을 제거합니다.
$contents = php_strip_whitespace($filename);
//PHP 헤더 및 트레일러 식별자 제거
$headerPos = strpos($contents,'<?php');
$footerPos = strrpos($contents,'?>');
$contents = substr($contents,$headerPos+5,$footerPos-$headerPos);
$encode = base64_encode(gzdeflate($contents));//인코딩 시작
$encode = '<?php'." /* 草namehttp://www.crazyi.cnCryptation*/n 에 의해 보호됨 eval(gzinflate(base64_decode(".$encode.")));n /*Reverse 엔지니어링은 불법이며 엄격히 금지됩니다. - (C)草nameCryptation 2008*/ n?>";
return file_put_contents($filename,$encode);
}
}
거짓을 반환;
}
//함수 호출
$filename='g:내 문서Desktoptest.php';
encode_file_contents($filename);
?>
<?php
함수 encode_file_contents($filename) {
$type=strtolower(substr(strrchr($filename,'.'),1));
if('php'==$type && is_file($filename) && is_writable($filename)){// PHP 파일이고 쓰기 가능한 경우 압축하고 인코딩합니다.
$contents = file_get_contents($filename); // 파일이 인코딩되었는지 확인
$pos = strpos($contents,'/*草namehttp://www.crazyi.cnCryptation*/' 에 의해 보호됨);
if(false === $pos || $pos>100){ // 파일 크기를 줄이기 위해 PHP 파일에서 주석과 공백을 제거합니다.
$contents = php_strip_whitespace($filename);
//PHP 헤더 및 트레일러 식별자 제거
$headerPos = strpos($contents,'<?php');
$footerPos = strrpos($contents,'?>');
$contents = substr($contents,$headerPos+5,$footerPos-$headerPos);
$encode = base64_encode(gzdeflate($contents));//인코딩 시작
$encode = '<?php'." /* 草namehttp://www.crazyi.cnCryptation*/n 에 의해 보호됨 eval(gzinflate(base64_decode(".$encode.")));n /*Reverse 엔지니어링은 불법이며 엄격히 금지됩니다. - (C)草nameCryptation 2008*/ n?>";
return file_put_contents($filename,$encode);
}
}
거짓을 반환;
}
//함수 호출
$filename='g:내 문서Desktoptest.php';
encode_file_contents($filename);
?>
압축 디코딩(복호화) 코드:
[이 코드 복사]CODE:
<?php
$Code = '여기에 복호화할 코드를 입력하세요.' // base64 인코딩;
$File = 'test.php';//디코딩 후 파일 저장
$Temp = base64_decode($Code);
$temp = gzinflate($Temp);
$FP = fopen($File,"w");
fwrite($FP,$temp);
fclose($FP);
echo "암호해독 성공!";
?>