search
Homephp教程PHP源码批量加密php文件,无需第三方插件

经常加密php的主要是zend和PHP Screw,这些都需要安装插件。如果是小网站,这样加密也可以。前面有人介绍过。我只是做个批处理,批量加密。一定注意备份

1.jiami.php

<?php
   
     function RandAbc($length=""){//返回随机字符串
  
   
    $str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    return str_shuffle($str);
    
  }
 echo $file=$_SERVER["argv"][1]; 
 if (!empty($file)){
 $filepath=$file;
 $path_parts= pathinfo($filepath);
 $filename=$path_parts["basename"];
 
 $T_k1=RandAbc();//随机密匙1
 
 $T_k2=RandAbc();//随机密匙2
 
  
 $vstr=file_get_contents($filename);//要加密的文件 
  
 $v1=base64_encode($vstr);
  
 
 $c=strtr($v1,$T_k1,$T_k2);//根据密匙替换对应字符。
  
  
 $c=$T_k1.$T_k2.$c;
  
  
 $q1="o0o0o00ll11l1";
 $q2="lll1ll1l1l1l1";
 $q3="o0ooo0o0o0ooo0";
 $q4="o0o0o0ooo0o0";
 $q5="ll1ll1l1l1l1l";
 $q6="ll11l1l1l1ll1";
 $s=&#39;$&#39;.$q6.&#39;=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%64%679%5F%65%68%63%73%77%6F4%2B%6637%6A");$&#39;.$q1.&#39;=$&#39;.$q6.&#39;{3}.$&#39;.$q6.&#39;{6}.$&#39;.$q6.&#39;{33}.$&#39;.$q6.&#39;{30};$&#39;.$q3.&#39;=$&#39;.$q6.&#39;{33}.$&#39;.$q6.&#39;{10}.$&#39;.$q6.&#39;{24}.$&#39;.$q6.&#39;{10}.$&#39;.$q6.&#39;{24};$&#39;.$q4.&#39;=$&#39;.$q3.&#39;{0}.$&#39;.$q6.&#39;{18}.$&#39;.$q6.&#39;{3}.$&#39;.$q3.&#39;{0}.$&#39;.$q3.&#39;{1}.$&#39;.$q6.&#39;{24};$&#39;.$q5.&#39;=$&#39;.$q6.&#39;{7}.$&#39;.$q6.&#39;{13};$&#39;.$q1.&#39;.=$&#39;.$q6.&#39;{22}.$&#39;.$q6.&#39;{36}.$&#39;.$q6.&#39;{29}.$&#39;.$q6.&#39;{26}.$&#39;.$q6.&#39;{30}.$&#39;.$q6.&#39;{32}.$&#39;.$q6.&#39;{35}.$&#39;.$q6.&#39;{26}.$&#39;.$q6.&#39;{30};eval($&#39;.$q1.&#39;("&#39;.base64_encode(&#39;$&#39;.$q2.&#39;="&#39;.$c.&#39;";eval(\&#39;?>\&#39;.$&#39;.$q1.&#39;($&#39;.$q3.&#39;($&#39;.$q4.&#39;($&#39;.$q2.&#39;,$&#39;.$q5.&#39;*2),$&#39;.$q4.&#39;($&#39;.$q2.&#39;,$&#39;.$q5.&#39;,$&#39;.$q5.&#39;),$&#39;.$q4.&#39;($&#39;.$q2.&#39;,0,$&#39;.$q5.&#39;))));&#39;).&#39;"));&#39;;
  
 $s=&#39;<?
 &#39;.$s.
&#39;
  ?>&#39;;
  
 echo $s;
 //生成 加密后的PHP文件
 
 $fpp1 = fopen($filepath,&#39;w&#39;);
 fwrite($fpp1,$s) or die(&#39;写文件错误&#39;);
 echo &#39;加密成功!&#39;;
 }

2.d.bat

@echo off & setlocal EnableDelayedExpansion
for /f "delims=" %%i in (&#39;"dir /a/s/b/on *.php"&#39;) do (
set file=%%~fi
set 不要这行file=!file:%cd%/=!
set file=!file:/=/!
E:\\websystem\\phpnow\\php-5.2.14-Win32\\php.exe E:\\websystem\\phpnow\\htdocs\\sme.bak\\jiami.php !file!
echo !file!
echo !file! >> 内容.txt
)
pause
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.