PHP source code php-beast encryption

不言
Release: 2023-04-02 14:52:02
Original
5097 people have browsed it

This article mainly introduces the encryption of PHP source code php-beast, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

Install php-beast

php-beast source code download address:

https://github.com/liexusong/php-beast

Unzip and enter the source code directory

[innpay@localhost soft]$ unzip php-beast-master.zip 

[innpay@localhost soft]$ cd php-beast-master
[innpay@localhost php-beast-master]$ pwd/home/pony/soft/php-beast-master
Copy after login

Compile and install

[innpay@localhost php-beast-master]$ /home/pony/php/bin/phpize 
Configuring for:
PHP Api Version:         20131106Zend Module Api No:      20131226Zend Extension Api No:   220131226[innpay@localhost php-beast-master]$ ./configure --with-php-config=/home/pony/php/bin/php-config


[innpay@localhost php-beast-master]$ make

[innpay@localhost php-beast-master]$ make install
Installing shared extensions:     /home/pony/php/lib/php/extensions/no-debug-non-zts-20131226/
Copy after login

After the installation is completed, beast.so is generated in the no-debug-non-zts-20131226 directory.

Edit php.ini and add configuration items: extension=beast.so

Restart apache and check whether beast takes effect through phpinfo

[innpay@localhost apache2]$ ./bin/apachectl restart
Copy after login

PHP source code php-beast encryption

Use php-beast

After the installation is completed, enter the tools directory under the source code directory and configure configure.ini

[innpay@localhost tools]$ cat configure.ini 
; source path
src_path = "/home/pony/php/apache2/htdocs/wechat_nofity"; destination path
dst_path = "/home/pony/php/apache2/htdocs/des"; expire time
expire = "2019-01-01 12:00:00"; encrypt typeencrypt_type = "DES"
Copy after login

src_path is the path to the encrypted project, dst_path is the path to save the encryption The path of the project, expire is the time when the project can be used (the format of expire is: YYYY-mm-dd HH:ii:ss). encrypt_type is the encryption method, the options are: DES, AES, BASE64. After modifying the configure.ini file, you can use the command php encode_files.php to start the encryption project.

You may encounter the problem that the php command cannot be recognized here:

php: command not found
Copy after login

The solution is to add the php execution path to the PATH of the .bash_profile environment variable

Perform encryption operation:

[innpay@localhost tools]$ php encode_files.php
Source code path: /home/pony/php/apache2/htdocs/wechat_nofity
Destination code path: /home/pony/php/apache2/htdocs/des
Expire time: 2019-01-01 12:00:00------------- start process -------------PHP Warning:  strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/pony/php/soft/php-beast-master/tools/encode_files.php on line 147Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/pony/php/soft/php-beast-master/tools/encode_files.php on line 147Processed encrypt files [64%] - 100%Failed to encode file `/home/pony/php/apache2/htdocs/wechat_nofity/wechat.class.php'
Processed encrypt files [100%] - 100%
Finish processed encrypt files, used 0.699295 seconds
Copy after login

Here I am prompted that a file named wechat.class.php failed to be encrypted. I suspect that the file is too long. It doesn’t matter if one fails, I will copy it separately.

The encrypted directory is the des directory. Go in and look at the source code files. They are indeed garbled. But accessing all php pages is normal.

Modify the default encryption key

Because I am using the des encryption method here, a des key will definitely be used. The default key is in des_algo_handler in the php-beast directory. c file:

#include <stdlib.h>#include <string.h>#include "beast_module.h"#include "des_algo_lib.c"static char key[8] = {    0x01, 0x1f, 0x01, 0x1f,    0x01, 0x0e, 0x01, 0x0e,
};
Copy after login

can be changed directly, and you can recompile after the change.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Introduction to PHP iterator generator

In PHP, assign the value in the array to an Methods of group variables

The above is the detailed content of PHP source code php-beast encryption. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!