Userscripts : Beautifier + Deobfuscator

By w35l3y Last update Mar 12, 2011 — Installed 1,107 times.

There are 20 previous versions of this script.

// ==UserScript==
// @name           Userscripts : Beautifier + Deobfuscator
// @namespace      http://gm.wesley.eti.br/userscripts
// @description    Deobfuscates scripts
// @author         w35l3y
// @email          w35l3y@brasnet.org
// @copyright      2009, w35l3y (http://gm.wesley.eti.br)
// @license        GNU GPL
// @homepage       http://gm.wesley.eti.br
// @version        1.1.0.0
// @language       en
// @include        http://userscripts.org/scripts/review/*
// @include        http://greasefire.userscripts.org/scripts/review/*
// @include        http://userscripts.org/scripts/version/*.user.js?format=txt
// @include        http://greasefire.userscripts.org/scripts/version/*.user.js?format=txt
// @resource       meta http://userscripts.org/scripts/source/58687.meta.js
// @resource       i18n http://i18n.pastebin.com/download.php?i=U5SnFgKz
// @require        http://userscripts.org/scripts/source/63808.user.js
// @require        http://userscripts.org/scripts/source/85618.user.js
// @require        http://userscripts.org/scripts/source/87940.user.js
// @require        http://userscripts.org/scripts/source/87942.user.js
// @require        http://userscripts.org/scripts/source/87269.user.js
// @require        https://github.com/einars/js-beautify/raw/master/beautify.js
// @history        1.1.0.0 Updated @require #87269
// @history        1.0.6.0 Fixed incompatibility with the latest version of @require #87269
// @history        1.0.5.3 Updated @require #87269
// @history        1.0.5.2 Changed github @require protocol (http->https)
// @history        1.0.5.1 Added i18n, updater and support for "atob"
// ==/UserScript==

/**************************************************************************

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

**************************************************************************/

(function(loc)
{
	var source = xpath({
		"review" : "id('source')",
		"diff" : "id('content')/pre",
		"version" : "./html/body/pre",
		"default" : "./html"
	}[loc[1]||"default"])[0];
	
	if (loc[1])
	source.textContent = JsCode.deobfuscate(source.textContent, eval(GM_getValue("scripts", "({})"))[loc[2]]);
	else
	{
		var pre = document.createElement("pre");
		pre.textContent = JsCode.deobfuscate(source.textContent);
		source.parentNode.replaceChild(pre, source);
	}

	/*
	var head = document.getElementById("heading"),
	decode = document.createElement("div");
	decode.setAttribute("id", "install_script");
	decode.innerHTML = '<a class="userjs" href="javascript:void(0)">Decode</a>';
	head.parentNode.insertBefore(decode, head);
	
	decode.firstChild.addEventListener("click", function(e)
	{
		// ...
	
		alert("Done");
	}, false);
	*/
})(location.pathname.match(/^\/scripts\/(\w+)\/(\d+)/));