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 1 commit
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
41 changes: 40 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = function (grunt) {
// load plugins as needed instead of up front
require('jit-grunt')(grunt);
require('phplint').gruntPlugin(grunt);
grunt.loadNpmTasks('grunt-contrib-obfuscator');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this line is needed, we use jit-grint: https://www.npmjs.com/package/jit-grunt


grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
Expand Down Expand Up @@ -59,13 +60,49 @@ 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: {
'static/dist/data/cries.min.json': 'static/data/cries.json',
'static/dist/data/pokemon.min.json': 'static/data/pokemon.json',
'static/dist/data/moves.min.json': 'static/data/moves.json',
'static/dist/data/mapstyle.min.json': 'static/data/mapstyle.json',
'static/dist/data/raid-boss.min.json': 'static/data/raid-boss.json',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file doesn't exist.

'static/dist/data/searchmarkerstyle.min.json': 'static/data/searchmarkerstyle.json',
'static/dist/data/weather.min.json': 'static/data/weather.json',
'static/dist/locales/de.min.json': 'static/locales/de.json',
Expand Down Expand Up @@ -147,14 +184,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