tp6使用enphp混淆加密代码

本文介绍了如何使用enphp库对PHP代码进行深度混淆,包括加密方法、混淆选项设置,以及在TP6项目中如何避免特定部分被加密。
摘要由CSDN通过智能技术生成

1、下载enphp
https://gitee.com/mz/enphp_opensource?_from=gitee_search

2、加密,使用创建个文件,使用php命令执行

<?php
//引入enphp
include './enphp_opensource-master/func_v2.php';
$options = array(
    //混淆方法名 1=字母混淆 2=乱码混淆
    'ob_function'        => 2,
    //混淆函数产生变量最大长度
    'ob_function_length' => 3,
    //混淆函数调用 1=混淆 0=不混淆 或者 array('eval', 'strpos') 为混淆指定方法
    'ob_call'            => 1,
    //随机插入乱码
    'insert_mess'        => 0,
    //混淆函数调用变量产生模式  1=字母混淆 2=乱码混淆
    'encode_call'        => 2,
    //混淆class
    'ob_class'           => 0,
    //混淆变量 方法参数  1=字母混淆 2=乱码混淆
    'encode_var'         => 2,
    //混淆变量最大长度
    'encode_var_length'  => 5,
    //混淆字符串常量  1=字母混淆 2=乱码混淆
    'encode_str'         => 2,
    //混淆字符串常量变量最大长度
    'encode_str_length'  => 3,
    // 混淆html 1=混淆 0=不混淆
    'encode_html'        => 2,
    // 混淆数字 1=混淆为0x00a 0=不混淆
    'encode_number'      => 1,
    // 混淆的字符串 以 gzencode 形式压缩 1=压缩 0=不压缩
    'encode_gz'          => 0,
    // 加换行(增加可阅读性)
    'new_line'           => 1,
    // 移除注释 1=移除 0=保留
    'remove_comment'     => 1,
    // debug
    'debug'              => 1,
    // 重复加密次数,加密次数越多反编译可能性越小,但性能会成倍降低
    'deep'               => 1,
    // PHP 版本
    'php'                => 7,
);
$file = './zhoao666/app/admin/controller/index.php';
$target_file = './zhoao666/app/admin/controller/index.php';
//z执行加密
enphp_file($file, $target_file, $options);


// tp6要修改第二行不加密,引入模板declare (strict_types = 1)
$fp=fopen('./zhoao666/app/admin/controller/index.php','r+');
if($fp){
    $i=1;
    while(!feof($fp)){
        //修改第二行数据
        if($i==2){
            fseek($fp,0,SEEK_CUR);
            fwrite($fp,'declare (strict_types = 1);//');
            break;
        }
        fgets($fp);
        $i++;
    }
    fclose($fp);
}

  • 17
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大得369

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值