Upload files to "/"
This commit is contained in:
parent
0120b6356c
commit
426e17789e
1 changed files with 320 additions and 0 deletions
320
index.js
Normal file
320
index.js
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
async function main () {
|
||||||
|
function random(length) {
|
||||||
|
let result = '';
|
||||||
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
const charactersLength = characters.length;
|
||||||
|
let counter = 0;
|
||||||
|
while (counter < length) {
|
||||||
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||||
|
counter += 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
function randomEscape(length) {
|
||||||
|
let result = '';
|
||||||
|
const characters = '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f';
|
||||||
|
const charactersLength = characters.length;
|
||||||
|
let counter = 0;
|
||||||
|
while (counter < length) {
|
||||||
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||||
|
counter += 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const mc = require("minecraft-protocol");
|
||||||
|
const config = require("./config.json");
|
||||||
|
const sleep = require("system-sleep");
|
||||||
|
const fs = require("fs");
|
||||||
|
const ChatMessage = require("prismarine-chat")(config.version);
|
||||||
|
const rl = require("readline").createInterface(process.stdin, process.stdout);
|
||||||
|
|
||||||
|
var client = mc.createClient({
|
||||||
|
"host": process.argv[2].split(":")[0],
|
||||||
|
"port": parseInt(process.argv[2].split(":")[1]),
|
||||||
|
"username": randomEscape(16),
|
||||||
|
"version": config.version
|
||||||
|
})
|
||||||
|
|
||||||
|
client.trusted = [];
|
||||||
|
client.owner = [];
|
||||||
|
client.hitlist = [
|
||||||
|
".*Lennox.*",
|
||||||
|
".*Lennxx.*",
|
||||||
|
"Reggy120",
|
||||||
|
"RayWZW",
|
||||||
|
"_NotVoid",
|
||||||
|
"WorstBot",
|
||||||
|
"StalkerMan",
|
||||||
|
"StalkerBot",
|
||||||
|
"WORST BOT",
|
||||||
|
"McPlayer9966",
|
||||||
|
"TalkToMe",
|
||||||
|
"Pan_Poppo",
|
||||||
|
"NekosAreKawaii",
|
||||||
|
"ToxicKalmatar",
|
||||||
|
"Oskar.*",
|
||||||
|
"00sskkaarr22",
|
||||||
|
"0x.*",
|
||||||
|
"KU7sSzhd",
|
||||||
|
"Fatih",
|
||||||
|
"ClooperBot175",
|
||||||
|
"glitchkiller8721",
|
||||||
|
"ChomeNS Bot",
|
||||||
|
"eritig48",
|
||||||
|
"LisaTelnet",
|
||||||
|
"emirexyt192",
|
||||||
|
"TYrie29",
|
||||||
|
"kiarash11010",
|
||||||
|
"32mg",
|
||||||
|
"zXzy",
|
||||||
|
"im.zxzy",
|
||||||
|
"realzxzy_",
|
||||||
|
"zxz",
|
||||||
|
"crayonNukr",
|
||||||
|
"§§Loader§§",
|
||||||
|
"SohnasPacket",
|
||||||
|
"WhispererDodgy",
|
||||||
|
"GroxMC",
|
||||||
|
"1493028",
|
||||||
|
"obfuscators",
|
||||||
|
"nukerbot",
|
||||||
|
"gemini",
|
||||||
|
"Cloud!",
|
||||||
|
"ttproxy",
|
||||||
|
"x25",
|
||||||
|
".*NOTgod.*",
|
||||||
|
".*yoinkies.*",
|
||||||
|
".*CaydennO1[aA-zZ].*",
|
||||||
|
".*Caydenn.*"
|
||||||
|
];
|
||||||
|
|
||||||
|
client.doMuteFilter = false;
|
||||||
|
|
||||||
|
client.host = process.argv[2].split(":")[0];
|
||||||
|
client.port = parseInt(process.argv[2].split(":")[1]);
|
||||||
|
|
||||||
|
function createHash(hashType) {
|
||||||
|
switch (hashType) {
|
||||||
|
case "trusted":
|
||||||
|
client.trustedHash = random(Math.floor(Math.random() * (15 - 10) + 10));
|
||||||
|
console.log(`\x1b[107m\x1b[30m${client.host}:${client.port} Trusted Hash: ${client.trustedHash}\x1b[0m`);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "owner":
|
||||||
|
client.ownerHash = random(Math.floor(Math.random() * (25 - 20) + 20));
|
||||||
|
console.log(`\x1b[107m\x1b[30m${client.host}:${client.port} Owner Hash: ${client.ownerHash}\x1b[0m`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
client.createHash = createHash;
|
||||||
|
|
||||||
|
createHash("trusted");
|
||||||
|
createHash("owner");
|
||||||
|
|
||||||
|
rl.on("line", function (line) {
|
||||||
|
if (!String(line).startsWith("§loghash")) {
|
||||||
|
client.chat(line);
|
||||||
|
} else {
|
||||||
|
console.log(`\x1b[107m\x1b[30m${client.host}:${client.port} Trusted Hash: ${client.trustedHash}\x1b[0m`);
|
||||||
|
console.log(`\x1b[107m\x1b[30m${client.host}:${client.port} Owner Hash: ${client.ownerHash}\x1b[0m`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const plugin in config.plugins) {
|
||||||
|
try {
|
||||||
|
require(`./plugins/${config.plugins[plugin]}`).inject(client);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.toString().startsWith("Error: Cannot find module")) {
|
||||||
|
throw new client.PluginError(`Cannot find plugin "${config.plugins[plugin]}"`);
|
||||||
|
} else {
|
||||||
|
throw new client.PluginError(`Error while loading plugin "${config.plugins[plugin]}": "${err}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client.on("entity_status", function (packet) {
|
||||||
|
if (packet.entityStatus < 24 || packet.entityStatus > 28) return;
|
||||||
|
if (packet.entityStatus - 24 <= 0) {
|
||||||
|
client.chat("/minecraft:op @s[type=player]")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
client.on('game_state_change', function (packet) {
|
||||||
|
if (packet.reason == 3) {
|
||||||
|
client.chat("/minecraft:gamemode creative");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
sleep(500);
|
||||||
|
|
||||||
|
client.on("player_info", (packet) => {
|
||||||
|
if (packet.action & 0x01) {
|
||||||
|
client.tellraw("@a", [
|
||||||
|
{
|
||||||
|
color: config.publicColor.replaceAll("&", ""),
|
||||||
|
text: "Welcome "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: config.trustedColor.replaceAll("&", ""),
|
||||||
|
text: packet.data[0].player.name,
|
||||||
|
clickEvent: {
|
||||||
|
action: "suggest_command",
|
||||||
|
value: `/tell ${packet.data[0].player.name} `
|
||||||
|
},
|
||||||
|
hoverEvent: {
|
||||||
|
action: "show_text",
|
||||||
|
value: `UUID: ${packet.data[0].uuid}`,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: config.publicColor.replaceAll("&", ""),
|
||||||
|
text: " to the server."
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
setInterval( async () => {
|
||||||
|
client.players = [];
|
||||||
|
const tab_complete_list = await client.tab_complete("/v ");
|
||||||
|
for (const player in tab_complete_list) {
|
||||||
|
client.players.push(tab_complete_list[player].match);
|
||||||
|
}
|
||||||
|
}, 50)
|
||||||
|
|
||||||
|
console.log(`${config.plugins.length}/${fs.readdirSync(`${__dirname}/plugins`).length} plugins loaded`)
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
sleep(200);
|
||||||
|
client.chat("/essentials:god on");
|
||||||
|
sleep(200);
|
||||||
|
client.chat("/commandspy:commandspy on");
|
||||||
|
client.bcraw(`${config.publicColor}Prefixes: ${config.trustedColor}${config.prefix.join(`&8, ${config.trustedColor}`)}`);
|
||||||
|
setInterval(() => {
|
||||||
|
for (var i in client.hitlist) {
|
||||||
|
for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) {
|
||||||
|
client.cmdCore.run(`minecraft:deop @a[name="${j}"]`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 10)
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
for (var i in client.hitlist) {
|
||||||
|
for (var i in client.hitlist) {
|
||||||
|
for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) {
|
||||||
|
client.cmdCore.run(`minecraft:gamemode spectator @a[name="${j}"]`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 10)
|
||||||
|
|
||||||
|
|
||||||
|
/* setInterval(() => {
|
||||||
|
if (client.doMuteFilter) {
|
||||||
|
for (var i in client.hitlist) {
|
||||||
|
for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) {
|
||||||
|
client.cmdCore.run(`essentials:mute ${j.replaceAll(" ", "?")} 10y Blacklisted by RadiumBot`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1500) */
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
for (var i in client.hitlist) {
|
||||||
|
for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) {
|
||||||
|
client.kick(`@a[name="${j}"]`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
client.on("systemChat", function (packet) {
|
||||||
|
try {
|
||||||
|
var msg = new ChatMessage(JSON.parse(packet.formattedMessage))
|
||||||
|
if (String(msg).startsWith("Command set: ") || String(msg).startsWith("Can't deliver chat message, check server logs: ")) return;
|
||||||
|
console.log("[%s:%d] %s", client.host, client.port, msg.toAnsi());
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
if (String(msg).startsWith("Successfully disabled CommandSpy")) {
|
||||||
|
sleep(50);
|
||||||
|
client.chat("/commandspy:commandspy on");
|
||||||
|
} else
|
||||||
|
if (String(msg).startsWith("You have been muted")) {
|
||||||
|
sleep(50);
|
||||||
|
client.chat("/essentials:mute " + client.uuid);
|
||||||
|
} else
|
||||||
|
if (String(msg).startsWith(`Vanish for ${client.username}: disabled`)) {
|
||||||
|
sleep(50);
|
||||||
|
client.chat("/essentials:vanish on");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
client.on("playerChat", function (packet) {
|
||||||
|
try {
|
||||||
|
var msg = new ChatMessage(JSON.parse(packet.unsignedContent));
|
||||||
|
console.log("[%s:%d] %s", client.host, client.port, msg.toAnsi());
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
for (var prefix of config.prefix) {
|
||||||
|
if (String(packet.plainMessage).startsWith(prefix)) {
|
||||||
|
const args = String(packet.plainMessage).slice(prefix.length).trim().split(/ +/);
|
||||||
|
const cmd = args.shift();
|
||||||
|
client.cmd = cmd;
|
||||||
|
client.args = args;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!cmd.includes(".") || !cmd.includes("/")) {
|
||||||
|
if (require(`./commands/${cmd}.js`).trustLevel === 1) {
|
||||||
|
if (args[0] == "" + client.trustedHash + "" || client.trusted.includes(packet.sender)) {
|
||||||
|
require(`./commands/${cmd}.js`).inject(client, packet);
|
||||||
|
client.runCommand(args);
|
||||||
|
if (!client.trusted.includes(packet.sender)) {
|
||||||
|
createHash("trusted");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
client.cmdError("Invalid trusted hash");
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (require(`./commands/${cmd}.js`).trustLevel === 2) {
|
||||||
|
if (args[0] == "" + client.ownerHash + "" || client.owner.includes(packet.sender)) {
|
||||||
|
require(`./commands/${cmd}.js`).inject(client, packet);
|
||||||
|
client.runCommand(args);
|
||||||
|
if (!client.owner.includes(packet.sender)) {
|
||||||
|
createHash("owner");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
client.cmdError("Invalid owner hash");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
require(`./commands/${cmd}.js`).inject(client, packet);
|
||||||
|
client.runCommand(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (err.message.startsWith("Cannot find module")) {
|
||||||
|
client.cmdError("Command not found");
|
||||||
|
} else {
|
||||||
|
client.cmdError(err.toString())
|
||||||
|
}
|
||||||
|
console.log(err.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
client.on("error", async (err) => {
|
||||||
|
console.log(err);
|
||||||
|
})
|
||||||
|
|
||||||
|
client.on("end", async (reason) => {
|
||||||
|
sleep(5000)
|
||||||
|
rl.removeAllListeners()
|
||||||
|
console.error("Disconnected: " +reason)
|
||||||
|
console.log("Disconnected. Relogging...")
|
||||||
|
main()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
Loading…
Reference in a new issue