使用 grunt-hazy 混淆 PHP 有语法错误
Obfuscated PHP using grunt-hazy has syntax error
我开始了解 Grunt,试图对我的测试 php 文件进行一些混淆。
这里是原代码,只是一个简单的hello world
<?php
echo 'hello world';
使用 grunt-hazy 混淆:
<?php eval("?>".base64_decode("PD9waHANCmVjaG8gJ2hlbGxvIHdvcmxkJzs=")."<?"); ?>
错误:
Parse error: syntax error, unexpected '<' in D:\Projects\Grunter\hazed\index.php(1) : eval()'d code on line 2
这是我的 Gruntfile
module.exports = function(grunt){
grunt.initConfig({
hazy: {
php: {
expand: true,
cwd: '',
dest: 'hazed',
src: [ '*.php' ]
}
},
watch: {
scripts: {
files: ['*.php'],
tasks: ['hazy']
}
}
});
grunt.loadNpmTasks('grunt-hazy');
grunt.loadNpmTasks('grunt-contrib-watch');
};
我做错了什么?是插件的问题吗?
通过 eval 查看 运行 的解码代码,您会明白这一点。
?><?php
echo 'hello world';<?
如您所见,您关闭了一个 PHP 标签,然后它打开一个新标签,回显一些文本,然后尝试在不关闭第一个标签的情况下打开另一个标签。
如果您尝试在测试脚本中添加结束 PHP 标记,我猜它会正常工作。
我开始了解 Grunt,试图对我的测试 php 文件进行一些混淆。
这里是原代码,只是一个简单的hello world
<?php
echo 'hello world';
使用 grunt-hazy 混淆:
<?php eval("?>".base64_decode("PD9waHANCmVjaG8gJ2hlbGxvIHdvcmxkJzs=")."<?"); ?>
错误:
Parse error: syntax error, unexpected '<' in D:\Projects\Grunter\hazed\index.php(1) : eval()'d code on line 2
这是我的 Gruntfile
module.exports = function(grunt){
grunt.initConfig({
hazy: {
php: {
expand: true,
cwd: '',
dest: 'hazed',
src: [ '*.php' ]
}
},
watch: {
scripts: {
files: ['*.php'],
tasks: ['hazy']
}
}
});
grunt.loadNpmTasks('grunt-hazy');
grunt.loadNpmTasks('grunt-contrib-watch');
};
我做错了什么?是插件的问题吗?
通过 eval 查看 运行 的解码代码,您会明白这一点。
?><?php
echo 'hello world';<?
如您所见,您关闭了一个 PHP 标签,然后它打开一个新标签,回显一些文本,然后尝试在不关闭第一个标签的情况下打开另一个标签。
如果您尝试在测试脚本中添加结束 PHP 标记,我猜它会正常工作。