One common technique I use is xor bruteforcing on binary data. In this case, I would like a heuristic approach to determine whether or not any possible candidate plaintexts are javascript. This rules out the file command in unix like systems because it is merely recognized as ASCII text.

I am looking for suggestions on how to solve this problem (Tools, Techniques, Procedures).

  • You want a javascript syntax validator and probably also json, to check if it is valid js/json. If you want to identify invalid js as well, like partial js or improperly formatted, you have your work cut out for you. And obviously before you get that far, attempt to format the binary to text. Ascii, utf-8, etc. If the binary isn't even a valid text format, no need to look for valid js. Commented Oct 21, 2014 at 14:23

1 Answer 1


Searching for script headers <script> is a pretty good giveaway, not really necessary, also searching for function-based language with the format ******(***) is helpful. The 'function' declaration is pretty obvious, as is 'var' As far as whether or not it is JavaScript per-se and not a similar language can be a challenging task. Really, though, looking for elements of javascript formatting and syntax that doesn't exist in other languages is going to be your dead giveaway. I have most of my experience with c++, and that's what I would be looking for.

Edit: Also, if it's not valid text it can't be a js, as suggested in the comments. Unless you are looking for compiled executables based on js... in which case... eek.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .