Nice2Predict is an efficient and scalable open-source framework for structured prediction. Tools such as the statistical JavaScript deobfuscator JSNice are based on Nice2Predict. Below is a schema of how the prediction works:
 

Nice2Predict overview

Nice2Predict framework and a sample client UnuglifyJS (a simpler open-source version of JavaScript deobfuscator JSNice) are available on GitHub.

UnuglifyJS client

GitHub

Nice2Predict

GitHub

Live Demo



Put your JavaScript here that you want to deminify. We will rename variables and parameters to names that we learn from thousands of open source projects. To proceed to next step click the 'extract features' button. To run this demo locally, please refer to the step by step tutorial in UnuglifyJS.
UnuglifyJS client is used to extract properties and features from the JavaScript program. The results are represented in a JSON format which the Nice2Predict server can process. The JSON consists of two parts 'query' describing the features and 'assign' describing the properties and their initial assignments with the attribute 'giv' or 'inf' for known and unknown properties respectively. For example, the feature {"a": 0, "b": 1, "f2": ":VarDef:"} defines a relation between unknown property {"v": 0, "inf": "r"} and known property {"v": 1, "giv": "length"} extracted from the code snippet 'var r = e.length;'.
The extracted properties and features and sent to the Nice2Predict server for MAP inference which calculates the most likely assignment of unknown properties. Results are visualized in the graph (Conditional Random Field) below where the known properties are brown nodes, unknown properties are cyan nodes and the edges are features. Edge labels show the feature name together with the score of the best assignment (higher score is better).
In the last step we simply take the best labels computed from MAP inference and use them to replace the corresponding variables in the original JavaScript program.
Welcome to UnuglifyJS
Welcome to a sample client of the Nice2Predict framework called UnuglifyJS — a JavaScript deminifier implementation which extracts properties and features as described in JSNice. The UnuglifyJS client takes as an input JavaScript program with minified names and is responsible for:
  • defining known and unknown properties. The known properties are program constants, objects properties, methods and global variables – that is, program parts which cannot be (soundly) renamed (e.g. the DOM APIs). The unknown properties are all local variables
  • defining features that relate properties. As an example feature is (r, length) - VarDef, which captures the fact that definition of variable r appears together with accessing attribute length in the code snippet 'var r = e.length;'
Given the extracted properties and features, we use Nice2Predict framework to train a statistical model and to answer subsequent MAP inference queries (i.e., finding the best assignment of labels to properties).

The whole process of name prediction is illustrated in four steps. To start, provide an input JavaScript or use the default one provided. For more detailed information please refer to the documentation at UnuglifyJS.

By using this service you warrant that all your entries are in your sole responsibility and do not infringe any laws or third-party rights like copyrights and the like. ETH and its employees cannot be held liable in any way. Click to learn more about Nice2Predict and the terms and conditions of use (disclaimer).

Team

Veselin Raychev

Veselin Raychev

PhD Student
Software Reliability Lab, ETH Zurich
Website

Pavol Bielik

Pavol Bielik

PhD Student
Software Reliability Lab, ETH Zurich
Website

Martin Vechev

Martin Vechev

Assistant Professor
Software Reliability Lab, ETH Zurich
Website