JS代码混淆基础
Date.prototype.format = function(formatStr) {
var str = formatStr;
var WEEK = ['日', '一', '二', '三', '四', '五', '六'];
str = str.replace(/yyyy|YYYY/, this.getFullYear())
.replace(/mm|MM/, (this.getMonth() + 1) > 9 ? (this.getMonth() + 1).toString() : '0' + (this.getMonth() + 1).toString())
.replace(/dd|DD/, this.getDate() > 9 ? this.getDate().toString() : '0' + this.getDate().toString());
return str;
}
console.log(new Date().format('yyyy-MM-dd'));0x01 String obfuscation
Object Attributes Access
function Dog(name) {
this.name = name;
}
Dog.prototype.bark = function(){
console.log("Hello");
}
var d = new Dog('taco');
console.log(d.name); // taco
d.bark(); // Hello
console.log(d['name']); // taco
d['bark'](); // Hello Hex
unicode
ASCII Array
String Constant
Number Constant
0x02 Reference obfuscation
Array Index
Array Shuffle
Junk Code
JsFuck
0x03 Protection in Execution Flow
Control Flow Flattening
Comma Expression
0x04 Other Protection Strategies
Eval Encryption
Memory Explosion
Formatted Code Detection
Forever Debugger Loop
0x05 Sum up
Last updated