根据这篇帖子的算法写了个简单的文件加密:https://www.t00ls.net/thread-29456-1-1.html,什么大马小马加密出来的效果一模一样。
原文地址:https://www.t00ls.net/viewthread.php?tid=29463&extra=&page=1
<?php $file = ‘D:/Web/index.php‘; /*要加密的文件*/ $pass = ‘123456‘; /*登录密码*/ function enc($code,$pass) { $len = strlen($code); for($i = 0; $i < $len; $i++) { $pass .= $code[$i]; $code[$i] = chr((ord($code[$i]) + ord($pass[$i])) % 256); } $code = base64_encode($code); $temp = str_split($code,80); $newc = join("\r\n",$temp); return $newc; } $code = file_get_contents($file); $code = base64_encode(‘ ?>‘.$code.‘<?php ‘); $code = ‘eval(base64_decode(\‘‘.$code.‘\‘));exit;‘; $code = gzdeflate($code); $pass = md5($pass).substr(md5(strrev($pass)),0,strlen($pass)); $out = base64_decode(‘PD9waHANCiR3cF9fd3AgPSAnYmFzZScgLiAoMzIgKiAyKSAuICdfZGUnIC4gJ2NvZGUnOw0KJHdwX193cCA9ICR3cF9fd3Aoc3RyX3JlcGxhY2UoYXJyYXkoIlxyIiwiXG4iKSwgYXJyYXkoJycsJycpLCAn‘).enc($code,$pass); $out .= base64_decode(‘JykpOw0KJHdwX3dwID0gaXNzZXQoJF9QT1NUWyd3cF93cCddKSA/ICRfUE9TVFsnd3Bfd3AnXSA6IChpc3NldCgkX0NPT0tJRVsnd3Bfd3AnXSkgPyAkX0NPT0tJRVsnd3Bfd3AnXSA6IE5VTEwpOw0KaWYgKCR3cF93cCAhPT0gTlVMTCkgew0KICAgICR3cF93cCA9IG1kNSgkd3Bfd3ApIC4gc3Vic3RyKG1kNShzdHJyZXYoJHdwX3dwKSksIDAsIHN0cmxlbigkd3Bfd3ApKTsNCiAgICBmb3IgKCR3cF9fX3dwID0gMDsgJHdwX19fd3AgPCA=‘).strlen($code); $out .= base64_decode(‘OyAkd3BfX193cCsrKSB7DQogICAgICAgICR3cF9fd3BbJHdwX19fd3BdID0gY2hyKChvcmQoJHdwX193cFskd3BfX193cF0pIC0gb3JkKCR3cF93cFskd3BfX193cF0pKSAlIDI1Nik7DQogICAgICAgICR3cF93cC49ICR3cF9fd3BbJHdwX19fd3BdOw0KICAgIH0NCiAgICBpZiAoJHdwX193cCA9IEBnemluZmxhdGUoJHdwX193cCkpIHsNCiAgICAgICAgaWYgKGlzc2V0KCRfUE9TVFsnd3Bfd3AnXSkpIEBzZXRjb29raWUoJ3dwX3dwJywgJF9QT1NUWyd3cF93cCddKTsNCiAgICAgICAgJHdwX19fd3AgPSBjcmVhdGVfZnVuY3Rpb24oJycsICR3cF9fd3ApOw0KICAgICAgICB1bnNldCgkd3BfX3dwLCAkd3Bfd3ApOw0KICAgICAgICAkd3BfX193cCgpOw0KICAgIH0NCn0gPz48Zm9ybSBhY3Rpb249IiIgbWV0aG9kPSJwb3N0Ij48aW5wdXQgdHlwZT0idGV4dCIgbmFtZT0id3Bfd3AiIHZhbHVlPSIiLz48aW5wdXQgdHlwZT0ic3VibWl0IiB2YWx1ZT0iJmd0OyIvPjwvZm9ybT4=‘); echo ‘<pre>‘; echo htmlspecialchars($out); echo ‘</pre>‘; ?>
时间: 2024-10-29 06:18:28