ActionScript: Difference between revisions

Content deleted Content added
m formatting fixes
Line 296:
 
In opposition to the decompilers, ActionScript [[obfuscated code|obfuscators]] have been introduced, which transform code into a form that breaks decompiler output while preserving the functionality and structure of the program. Higher-quality obfuscators implement lexical transformations such as identifier renaming, control flow transformation, and data abstraction transformation which collectively make it harder for decompilers to generate output likely to be useful to a human. Less robust obfuscators insert traps for decompilers. Such obfuscators either cause the decompiler software to crash unexpectedly or to generate unintelligible source code.{{Citation needed|date=March 2021}}
 
The following is an example of ActionScript 3.0 code generated by a decompiler program, before and after obfuscation.{{Original research inline|date=March 2021}}
 
Code before obfuscation:
 
<syntaxhighlight lang="actionscript3">
private function getNeighbours(i: int, j: int): Array
{
var a: Array = new Array();
for (var k = 0; k < 8; k++){
var ni = i + int(neighbour_map[k][1]);
var nj = j + int(neighbour_map[k][1]);
if (ni < 0 || ni >= xsize || nj < 0 || nj >= ysize)
continue;
a.push(Cell(cells[ni][nj]));
}
return a;
}
</syntaxhighlight>
 
Code after obfuscation:
 
<syntaxhighlight lang="actionscript3">
private function getNeighbours(_arg1: int, _arg2: int): Array
{
var _local3: Array = -(((boolean - !BOOLEAN!) % ~(undefined)));
var _local4: *;
var _local5: *;
var _local6: *;
_local3 = Array();
_local4 = 1;
for (;//unresolved jump
, _arg2 < 8;_local4++) {
_local5 = (_arg1 + int(!BOOLEAN!));
_local6 = (_arg2 + int(!BOOLEAN!));
if (true){
_arg1 = (((//unresolved nextvalue or nextname << !BOOLEAN!) + !BOOLEAN!)
<< defined);
_arg1 = (!(!BOOLEAN!) ^ !BOOLEAN!);
(!BOOLEAN! instanceof !BOOLEAN!);
var _local1 = (((!BOOLEAN! as !BOOLEAN!) + !BOOLEAN!) == this);
if (!(!BOOEAN! == !BOOLEAN!)){
-((true << !BOOLEAN!)).push(Cell(cells[_local5][_local6]));
}
}
if (!true){
(_local6 < 1):
(_local6 < 1);
(_local5 < 1);
}
}
return (_local6);
}
</syntaxhighlight>
 
==References==