0

I want to obfuscate code like that has been done here. I have only seem this type of obfuscation before with Google and other big companies. Can anyone suggest how this code has been obfuscated. Also it is better than using eval which can trigger antivirus on computers.

function app() {
var vb = '',
    wb = '" for "gwt:onLoadErrorFn"',
    xb = '" for "gwt:onPropertyErrorFn"',
    yb = '"><\/script>',
    zb = '#',
    Ab = '/',
    Bb = '10DBFC879A4A784134EE84443D45E2C5',

View full code on jsfiddle as it hits the characters limit on stackoverflow: http://jsfiddle.net/NJb2Y/

Also, can this code be deobfuscated? And if, how easily?

Please be sparing if this is not a right question as I would really like an answer on this.

UPDATE: I have searched for obfuscaters online however I am having a hard time finding one that does this. Almost all that I have found use the eval function.

Vish
  • 4,508
  • 10
  • 42
  • 74
  • There are antivirus blocking `eval` ? Seriously ? – Denys Séguret Mar 29 '13 at 16:49
  • 1
    Did you search for javascript minifiers, uglyfiers and obfuscators ? What is missing ? – Denys Séguret Mar 29 '13 at 16:50
  • [http://dean.edwards.name/packer/](http://dean.edwards.name/packer/) – couzzi Mar 29 '13 at 16:51
  • Did you try Google's [Closure Compiler: https://developers.google.com/closure/compiler/](https://developers.google.com/closure/compiler/) ?? – Amy Mar 29 '13 at 16:52
  • 1
    Of course, any code that is obfuscated can be de-obfuscated. It's not a one way encryption/hash. The code might still be difficult to understand though. – Felix Kling Mar 29 '13 at 16:54
  • yes, I have but, it does not replace parameters with variables and does not cross link functions and replaces their names. – Vish Mar 29 '13 at 16:54

1 Answers1

0

The example you give looks like it was generated by the Google Web Toolkit (that's what the gwt stands for). GWT apps are written in Java and 'compiled' to javascript. GWT seems to have a built-in obfuscator. You may be able to look through the source code of GWT and find the obfuscation code they use.

Any obfuscated javascript code is possible to de-obfuscate. The more code there is, the longer it takes, but obfuscation can never be relied on to protect important code.

Trevor Dixon
  • 23,216
  • 12
  • 72
  • 109