Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Add Obfuscation and AntiDebugger into PMSF #110

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,41 @@ module.exports = function (grunt) {
}
}
},
obfuscator: {
options: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
deadCodeInjection: true,
deadCodeInjectionThreshold: 1,
debugProtection: true,
debugProtectionInterval: true,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true,
stringArray: true,
stringArrayEncoding: 'rc4',
stringArrayThreshold: 1,
transformObjectKeys: true,
unicodeEscapeSequence: false
},
prod: {
files: {
'static/dist/js/app.min.js' :'static/js/app.js',
'static/dist/js/map.min.js':'static/js/map.js',
'static/dist/js/map.common.min.js' : 'static/js/map.common.js',
'static/dist/js/mobile.min.js':'static/js/mobile.js',
'static/dist/js/stats.min.js':'static/js/stats.js',
'static/dist/js/statistics.min.js':'static/js/statistics.js',
'static/dist/js/status.min.js':'static/js/status.js',
'static/dist/js/serviceWorker.min.js':'static/js/serviceWorker.js'
}
}

},
minjson: {
build: {
files: {
Expand Down Expand Up @@ -147,14 +182,16 @@ module.exports = function (grunt) {
}
});

grunt.registerTask('js-build', ['newer:babel', 'newer:uglify']);
grunt.registerTask('js-build', ['newer:obfuscator']);
grunt.registerTask('js-dev', ['newer:babel', 'newer:uglify']);
grunt.registerTask('css-build', ['newer:sass', 'newer:cssmin']);
grunt.registerTask('js-lint', ['newer:eslint']);
grunt.registerTask('json', ['newer:minjson']);
grunt.registerTask('php-lint', ['newer:phplint']);
grunt.registerTask('html-build', ['htmlmin', 'cacheBust']);

grunt.registerTask('build', ['clean', 'js-build', 'css-build', 'json', 'html-build']);
grunt.registerTask('dev', ['clean', 'js-dev', 'css-build', 'json', 'html-build']);
grunt.registerTask('lint', ['js-lint', 'php-lint']);
grunt.registerTask('default', ['build', 'watch']);

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "grunt build",
"watch": "grunt default",
"dev": "grunt dev",
"lint": "grunt lint",
"grunt": "grunt"
},
Expand Down Expand Up @@ -45,6 +46,7 @@
"grunt-contrib-copy": "latest",
"grunt-contrib-cssmin": "latest",
"grunt-contrib-htmlmin": "2.4.0",
"grunt-contrib-obfuscator": "latest",
"grunt-contrib-uglify": "latest",
"grunt-contrib-watch": "latest",
"grunt-eslint": "^20.1.0",
Expand Down