0% found this document useful (0 votes)
9 views3 pages

Message

The document is a userscript designed for the website sploop.io, which modifies the behavior of JavaScript code execution on the site. It includes a class for handling regular expressions and various methods for matching, replacing, and manipulating code. The script also implements hooks to alter specific functions and variables within the site's code for customization purposes.

Uploaded by

liamoleary0909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Message

The document is a userscript designed for the website sploop.io, which modifies the behavior of JavaScript code execution on the site. It includes a class for handling regular expressions and various methods for matching, replacing, and manipulating code. The script also implements hooks to alter specific functions and variables within the site's code for customization purposes.

Uploaded by

liamoleary0909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

// ==UserScript==

// @name nigger
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description
// @author
// @run-at document-start
// @match https://sploop.io/
// @icon https://sploop.io/img/ui/favicon.png
// @grant none
// ==/UserScript==

const TYPEOF = value => Object.prototype.toString.call(value).slice(8, -


1).toLowerCase();
const NumberSystem = [
{ radix: 2, prefix: "0b0*" },
{ radix: 8, prefix: "0+" },
{ radix: 10, prefix: "" },
{ radix: 16, prefix: "0x0*" }
];
class Regex {
constructor(code, unicode) {
this.code = this.COPY_CODE = code;
this.unicode = unicode || false;
this.hooks = {};
};
static parseValue = value => {
try { return Function(`return (${value})`)(); }
catch (err) { return null; }
};
isRegexp = value => TYPEOF(value) === "regexp";
generateNumberSystem = int => `(?:${NumberSystem.map(({ prefix, radix }) =>
prefix + int.toString(radix)).join("|")})`;
parseVariables = regex => regex.replace(/\{VAR\}/g, "(?:let|var|const)")
.replace(/\{QUOTE\}/g, "['\"`]")
.replace(/ARGS\{(\d+)\}/g, (_, count) => (Array(Number(count)).fill("\\
w+")).join("\\s*,\\s*"))
.replace(/NUMBER\{(\d+)\}/g, (_, int) =>
this.generateNumberSystem(Number(int)));
format = (name, inputRegex, flags) => {
const regex = Array.isArray(inputRegex) ? inputRegex.map(exp =>
this.isRegexp(exp) ? exp.source : exp).join("\\s*") : this.isRegexp(inputRegex) ?
inputRegex.source : "";
let parsedRegex = this.parseVariables(regex);
if (this.unicode) {
parsedRegex = parsedRegex.replace(/\\w/g, "(?:[^\\x00-\\x7F-]|\\$|\\
w)");
};
const expression = new RegExp(parsedRegex.replace(/\{INSERT\}/, ""),
flags);
return parsedRegex.includes("{INSERT}") ? new RegExp(parsedRegex, flags) :
expression;
};
template = (type, name, regex, substr) => {
const expression = new RegExp(`(${this.format(name, regex).source})`);
const match = this.code.match(expression) || [];
this.code = this.code.replace(expression, type === 0 ? "$1" + substr :
substr + "$1");
return match;
};
match = (name, regex, flags, debug = false) => {
const expression = this.format(name, regex, flags);
const match = this.code.match(expression) || [];
this.hooks[name] = { expression, match };
return match;
};
matchAll = (name, regex, debug = false) => {
const expression = this.format(name, regex, "g");
const matches = [...this.code.matchAll(expression)];
this.hooks[name] = { expression, match: matches };
return matches;
};
replace = (name, regex, substr, flags) => {
const expression = this.format(name, regex, flags);
this.code = this.code.replace(expression, substr);
return this.code.match(expression) || [];
};
replaceAll = (name, regex, substr, flags) => {
const expression = this.format(name, regex, "g");
this.code = this.code.replaceAll(expression, substr);
return this.code.match(expression) || [];
};
append = (name, regex, substr) => this.template(0, name, regex, substr);
prepend = (name, regex, substr) => this.template(1, name, regex, substr);
insert = (name, regex, substr) => {
const { source } = this.format(name, regex);
if (!source.includes("{INSERT}")) throw new Error("Your regexp must contain
{INSERT} keyword");
const findExpression = new RegExp(source.replace(/^(.*)\{INSERT\}(.*)$/,
"($1)($2)"));
this.code = this.code.replace(findExpression, `$1${substr}$2`);
return this.code.match(findExpression);
};
};

let Sploop;
const applyHooks = code => {
const Hook = new Regex(code, true);
window.COPY_CODE = (Hook.COPY_CODE.match(/^(\(function \w+\(\w+\)\{.+)\(.+?\);
$/) || [])[1];
Hook.append("EXTERNAL fix", /\(function (\w+)\(\w+\)\{/, "let $2 = eval(`(() =>
${COPY_CODE})()`);delete window.COPY_CODE;");
for(let a = 0; a !== 2; a++) Hook.replace("a", /&&\w+\(\)&&\w+\(\)\.\w+&&1===\
w+\(\)\.\w+\[\w+\(\)\.\w+\(\w+\)\]/, ``);
Hook.replace("idgay", /"ID "/, `""`);
/*
Hook.replace("defzoomheightgay", /1026/, "1500");
Hook.replace("defzoomwidthgay", /1824/, "2300"); // change the values in the
quotes to the right for higher/lower zoom. Render distance is static so it might
look a little weird
*/
Hook.append("showHoods", /\w+\.\w+!==\w+\)/, `||true`);
return Hook.code;
};

window.eval = new Proxy(window.eval, {


apply(target, _this, args) {
const code = args[0];
if (code.length > 1e5) {
args[0] = applyHooks(code);
window.eval = target;
target.apply(_this, args);
return;
}
return target.apply(_this, args);
}
});

You might also like