0

I've been attempting to figure out the background math in a Flash game by using the Sothink SWF Decompiler to view the ActionScript files. Admittedly I know very little about ActionScript, but I'm seeing lines of code that look like:

_loc_2 = null * (null * true) <= null;

or:

_loc_3 = null & null << (null === false);

From where I stand, value <= null doesn't make much sense, and neither does null * true or null & null. Am I just not understanding ActionScript properly, or is this an error in the decompiling process? If it's an error, is there any way to solve it?

mayhew
  • 5
  • 2

1 Answers1

0

The swf has probably been encrypted with an obfuscater, which is why you're seeing nonsense like this. You can test this code yourself (though you have to compile in non-strict mode):

trace( "null & null: " + ( null & null ) ); // traces 0
trace( "null === false: " + ( null === false ) ); // traces false
trace( "null & null << (null === false): " + (null & null << (null === false)) ); // traces 0
trace( "null * true: " + ( null * true ) ); // traces 0
trace( "null * null * true " + ( null * ( null * true ) ) ); // traces 0
trace( "null * (null * true) <= null: " + (null * (null * true) <= null) ); // traces true

so basically _loc_2 is a local variable set to 0, while _loc_3 is a local variable set to true

divillysausages
  • 7,883
  • 3
  • 25
  • 39
  • So you're saying that the variables themselves in the end are set to the same value they would be before using the obfuscator, but now that the obfuscator has been used, the process for setting each variable has become incredibly complex? Or has the obfuscator confused my decompiler to the point where all the _null_ etc. now actually break the script? – mayhew Jun 25 '11 at 17:28
  • the point of the obfuscater is to keep the same functionality, just make it a PITA for people to decompile and rip off your code. secureSWF for example will use uncommon characters that won't even show up properly in your editor. Technically, it should still all work, but i've not tested this. for example, compare a before and after: http://asgamer.com/2009/why-how-to-encrypt-your-flash-swf (Scroll to the bottom) – divillysausages Jun 25 '11 at 18:18
  • why not search for tutorials for the same functionality you're after, or try getting in touch with the original developer and asking for advice? most flash devs are quite friendly and more than happy to teach – divillysausages Jun 25 '11 at 18:19
  • Hmmm, the obfuscation makes sense now. Though technically the bigger picture of what I'm trying to do is obtain in-game variables and have them passed on to an external script that uses that information to automate playing the game (a "bot", essentially), and I haven't found any useful tutorials on how to access those variables externally, and I don't know how the game dev would feel about helping me to hack his game, but it might be worth a shot. Thanks for the help :) – mayhew Jun 25 '11 at 18:36