v0.6, added alot more selfcare, validations, and selfcare

This commit is contained in:
Parker2991
2024-12-18 12:28:22 -05:00
parent 74717cabeb
commit 4c5b2f0c5f
22 changed files with 574 additions and 62 deletions
+3
View File
@@ -7,3 +7,6 @@ config.yml
src/modules/exploits.js
.git
src/modules/custom_chat.js
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "SkyBot",
"version": "0.5",
"name": "SkiBot",
"version": "0.6",
"lockfileVersion": 3,
"requires": true,
"packages": {
+283
View File
@@ -0,0 +1,283 @@
module.exports = {
data: {
description: "parses chat",
enabled: true,
name: "chat",
type: "logging"
},
inject (context) {
const bot = context.bot;
const config = context.config;
bot.on('packet.player_chat', (data) => {
const unsigned = data.unsignedChatContent;
try {
switch (data.type) {
case 1:
break;
case 3:
bot.emit('playerChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Player Chat', color: 'dark_purple' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: data.type, color: 'gold' },
],
},
{ translate: "commands.message.display.outgoing",
with: [
JSON.parse(data.networkName).insertion,
data.plainMessage
],
color: "gray",
italic: true
}
])
break
case 2:
bot.emit('playerChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Player Chat', color: 'dark_purple' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: data.type, color: 'gold' },
],
},
{ translate: "commands.message.display.incoming",
with: [
JSON.parse(data.networkName).insertion,
data.plainMessage
],
color: "gray",
italic: true
}
])
break
case 4:
bot.emit('playerChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Player Chat', color: 'dark_purple' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: data.type, color: 'gold' },
],
},
JSON.parse(unsigned)
])
break;
case 5:
bot.emit('playerChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Player Chat', color: 'dark_purple' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: data.type, color: 'gold' },
],
},
{ translate: "chat.type.announcement",
with: [
JSON.parse(data.networkName).insertion,
data.plainMessage
]
}
]);
break;
default:
console.warn('invalid chat type');
}
} catch (e) {
console.log(e.stack);
}
})
bot.on('packet.profileless_chat', (packet) => {
const message = JSON.parse(packet.message)
const sender = JSON.parse(packet.name)
switch (packet.type) {
case 1:
bot?.emit('profilelessChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Profileless Chat', color: 'dark_aqua' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type, color: 'gold' },
],
},
{ translate: "chat.type.emote",
with: [
sender,
message
]
}
])
break
case 2:
bot.emit('profilelessChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Profileless Chat', color: 'dark_aqua' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type, color: 'gold' },
],
},
{ translate: "commands.message.display.incoming",
with: [
sender,
message
],
color: "gray",
italic: true
}
])
break
case 3:
bot.emit('profilelessChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Profileless Chat', color: 'dark_aqua' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type, color: 'gold' },
],
},
{ translate: "commands.message.display.outgoing",
with: [
sender,
message
],
color: "gray",
italic: true
}
])
break
case 4:
bot.emit('profilelessChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Profileless Chat', color: 'dark_aqua' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type, color: 'gold' },
],
},
message
])
break
case 5:
bot.emit('profilelessChat', [
{
translate: "[%s %s %s%s %s] ",
color: "dark_gray",
with: [
{ text: 'Profileless Chat', color: 'dark_aqua' },
{ text: '|' },
{ text: 'Packet Type', color: "aqua" },
{ text: ':' },
{ text: packet.type, color: 'gold' },
],
},
{ translate: 'chat.type.announcement',
with: [
sender,
message
]
}
])
break
}
});
bot.on('packet.system_chat', packet => {
const message = JSON.parse(packet.content)
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
if (message.translate === 'multiplayer.message_not_delivered') return;
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
if (packet.isActionBar) {
return
}
bot.emit('systemChat', [
{
translate: "[%s] ",
color: "dark_gray",
with: [
{ text: 'System Chat', color: 'dark_blue' },
],
},
message
]);
bot.emit('system_chat', message); // this is for selfcare
});
/* bot.chat = {
send (args) {
if (args.startsWith('/')) {
bot._client.write('chat_command', {
command: args?.substring(1).substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
return;
}
const acc = 0;
const bitset = Buffer.allocUnsafe(3);
bitset[0] = acc & 0xFF;
bitset[1] = (acc >> 8) & 0xFF;
bitset[2] = (acc >> 16) & 0xFF;
bot._client.write('chat_message', {
message: args?.substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
},
tellraw (selector, message) {
bot.core.run(`minecraft:tellraw ${selector} ${JSON.stringify(message)}`);
}
}*/
}
}
+4
View File
@@ -5,6 +5,10 @@ module.exports = {
aliases: [
"cb",
"corerun"
],
description: "run commands in core",
usages: [
"<command>"
]
},
execute (context) {
+4
View File
@@ -5,6 +5,10 @@ module.exports = {
aliases: [
"say",
"botsay"
],
description: "send things in chat",
usages: [
"<message>"
]
},
execute (context) {
+62
View File
@@ -0,0 +1,62 @@
const crypto = require('crypto');
module.exports = {
data: {
name: "validate",
enabled: true,
aliases: [
"val"
],
description: "validate through bots",
usages: [
"chomens <arguments>",
"fnfboyfriendbot <arguments>",
"qbot <arguments>",
"sbot <arguments>",
"testbot <arguments>",
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let hash;
switch (args[0]) {
case "chomens":
const time = Math.floor(Date.now() / 5_000)
const value = bot.uuid + args.slice(1) + time + config.bots.chomens.key
hash = crypto.createHash('sha256').update(value).digest('hex').substring(0, 16)
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.chomens.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
} else {
bot.chat(`${config.bots.chomens.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
}
break;
case "fnfboyfriendbot":
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.bots.fnfboyfriendbot.key).digest("hex").substring(0, 16);
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.fnfboyfriendbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`)
} else {
bot.chat(`${config.bots.fnfboyfriendbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
}
break;
case "qbot":
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.bots.qbot.key).digest("hex").substring(0, 16);
if (bot.customChat.enabled) {
bot.customChat.chat(`${config.bots.qbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
} else {
bot.chat(`${config.bots.qbot.prefix}${args.slice(1).shift()} ${hash} ${args.slice(2).join(' ')}`);
}
break;
case "sbot":
break;
case "testbot":
break;
default:
console.warn('unknown argument');
}
}
}
+2 -7
View File
@@ -1,16 +1,11 @@
bots:
chomens:
prefix: "*"
keys:
trusted: ""
admin: ""
key: ""
fnfboyfriendbot:
prefix: "~"
keys:
trusted: ""
admin: ""
owner: ""
key: ""
qbot:
prefix: "]"
+28
View File
@@ -0,0 +1,28 @@
module.exports = {
data: {
description: "pretty self explanatory",
enabled: true,
name: "custom chat",
type: "extras"
},
inject (context) {
const bot = context.bot;
bot.customChat = {
enabled: true,
chat (args) {
const prefix = {
translate: "chat.type.text",
with: [
{ selector: `${bot.username}` },
{
text: '',
extra: [ args ]
}
]
}
bot.tellraw("@a", prefix);
}
}
}
}
+20
View File
@@ -0,0 +1,20 @@
module.exports = {
data: {
description: "server exploits :3",
enabled: true,
name: "exploits",
type: "extras",
},
inject (context) {
const bot = context.bot;
bot.exploits = {
kicks: {
},
crashes: {
}
}
}
}
+16
View File
@@ -10,6 +10,22 @@ if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
)
}
if (!fs.existsSync(path.join(__dirname, "./modules/custom_chat.js"))) {
console.warn("custom chat format not found recreating from default custom chat format");
fs.copyFileSync(
path.join(__dirname, "./data/default_custom_chat.js"),
path.join(__dirname, "./modules/custom_chat.js")
)
}
if (!fs.existsSync(path.join(__dirname, "./modules/exploits.js"))) {
console.warn("exploits module not found recreating from default exploits");
fs.copyFileSync(
path.join(__dirname, "./data/default_exploits.js"),
path.join(__dirname, "./modules/exploits.js")
)
}
try {
config = load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')));
} catch (e) {
+5 -2
View File
@@ -1,6 +1,7 @@
module.exports = {
data: {
description: "parses chat",
enabled: true,
name: "chat",
type: "logging"
@@ -225,7 +226,7 @@ module.exports = {
if (message.translate === 'multiplayer.message_not_delivered') return;
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
// bot.emit('system_chat', { message, actionbar: packet.isActionBar })
if (packet.isActionBar) {
return
@@ -240,7 +241,9 @@ module.exports = {
],
},
message
])
]);
bot.emit('system_chat_selfcare', message); // this is for selfcare
});
bot.chat = (args) => {
+1
View File
@@ -3,6 +3,7 @@ const nbt = require('prismarine-nbt');
module.exports = {
data: {
description: "runs commands in command blocks",
enabled: true,
name: "command core",
type: "commands"
+2 -1
View File
@@ -3,6 +3,7 @@ const path = require('path')
module.exports = {
data: {
description: "registers commands",
enabled: true,
name: "command manager",
type: "commands"
@@ -18,7 +19,7 @@ module.exports = {
const command = bot.commandManager.getCommand(commandName?.toLowerCase())
try {
if (!command || !command.execute) console.error('unknown command');
if (!command || !command.execute) bot.console.command('unknown command');
return command?.execute({ bot, config, arguments: args, MessageBuilder })
} catch (error) {
console.error(error)
+33 -10
View File
@@ -5,10 +5,9 @@ const rl = readline.createInterface({
output: process.stdout,
});
const CommandSource = require('../util/command_source');
module.exports = {
data: {
description: "logs chat to console",
enabled: true,
name: "console",
type: "logging"
@@ -16,33 +15,57 @@ module.exports = {
inject (context) {
const bot = context.bot;
const config = context.config;
rl.on('line', (args) => {
if (args.startsWith(config.console.prefix)) {
return bot.commandManager.executeString(args.substring(config.console.prefix.length));
} else if (args.startsWith('')) {
bot.commandManager.executeString(`echo ${args.substring(0)}`);
if (bot.customChat.enabled) {
if (args.startsWith('/')) {
bot.chat(`/${args.substring(1)}`);
return;
}
bot.customChat.chat(args.substring(0));
} else {
bot.commandManager.executeString(`echo ${args.substring(0)}`);
}
}
});
log = function (...args) {
refreshLine = function (...args) {
rl.output.write("\x1b[2K\r");
console.log(args.toString());
rl._refreshLine();
}
bot.console = {
log (message) {
refreshLine(`${fromNotch("§8[§6logs§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
},
command (message) {
refreshLine(`${fromNotch("§8[§ecommand§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
},
disconnect (reason) {
refreshLine(`${fromNotch("§8[§bdisconnect§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
},
warn (error) {
refreshLine(`${fromNotch("§8[§cwarn§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
},
error (error) {
refreshLine(`${fromNotch("§8[§4error§8]§r")?.toAnsi()} ${fromNotch(message)?.toAnsi(require('../data/language.json'))}`)
}
}
bot.on('playerChat', (message) => {
const ansi = fromNotch(message)?.toAnsi();
log(ansi);
bot.console.log(message);
});
bot.on('profilelessChat', (message) => {
const ansi = fromNotch(message)?.toAnsi();
log(ansi);
bot.console.log(message);
});
bot.on('systemChat', (message) => {
const ansi = fromNotch(message)?.toAnsi();
log(ansi);
bot.console.log(message);
});
}
}
+29
View File
@@ -0,0 +1,29 @@
module.exports = {
data: {
description: "logs disconnect messages",
enabled: true,
name: "disconnect",
type: "client"
},
inject (context) {
const bot = context.bot;
const config = context.config;
bot.on("disconnect", (data) => {
});
bot.on("end", (data) => {
});
bot.on("error", (data) => {
});
bot.on("kick_disconnect", (data) => {
});
}
}
+1
View File
@@ -1,5 +1,6 @@
module.exports = {
data: {
description: "where the bot is at",
enabled: true,
name: "position",
type: "client"
+1
View File
@@ -2,6 +2,7 @@ const mc = require('minecraft-protocol');
module.exports = {
data: {
description: "reconnects the players to the server",
enabled: true,
name: "reconnect",
type: "client"
+3 -2
View File
@@ -2,14 +2,15 @@ const registry = require('prismarine-registry');
module.exports = {
data: {
description: "registers the client data",
name: 'registry',
type: 'client',
enabled: true
},
inject (context) {
let bot = context.bot;
const bot = context.bot;
bot.on('login', packet => {
bot.registry = registry(bot.version)
bot.registry = registry(bot._client.version)
bot.registry.language = require('../data/language.json');
bot.emit('registry_ready', bot.registry)
});
+75 -3
View File
@@ -1,5 +1,7 @@
const { fromNotch } = require('prismarine-chat')('1.20.2');
module.exports = {
data: {
description: "self explanatory",
enabled: true,
name: "selfcare",
type: "client"
@@ -9,8 +11,46 @@ module.exports = {
const config = context.config;
let entityId;
let permission = 2
let permission = 2;
let gameMode;
let positionCount = 0;
let mute = false;
let god = false;
let commandSpy = false;
let prefix = false;
let vanish = false;
let nick = false;
let username = false;
bot.on("system_chat_selfcare", (message) => {
const parsedMessage = fromNotch(message)?.toMotd();
if (parsedMessage?.startsWith("§6You have been muted")) mute = true;
else if (parsedMessage?.startsWith("§6You have been unmuted")) mute = false;
else if (parsedMessage?.startsWith("§6Your voice has been silenced")) mute = true;
else if (parsedMessage === "§6God mode§c enabled§6.") god = true;
else if (parsedMessage === "§6God mode§c disabled§6.") god = false;
else if (parsedMessage === "Successfully enabled CommandSpy") commandSpy = true;
else if (parsedMessage === "Successfully disabled CommandSpy") commandSpy = false;
else if (parsedMessage === "Successfully disabled CommandSpy.") commandSpy = false;
else if (parsedMessage === "Successfully enabled CommandSpy.") commandSpy = true;
else if (parsedMessage?.startsWith("You now have the tag:")) prefix = true;
else if (parsedMessage === "You no longer have a tag" || parsedMessage === "Something went wrong while saving the prefix. Please check console.") prefix = false;
else if (parsedMessage === `§6Vanish for ${bot.server.username}: enabled`) vanish = true;
else if (parsedMessage === `§6Vanish for §c${bot.server.username}§6: disabled`) vanish = false;
else if (parsedMessage?.startsWith('§6Your nickname is now')) nick = true;
else if (parsedMessage === "§6You no longer have a nickname.") nick = false;
else if (parsedMessage?.startsWith("Successfully set your username to ") || parsedMessage?.endsWith(`${bot.server.username}`)) username = true;
else if (parsedMessage === `Successfully set your username to "${bot.server.username}"`) username = false;
else if (parsedMessage === `You already have the username "${bot.server.username}"`) username = false;
});
bot.on('packet.entity_status', (data) => {
if (data.entityId !== entityId || data.entityStatus < 24 || data.entityStatus > 28) return;
@@ -23,16 +63,48 @@ module.exports = {
gameMode = data.gameMode;
});
bot.on("packet.position", (packet, position) => {
if (!config.selfcare.icu) return;
positionCount++
setTimeout(() => {
positionCount--
if (positionCount > 4) {
bot.core.run('sudo * icu stop');
} if (permissionLevel < 2 || gameMode !== 1) {
bot._client.end('anti icu :3');
}
}, 1000)
})
let timer;
bot.on('packet.login', (data) => {
entityId = data.entityId;
gameMode = data.gameMode;
timer = setInterval(() => {
if (permission < 2) bot.chat("/minecraft:op @s[type=player]");
else if (gameMode !== 1) bot.chat("/minecraft:gamemode creative");
if (permission < 2 && config.selfcare.op) bot.chat("/minecraft:op @s[type=player]");
else if (gameMode !== 1 && config.selfcare.gamemode) bot.chat("/minecraft:gamemode creative");
else if (!commandSpy && config.selfcare.cspy) bot.chat('/cspy on');
else if (prefix && config.selfcare.prefix) bot.chat('/prefix off');
else if (!vanish && config.selfcare.vanish) bot.chat('/vanish on');
else if (username && config.selfcare.username) bot.chat(`/username ${bot.server.username}`);
else if (mute && config.selfcare.mute) bot.core.run(`essentials:mute ${bot.uuid}`);
else if (!god && config.selfcare.god) bot.core.run(`god ${bot.server.username} on`);
else if (nick && config.selfcare.nick) bot.core.run(`nick ${bot.server.username} off`);
else if (gameMode !== 4) bot._client.write("client_command", { actionId: 0 });
}, 1000);
});
bot.on('end', () => {
if (timer) clearInterval(timer);
commandSpy = false;
god = false;
mute = false;
prefix = false;
vanish = false;
nick = false;
username = false;
});
}
}
-19
View File
@@ -1,19 +0,0 @@
const registry = require('prismarine-registry');
module.exports = {
data: {
name: 'test',
type: 'client',
enabled: false
},
inject (context) {
let bot = context.bot;
bot.end();
/* bot.on('login', packet => {
bot.registry = registry(bot.version)
bot.registry.language = require('../data/language.json');
bot.emit('registry_ready', bot.registry)
});*/
}
}
-10
View File
@@ -1,10 +0,0 @@
module.exports = {
data: {
enabled: true,
name: "validation",
type: "bot validation shit"
},
inject (context) {
}
}
-6
View File
@@ -1,6 +0,0 @@
class CommandSource {
constructor (player) {
this.player = player;
}
}
module.exports = CommandSource