This question already has answers here:
Deobfuscating Javascript [closed]
(5 answers)
Closed 8 years ago.
How to un obfuscate java-script code like that : it takes alot of time to know the expression obfuscate for the javascript to protect the code , but I'm tring to get the main code of this script but don't know How ?
var _0x843d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x4C\x41\x4D\x52","\x6E\x61\x76","\x72\x65\x73\x69\x7A\x65","\x77\x69\x64\x74\x68","\x74\x6F\x70\x2D\x6E\x61\x76\x2D\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x68\x61\x73\x43\x6C\x61\x73\x73","\x2E\x6E\x61\x76\x62\x61\x72\x2D\x66\x69\x78\x65\x64\x2D\x74\x6F\x70","\x61\x64\x64\x43\x6C\x61\x73\x73","\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73","\x74\x6F\x70","\x6F\x66\x66\x73\x65\x74","\x2E\x6E\x61\x76\x62\x61\x72","\x73\x63\x72\x6F\x6C\x6C","\x64\x72\x6F\x70\x64\x6F\x77\x6E","\x61\x63\x74\x69\x76\x65\x2D\x73\x75\x62","\x65\x61\x73\x65\x4F\x75\x74\x45\x78\x70\x6F","\x3A\x6E\x6F\x74\x28\x2E\x65\x78\x29","\x6F\x6E\x65\x50\x61\x67\x65\x4E\x61\x76","\x2E\x6E\x61\x76\x62\x61\x72\x2D\x6E\x61\x76\x20\x2E\x64\x72\x6F\x70\x64\x6F\x77\x6E","\x61\x63\x74\x69\x76\x65","\x2E\x6E\x61\x76\x62\x61\x72\x2D\x6E\x61\x76","\x73\x6C\x69\x64\x65\x44\x6F\x77\x6E\x48\x65\x61\x64","\x2D\x35\x30\x30\x70\x78","\x30","\x63\x73\x73","\x2E\x70\x61\x67\x65\x48\x65\x61\x64","\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x31\x2C\x20\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x33","\x72\x65\x61\x64\x79","\x30\x70\x78","\x31","\x65\x61\x73\x65\x4F\x75\x74\x43\x75\x62\x69\x63","\x61\x6E\x69\x6D\x61\x74\x65","\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x33","\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x31","\x64\x65\x6C\x61\x79","\x73\x74\x6F\x70","\x6C\x6F\x61\x64","\x70\x61\x72\x61\x6C\x6C\x61\x78","\x74\x6F\x75\x63\x68","\x73\x65\x74","\x72\x61\x6E\x64\x6F\x6D","\x69\x6E\x69\x74","\x70\x72\x65\x6C\x6F\x61\x64\x65\x72","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x76\x69\x73\x69\x62\x6C\x65","\x62\x6F\x64\x79","\x66\x61\x64\x65\x4F\x75\x74","\x23\x70\x72\x65\x6C\x6F\x61\x64\x65\x72","\x73\x6C\x69\x64\x65\x72","\x73\x75\x70\x65\x72\x73\x6C\x69\x64\x65\x73","\x6F\x77\x6C\x43\x61\x72\x6F\x75\x73\x65\x6C","\x65\x61\x63\x68","\x73\x6B\x69\x6C\x6C\x62\x61\x72","\x61\x6E\x69\x6D\x61\x74\x65\x64","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x74\x65\x73\x74","\x64\x61\x74\x61\x2D\x70\x65\x72\x63\x65\x6E\x74","\x61\x74\x74\x72","\x2E\x73\x6B\x69\x6C\x6C\x62\x61\x72\x2D\x62\x61\x72","\x66\x69\x6E\x64","\x68\x65\x69\x67\x68\x74","\x6F\x75\x74\x65\x72\x48\x65\x69\x67\x68\x74","\x77\x61\x79\x70\x6F\x69\x6E\x74","\x2E\x73\x6B\x69\x6C\x6C\x62\x61\x72","\x76\x69\x64\x65\x6F\x42\x67\x59\x54","\x74\x75\x62\x75\x6C\x61\x72","\x3C\x69\x6D\x67\x20\x73\x72\x63\x3D\x27\x69\x6D\x67\x2F\x62\x67\x2D\x68\x65\x61\x64\x2D\x31\x2E\x6A\x70\x67\x27\x20\x61\x6C\x74\x3D\x27\x27\x20\x2F\x3E","\x68\x74\x6D\x6C","\x62\x6F\x6F\x74\x73\x74\x72\x61\x70\x43\x61\x72\x6F\x75\x73\x65\x6C","\x63\x61\x72\x6F\x75\x73\x65\x6C","\x66\x69\x74\x56\x69\x64\x73","\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F\x46\x69\x6C\x74\x65\x72","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","\x63\x75\x72\x72\x65\x6E\x74","\x64\x61\x74\x61\x2D\x67\x72\x6F\x75\x70","\x61\x6C\x6C","\x69\x6E\x61\x63\x74\x69\x76\x65","\x2E\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F\x2D\x6C\x69\x6E\x6B","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x2C","\x73\x70\x6C\x69\x74","\x63\x6C\x69\x63\x6B","\x68\x6F\x76\x65\x72","\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F","\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F\x45\x78\x70\x61\x6E\x64\x65\x72","\x73\x63\x72\x6F\x6C\x6C\x41\x6E\x69\x6D","\x79\x65\x73","\x64\x65\x66\x61\x75\x6C\x74\x73","\x66\x6E","\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x64\x61\x74\x61","\x64\x61\x74\x61\x2D\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x64\x61\x74\x61\x2D\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E\x2D\x64\x65\x6C\x61\x79","\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E\x2D\x64\x65\x6C\x61\x79","\x20\x76\x69\x73\x69\x62\x6C\x65","\x25","\x2E\x61\x6E\x69\x6D\x61\x74\x65\x64","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x66\x69\x78\x65\x64","\x2E\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x2D\x6D\x69\x64\x64\x6C\x65\x2D\x66\x75\x6C\x6C","\x6D\x61\x67\x6E\x69\x66\x69\x63","\x6D\x61\x67\x6E\x69\x66\x69\x63\x50\x6F\x70\x75\x70","\x63\x6F\x6E\x74\x61\x63\x74\x46\x6F\x72\x6D","\x63\x6C\x69\x63\x6B\x20\x74\x6F\x75\x63\x68\x73\x74\x61\x72\x74","\x64\x69\x73\x61\x62\x6C\x65\x64","\x70\x72\x6F\x70","\x3C\x69\x20\x63\x6C\x61\x73\x73\x3D\x27\x66\x61\x20\x66\x61\x2D\x63\x6F\x67\x20\x66\x61\x2D\x73\x70\x69\x6E\x27\x3E\x3C\x2F\x69\x3E\x20\x53\x45\x4E\x44\x49\x4E\x47","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x73\x75\x62\x6D\x69\x74","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D","\x73\x65\x72\x69\x61\x6C\x69\x7A\x65","\x50\x4F\x53\x54","\x69\x6E\x63\x2F\x63\x6F\x6E\x74\x61\x63\x74\x2E\x70\x68\x70","\x6A\x73\x6F\x6E","\x73\x74\x61\x74\x75\x73","","\x76\x61\x6C","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x20\x69\x6E\x70\x75\x74","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x20\x74\x65\x78\x74\x61\x72\x65\x61","\x65\x6D\x70\x74\x79","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x2D\x72\x65\x73\x70\x6F\x6E\x73\x65","\x3C\x69\x20\x63\x6C\x61\x73\x73\x3D\x27\x66\x61\x20\x66\x61\x2D\x63\x68\x65\x63\x6B\x27\x3E\x3C\x2F\x69\x3E\x20\x53\x55\x42\x4D\x49\x54","\x61\x6A\x61\x78","\x6F\x6E"];
I have another question related to that , Could I use this script as it's or I have to decode it to use at my HTML5 page ?
The point of obfuscation is to make it very challenging to restore the original code as written while maintaining the same functionality. So to answer your first question there really is no way to get back to the original code as the author clearly didn't want you to see it or be able to edit it. To answer your second question yes you should be able to use it normally assuming it was properly obfuscated.
I suggest you do a little reading on the topic: http://en.wikipedia.org/wiki/Obfuscation_%28software%29
There might be a few deobfuscation tools out there for javascript, but the chance that these work well is probably low.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking for a library in scala that generates JavaScript from an abstract syntax tree.
I want to use it in an compiler that generates JavaScript at the end and I don't want to implement the pretty printing part myself.
I spent half of yesterday researching this. It seems there is no standard, standalone solution. Every project I looked at rolled their own:
Scala-JS: The JavaScript AST classes in Sébastien Doeraene's Scala-JS project are here: https://github.com/sjrd/scala-js/blob/master/compiler/src/main/scala/scala/tools/nsc/backend/js/JSTrees.scala and the conversion to strings is here: https://github.com/sjrd/scala-js/blob/master/compiler/src/main/scala/scala/tools/nsc/backend/js/JSPrinters.scala
JScala: The JavaScript AST classes in Alexander Nemish's JScala project are here: https://github.com/nau/jscala/blob/master/jscala/src/main/scala/org/jscala/model.scala and the conversion to strings is here: https://github.com/nau/jscala/blob/master/jscala/src/main/scala/org/jscala/JavascriptPrinter.scala
s2js: The JavaScript AST classes in Alvaro Carrasco's s2js project are here: https://github.com/alvaroc1/s2js/blob/master/plugin/src/main/scala/com/gravitydev/s2js/Trees.scala and the conversion to strings is here: https://github.com/alvaroc1/s2js/blob/master/plugin/src/main/scala/com/gravitydev/s2js/JsPrinter.scala
Lift (see #thoredge's answer) combines AST classes with string generation in a single file, here: https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/js/JsCommands.scala
How standalone and reusable might these various classes be? Just giving the code a visual onceover, it appears to me that the AST classes in JScala and s2js are standalone and could easily be borrowed by another project. The Scala-JS AST classes seem somewhat more entangled with their surroundings; Lift, even more so. (I welcome edits that improve on my informal impressions.)
How mature and battle-tested are these various projects? My informal impression is that they rank in descending order as follows: Lift, Scala-JS, JScala, s2js.
For my own project, I think I'm going to copy-and-paste the two source files from JScala and see how it goes.
P.S. I also mention, for completeness' sake:
js-scala generates JavaScript strings directly from Scala ASTs, rather than going through intermediate JavaScript ASTs. (See for example https://github.com/js-scala/js-scala/blob/master/core/src/main/scala/scala/js/gen/js/Compile.scala) There is a very good blog post comparing js-scala and scala.js here.
I didn't look at Scala-GWT.
The Lift web framework generates JavaScript from an AST. However, I've never looked at the generation end of it. The AST is described loosely here http://exploring.liftweb.net/master/index-10.html
StringTemplate (from ANTLR) is pretty nice for code generation, I'd say, and it does track indentation and keeps indenting nested statements at the right level. Not really pretty printing, but better than nothing. (At the same time, I wonder why you want pretty printed JavaScript, if in the end it's going to be minified anyway.)
There is a Scala wrapper for StringTemplate (at least one, I seem to recall I saw more): http://software.clapper.org/scalasti/
Virtualized-scala doesn't seem to be what you need, I'd say, since that starts with Scala a Scala AST, and that's not what you seem to have.
However, if you're interested in those sort of things as well, you might want to check http://nescala.org/2013/talks#26 (by Alvaro Carrasco) as well.
There is the Virtualized-Scala project, one of its instances is generating Javascript from Scala code, js-scala. There you will find links for projects and talks about it.
This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
Closed 9 years ago.
I am looking for the currently hardest-to-reverse JavaScript obfuscator. Bonus points if it can be run on one's own server. Performance hit and code bloat are fine.
Write it in Java, then run the bytecode in JavaScript with an obfuscated orto. That'll require two layers of decompilation in order to make any sense of it.
I'd be curious as to why you want to do this. Obfuscation offers no real protection. If you have something to protect, move it to the server-side, otherwise, why bother. If you're doing as you should and minifying/combining your JS that should be more than enough to scare away anyone not serious about knowing what your code is doing, and has performance benefits to boot. If they are serious, obfuscation isn't going to help you.
The JavaScript Code Encrypter And Obfuscator looked nice, until I actually tried to attack it. Took me about two minutes. The trivial solution:
for (i in window) { console.log(window[i]) }
That churned out a bunch of gibberish, but also the original code neatly boinked into one variable.
Note to self: Never, ever, ever, ever use anything you don't fully understand when it comes to security.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I obfuscate JavaScript?
Hi there, is there any way to encrypt code written in javascript, that's displayed in the browsers window..
The below link has a similar discussion and has answer to that.
How can I encrypt JavaScript code so that it's not decryptable?
Hope this will be helpful.
You mean that you want to obfuscate your javascript code so that others cannot read it properly?
Try jCompress or any other Javascript Minifiers
There is no way to encrypt (because otherwise the browser couldn't run the code) but you can obfuscate. Just search for 'Javascript Obfuscator' .
I wouldn't recommend this though, as obfuscators can cause bugs and it is possible to deobfuscate them.
Is there any reason why you want to encrypt the javascript?
If you mean a way to encrypt it so it can't be stolen than the answer is no. The browser needs to be able to read the code to be able to execute it. There are tools to make it harder to read for humans but in the end you can't avoid people stealing your code.
Plenty of tools available on google. 1 Example: click
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I obfuscate JavaScript?
I have been working on a web app in JavaScript. Nearing complete.
How do I protect me JavaScript code from someone copying it? I mean if you view my page source, it references the .js files and one could really steal these.
Should I be using something else? RoR?
Does Google Maps have a RoR API?
Your closest bet would be to use something like
A Javascript Obfucator
A Javascript Minifier
A Javascript Packer
People will still be able to steal and use your code though, it will just be harder to modify.