Compare commits
9 Commits
143d726dc0
...
e5a8baaa81
Author | SHA1 | Date | |
---|---|---|---|
e5a8baaa81 | |||
f963db9432 | |||
907574b55c | |||
ce7f610d31 | |||
2f939a95b1 | |||
0809dcd526 | |||
c97dc71130 | |||
1bc19fc8e9 | |||
d35e29559d |
1
.gitignore
vendored
1
.gitignore
vendored
@ -131,3 +131,4 @@ dist
|
||||
|
||||
.env
|
||||
config/config.json
|
||||
TODO
|
@ -1,10 +1,10 @@
|
||||
FROM node:16
|
||||
FROM node:18
|
||||
RUN apt update && apt install -y python3 python3-pip wget
|
||||
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
||||
WORKDIR /home/node/app
|
||||
USER node
|
||||
COPY --chown=node:node lib/banter/requirements.txt .
|
||||
RUN pip3 install -r requirements.txt
|
||||
RUN pip3 install -r requirements.txt --break-system-packages
|
||||
COPY --chown=node:node package*.json ./
|
||||
RUN npm i
|
||||
COPY --chown=node:node . .
|
||||
|
211
bot.js
211
bot.js
@ -1,11 +1,13 @@
|
||||
var config = require('./config/config.json')
|
||||
var irc = require("irc");
|
||||
var fs = require("fs");
|
||||
var readline = require('readline');
|
||||
var path = require('path');
|
||||
var randomext = require('./lib/randomnum');
|
||||
const { Worker } = require('worker_threads');
|
||||
//var randomWords = require('better-random-words');
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
const msgTimeout = new Set();
|
||||
const msgTimeoutMsg = new Set();
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
var hostmask = null
|
||||
|
||||
var bot = new irc.Client(config.irc.server, config.irc.nickname, {
|
||||
channels: config.irc.channels,
|
||||
@ -18,56 +20,28 @@ var bot = new irc.Client(config.irc.server, config.irc.nickname, {
|
||||
floodProtectionDelay: config.floodprotect.flood_protection_delay
|
||||
});
|
||||
|
||||
const msgTimeout = new Set();
|
||||
const msgTimeoutMsg = new Set();
|
||||
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
const generateRandomString = (amt) => {
|
||||
const chars =
|
||||
"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890`!@#$%^&*()_+{}|\"\',./ᘈᷞኬᲡ᩶ᐨᅚ⸗⡳ᾟⓅᤲ⧛ሥ⸰⯠ᬨ⧻Შ⼷ᢕ᭄◁ⱉጻ᪅⎑ᘂᏤ⛰⃡";
|
||||
const randomArray = Array.from(
|
||||
{ length: amt },
|
||||
(v, k) => chars[Math.floor(Math.random() * chars.length)]
|
||||
);
|
||||
const randomString = randomArray.join("");
|
||||
return randomString;
|
||||
}
|
||||
|
||||
async function help(chan) {
|
||||
bot.say(chan, 'Fascinus - https://git.supernets.org/hogwart7/fascinus')
|
||||
bot.say(chan, "$flood [AMOUNT (max=10000)] [TEXT] - Floods the channel with a specific line x amount of times")
|
||||
bot.say(chan, "$ctcpflood [TARGET] [TEXT (one word)] [AMOUNT] - Sends x amount of CTCP requests to a target.")
|
||||
bot.say(chan, "$sneed - Pastes the Sneed's Feed and Seed copypasta.")
|
||||
bot.say(chan, "$rspam [LINES (def=100, max=10000)] - Spams x lines of random characters")
|
||||
bot.say(chan, "$uspam [LINES (def=100, max=10000)] - Spams x lines of random unicode characters of varying length")
|
||||
bot.say(chan, "$art [IMAGE URL (png/jpg/webp/jpeg)] - Creates IRC art using a source image.")
|
||||
bot.say(chan, "$godwords [AMOUNT (def=50, max=100000)] - Generate x amount of random words. Inspired by TempleOS.")
|
||||
}
|
||||
|
||||
async function flood(chan, arg) {
|
||||
arg.shift() //$flood
|
||||
let amt = arg.shift() //number
|
||||
var text = arg.join(" ")
|
||||
if (amt > 100000) {
|
||||
bot.say(chan, "no");
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
for(var i=0; i < amt; i++){
|
||||
bot.say(chan, text);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function sneed(chan) {
|
||||
bot.say(chan, 'THE SIGN IS A SUBTLE JOKE. THE SHOP IS CALLED \"SNEED\'S FEED & SEED\", WHERE')
|
||||
bot.say(chan, 'FEED AND SEED BOTH END IN THE SOUND "-EED", THUS RHYMING WITH THE NAME OF')
|
||||
bot.say(chan, 'THE OWNER, SNEED. THE SIGN SAYS THAT THE SHOP WAS "FORMERLY CHUCK\'S", IMPLYING')
|
||||
bot.say(chan, 'THAT THE TWO WORDS BEGINNING WITH "F" AND "S" WOULD HAVE ENDED WITH "-UCK",')
|
||||
bot.say(chan, 'RHYMING WITH "CHUCK". SO, WHEN CHUCK OWNED THE SHOP, IT WOULD HAVE BEEN CALLED')
|
||||
bot.say(chan, '"CHUCK\'S FUCK AND SUCK".')
|
||||
function openPostWorker(chan, command, d1, d2, d3, d4, d5, d6) {
|
||||
consoleLog(`[bot.openPostWorker] Opening ${command} worker`)
|
||||
const worker = new Worker(`./commands/${command}.js`, {
|
||||
workerData: {
|
||||
d1, d2, d3, d4, d5, d6 //d1-d6 equate to variables you can pass in to a worker, see the example1 block below for an example (var1 there is d1 here). Further defined in individual command files.
|
||||
}
|
||||
});
|
||||
worker.once('message', (string) => {
|
||||
consoleLog(`[bot.openPostWorker.finalising] Got output from ${command}, sending to `+chan);
|
||||
bot.say(chan, string);
|
||||
});
|
||||
}
|
||||
|
||||
async function ctcp(target, text, amt) {
|
||||
async function ctcp(target, text, amt) { //This can not be moved to its own file due to the nature of how it works
|
||||
if (amt > 10000) {
|
||||
bot.say(chan, "no");
|
||||
} else {
|
||||
@ -78,123 +52,37 @@ async function ctcp(target, text, amt) {
|
||||
}
|
||||
}
|
||||
|
||||
async function help(chan) {
|
||||
openPostWorker(chan, 'help')
|
||||
}
|
||||
|
||||
async function flood(chan, arg) {
|
||||
openPostWorker(chan, 'flood', arg)
|
||||
}
|
||||
|
||||
async function sneed(chan) {
|
||||
openPostWorker(chan, 'sneed')
|
||||
}
|
||||
|
||||
async function uspam(chan, amt) {
|
||||
var arr = [];
|
||||
if (amt > 10000) {
|
||||
bot.say(chan, "no")
|
||||
} else {
|
||||
if (amt === undefined) {
|
||||
var amt = 100
|
||||
}
|
||||
for(var i=0; i < amt; i++){
|
||||
var string = "" + randomext.integer(9,0) + "," + randomext.integer(9,0) + randomext.uString(120,60);
|
||||
await timer(2);
|
||||
arr.push(string)
|
||||
}
|
||||
var output = arr.join("\n")
|
||||
bot.say(chan, output);
|
||||
}
|
||||
openPostWorker(chan, 'uspam', amt)
|
||||
}
|
||||
|
||||
async function rspam(chan, amt) {
|
||||
var arr = []
|
||||
if (amt > 10000) {
|
||||
bot.say(chan, "no")
|
||||
} else {
|
||||
if (amt === undefined) {
|
||||
var amt = 100
|
||||
}
|
||||
for(var i=0; i < amt; i++){
|
||||
var string = generateRandomString(70);
|
||||
await timer(2);
|
||||
arr.push(string)
|
||||
}
|
||||
var output = arr.join("\n")
|
||||
bot.say(chan, output);
|
||||
}
|
||||
openPostWorker(chan, 'rspam', amt)
|
||||
}
|
||||
|
||||
async function art(chan, url) {
|
||||
var ext = path.extname(url)
|
||||
if (ext === ".png") {
|
||||
var filetype = "png"
|
||||
} else if (ext === ".jpg") {
|
||||
var filetype = "jpg"
|
||||
} else if (ext === ".webp") {
|
||||
var filetype = "webp"
|
||||
} else if (ext === ".jpeg") {
|
||||
var filetype = "jpeg"
|
||||
} else {
|
||||
bot.say(chan, "Image must be PNG, JPG, JPEG, WEBP");
|
||||
return
|
||||
}
|
||||
console.log("Starting Banter")
|
||||
const spawn = require("child_process").spawn;
|
||||
const pythonProcess = spawn('python3', ["lib/banter/banter.py", url, "-t", filetype])
|
||||
pythonProcess.stdout.on('data', (data) => {
|
||||
console.log(data.toString())
|
||||
});
|
||||
await timer(5000);
|
||||
fs.stat('output.txt', function(err, stat) {
|
||||
if (err == null) {
|
||||
console.log('File exists');
|
||||
const rl = readline.createInterface({
|
||||
input: fs.createReadStream('output.txt'),
|
||||
crlfDelay: Infinity,
|
||||
});
|
||||
rl.on('line', (line) => {
|
||||
bot.say(chan, line);
|
||||
});
|
||||
} else if (err.code === 'ENOENT') {
|
||||
console.log(err);
|
||||
bot.say(chan, "Error")
|
||||
} else {
|
||||
bot.say(chan, "Other Error")
|
||||
}
|
||||
});
|
||||
openPostWorker(chan, 'art', url)
|
||||
}
|
||||
|
||||
async function godwords(chan, amt) {
|
||||
if (amt > 100000) {
|
||||
bot.say(chan, "no")
|
||||
} else {
|
||||
if (amt === undefined) {
|
||||
var amt = 50
|
||||
}
|
||||
const worker = new Worker('./commands/godwords.js', {
|
||||
workerData: {
|
||||
amt
|
||||
}
|
||||
});
|
||||
worker.once('message', (string) => {
|
||||
console.log('Received string from worker, posting.');
|
||||
bot.say(chan, string);
|
||||
});
|
||||
}
|
||||
openPostWorker(chan, 'godwords', amt)
|
||||
}
|
||||
|
||||
bot.addListener('message', function(nick, to, text, from) {
|
||||
var args = text.split(' ');
|
||||
if (args[0] === '$help') {
|
||||
help(to);
|
||||
} else if (args[0] === '$flood') {
|
||||
flood(to, args)
|
||||
} else if (args[0] === '$sneed') {
|
||||
sneed(to);
|
||||
} else if (args[0] === '$ctcpflood') {
|
||||
ctcp(args[1], args[2], args[3]);
|
||||
} else if (args[0] === '$rspam') {
|
||||
rspam(to, args[1])
|
||||
} else if (args[0] === '$uspam') {
|
||||
uspam(to, args[1]);
|
||||
} else if (args[0] === '$art') {
|
||||
art(to, args[1]);
|
||||
} else if (args[0] === 'fart') {
|
||||
art(to, args[1]);
|
||||
} else if (args[0] === '$godwords') {
|
||||
godwords(to, args[1]);
|
||||
}
|
||||
});
|
||||
async function phish(chan, height, width) {
|
||||
openPostWorker(chan, 'phish', height, width)
|
||||
}
|
||||
|
||||
bot.addListener('message', function(nick, to, text, from) {
|
||||
if (text.startsWith(config.irc.prefix)) {
|
||||
@ -225,10 +113,10 @@ bot.addListener('message', function(nick, to, text, from) {
|
||||
uspam(to, args[1]);
|
||||
} else if (command === config.irc.prefix+'art') {
|
||||
art(to, args[1]);
|
||||
} else if (command === config.irc.prefix+'fart') {
|
||||
art(to, args[1]);
|
||||
} else if (command === config.irc.prefix+'godwords') {
|
||||
godwords(to, args[1]);
|
||||
} else if (command === config.irc.prefix+'phish') {
|
||||
phish(to, args[1], args[2])
|
||||
}
|
||||
msgTimeout.add(to);
|
||||
setTimeout(() => {
|
||||
@ -240,7 +128,14 @@ bot.addListener('message', function(nick, to, text, from) {
|
||||
|
||||
|
||||
bot.addListener('error', function(message) {
|
||||
console.log('error: ', message);
|
||||
consoleLog('[ERROR]' +message) //Dump errors to console
|
||||
});
|
||||
|
||||
console.log('Starting Fascinus');
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error(err);
|
||||
if (config.errorhandling.log_errors_to_irc == 'true') { //If logging errors to IRC is enabled then we send the error to that, otherwise we only consoleLog it
|
||||
bot.say(config.errorhandling.error_channel, errorMsg+" "+err.stack.split('\n',1).join(" "))
|
||||
}
|
||||
});
|
||||
|
||||
consoleLog('Starting Fascinus');
|
60
commands/art.js
Normal file
60
commands/art.js
Normal file
@ -0,0 +1,60 @@
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const { d1 } = workerData;
|
||||
var url = d1
|
||||
var path = require('path');
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[art.errorMessage] '+error.code)
|
||||
if (code == "ENOENT") {
|
||||
var error = errorMsg+" ENOENT"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function generate(url) {
|
||||
output = []
|
||||
var ext = path.extname(url)
|
||||
if (ext === ".png") {
|
||||
var filetype = "png"
|
||||
} else if (ext === ".jpg") {
|
||||
var filetype = "jpg"
|
||||
} else if (ext === ".webp") {
|
||||
var filetype = "webp"
|
||||
} else if (ext === ".jpeg") {
|
||||
var filetype = "jpeg"
|
||||
} else {
|
||||
consoleLog('[art] Invalid image passed')
|
||||
sendUpstream(errorMsg+" Image must be PNG, JPG, JPEG, WEBP");
|
||||
}
|
||||
consoleLog("[art] Starting banter.py process")
|
||||
const spawn = require("child_process").spawn;
|
||||
const pythonProcess = spawn('python3', ["/home/node/app/lib/banter/banter.py", url, "-t", filetype])
|
||||
pythonProcess.stdout.on('data', (data) => {
|
||||
output.push(data.toString())
|
||||
});
|
||||
await timer(5000);
|
||||
sendUpstream(output.join('\n'))
|
||||
}
|
||||
|
||||
generate(url)
|
50
commands/flood.js
Normal file
50
commands/flood.js
Normal file
@ -0,0 +1,50 @@
|
||||
const { error } = require('console');
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const { d1 } = workerData; //Declare all used variables here (if you only pass 1 variable to this command you only really need d1 in here, but it doesnt matter)
|
||||
var arg = d1; // Declaring d1 as var1, just for consistancy with the last file but again, this may not be necessary in all cases.
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[uspam.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else if (code == "TOOLARGE") {
|
||||
var error = errorMsg+" Your request is too large (Maximum is 100000)"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
var arr = []
|
||||
arg.shift() //$flood
|
||||
var amt = arg.shift() //number
|
||||
var text = arg.join(" ")
|
||||
if (amt > 100000) {
|
||||
consoleLog('[flood] Request too large was made, killing worker')
|
||||
errorMessage("error", "TOOLARGE")
|
||||
} else {
|
||||
for(var i=0; i < amt; i++){
|
||||
arr.push(text)
|
||||
}
|
||||
}
|
||||
var output = arr.join("\n")
|
||||
sendUpstream(output)
|
@ -1,16 +1,59 @@
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const { amt } = workerData;
|
||||
const { d1 } = workerData;
|
||||
var amt = d1
|
||||
var randomWords = require('../lib/randomword');
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
var output = [];
|
||||
var string = [];
|
||||
var text = [];
|
||||
for(var i=0; i < amt; i++){
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[godwords.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else if (code == "TOOLARGE") {
|
||||
var error = errorMsg+" Your request is too large (Maximum is 10000)"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
function gen(amt) {
|
||||
consoleLog('[godwords.gen] Generating godwords output')
|
||||
var output = [];
|
||||
var string = [];
|
||||
var text = [];
|
||||
for(var i=0; i < amt; i++){
|
||||
var word = randomWords({ exactly: 1 });
|
||||
text.push(word);
|
||||
}
|
||||
var string = text.join(" ")
|
||||
output.push(string);
|
||||
sendUpstream(output);
|
||||
}
|
||||
var string = text.join(" ")
|
||||
|
||||
output.push(string);
|
||||
parentPort.postMessage(output);
|
||||
process.exit()
|
||||
if (amt > 10000) {
|
||||
consoleLog('[godwords] Request too large was made, killing worker')
|
||||
errorMessage("error", "TOOLARGE")
|
||||
} else {
|
||||
if (amt === undefined) {
|
||||
var amt = 50
|
||||
}
|
||||
gen(amt)
|
||||
}
|
43
commands/help.js
Normal file
43
commands/help.js
Normal file
@ -0,0 +1,43 @@
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[help.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
var output = []
|
||||
output.push('Fascinus - https://git.supernets.org/hgw/fascinus')
|
||||
output.push("$flood [AMOUNT (max=10000)] [TEXT] - Floods the channel with a specific line x amount of times")
|
||||
output.push("$ctcpflood [TARGET] [TEXT (one word)] [AMOUNT] - Sends x amount of CTCP requests to a target.")
|
||||
output.push("$sneed - Pastes the Sneed's Feed and Seed copypasta.")
|
||||
output.push("$rspam [LINES (def=100, max=10000)] - Spams x lines of random characters")
|
||||
output.push("$uspam [LINES (def=100, max=10000)] - Spams x lines of random unicode characters of varying length")
|
||||
output.push("$art [IMAGE URL (png/jpg/webp/jpeg)] - Creates IRC art using a source image.")
|
||||
output.push("$godwords [AMOUNT (def=50, max=100000)] - Generate x amount of random words. Inspired by TempleOS.")
|
||||
output.push("$phish [HEIGHT (opt, max=100)] [WIDTH (opt, max=100)] - Generate an aquarium")
|
||||
|
||||
sendUpstream(output.join('\n'))
|
55
commands/phish.js
Normal file
55
commands/phish.js
Normal file
@ -0,0 +1,55 @@
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const { d1, d2 } = workerData;
|
||||
var height = d1
|
||||
var width = d2
|
||||
var phish = require('phishies');
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[phish.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
if (height > 100) {
|
||||
consoleLog('[phish] Height requesteed was over the maximum allowable amount, defaulting to maximum')
|
||||
height = 100
|
||||
}
|
||||
if (width > 100) {
|
||||
consoleLog('[phish] Width requesteed was over the maximum allowable amount, defaulting to maximum')
|
||||
width = 100
|
||||
}
|
||||
if (height == undefined) {
|
||||
consoleLog('[phish] Height was not specified, defaulting to 5')
|
||||
height = 5
|
||||
}
|
||||
if (width == undefined) {
|
||||
consoleLog('[phish] Width was not specified, defaulting to 5')
|
||||
width = 7
|
||||
}
|
||||
consoleLog('[phish] Generating phish output')
|
||||
var aquarium = phish.aquarium(height, width)
|
||||
var output = aquarium.join("\n")
|
||||
sendUpstream(output)
|
64
commands/rspam.js
Normal file
64
commands/rspam.js
Normal file
@ -0,0 +1,64 @@
|
||||
const { error } = require('console');
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const { d1 } = workerData; //Declare all used variables here (if you only pass 1 variable to this command you only really need d1 in here, but it doesnt matter)
|
||||
var amt = d1; // Declaring d1 as var1, just for consistancy with the last file but again, this may not be necessary in all cases.
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[rspam.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else if (code == "TOOLARGE") {
|
||||
var error = errorMsg+" Your request is too large (Maximum is 10000)"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
const generateRandomString = (amt) => {
|
||||
const chars =
|
||||
"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890`!@#$%^&*()_+{}|\"\',./ᘈᷞኬᲡ᩶ᐨᅚ⸗⡳ᾟⓅᤲ⧛ሥ⸰⯠ᬨ⧻Შ⼷ᢕ᭄◁ⱉጻ᪅⎑ᘂᏤ⛰⃡";
|
||||
const randomArray = Array.from(
|
||||
{ length: amt },
|
||||
(v, k) => chars[Math.floor(Math.random() * chars.length)]
|
||||
);
|
||||
const randomString = randomArray.join("");
|
||||
return randomString;
|
||||
}
|
||||
|
||||
var arr = []
|
||||
if (amt > 10000) {
|
||||
consoleLog('[rpsam] Request too large was made, killing worker')
|
||||
errorMessage("error", "TOOLARGE")
|
||||
} else {
|
||||
if (amt === undefined) {
|
||||
consoleLog('[rspam] Amount was not defined, defaulting to 100')
|
||||
var amt = 100
|
||||
}
|
||||
for(var i=0; i < amt; i++){
|
||||
var string = generateRandomString(70);
|
||||
timer(2);
|
||||
arr.push(string)
|
||||
}
|
||||
var output = arr.join("\n")
|
||||
sendUpstream(output)
|
||||
}
|
39
commands/sneed.js
Normal file
39
commands/sneed.js
Normal file
@ -0,0 +1,39 @@
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[sneed.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
output = []
|
||||
output.push('THE SIGN IS A SUBTLE JOKE. THE SHOP IS CALLED \"SNEED\'S FEED & SEED\", WHERE')
|
||||
output.push('FEED AND SEED BOTH END IN THE SOUND "-EED", THUS RHYMING WITH THE NAME OF')
|
||||
output.push('THE OWNER, SNEED. THE SIGN SAYS THAT THE SHOP WAS "FORMERLY CHUCK\'S", IMPLYING')
|
||||
output.push('THAT THE TWO WORDS BEGINNING WITH "F" AND "S" WOULD HAVE ENDED WITH "-UCK",')
|
||||
output.push('RHYMING WITH "CHUCK". SO, WHEN CHUCK OWNED THE SHOP, IT WOULD HAVE BEEN CALLED')
|
||||
output.push('"CHUCK\'S FUCK AND SUCK".')
|
||||
sendUpstream(output.join("\n"))
|
65
commands/uspam.js
Normal file
65
commands/uspam.js
Normal file
@ -0,0 +1,65 @@
|
||||
const { error } = require('console');
|
||||
const config = require('../config/config.json')
|
||||
const { parentPort, workerData } = require('worker_threads');
|
||||
const { d1 } = workerData; //Declare all used variables here (if you only pass 1 variable to this command you only really need d1 in here, but it doesnt matter)
|
||||
var amt = d1; // Declaring d1 as var1, just for consistancy with the last file but again, this may not be necessary in all cases.
|
||||
const timer = ms => new Promise(res => setTimeout(res, ms))
|
||||
var randomext = require('../lib/randomnum');
|
||||
|
||||
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
|
||||
errorMsg = ''+config.colours.brackets+'['+config.colours.error+'ERROR'+config.colours.brackets+']'
|
||||
|
||||
function consoleLog(log) {
|
||||
if (config.misc.logging === "true") {
|
||||
console.log(log)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessage(error, code, extra) {
|
||||
consoleLog('[uspam.errorMessage] '+error.code)
|
||||
if (code == "BAD") {
|
||||
var error = errorMsg+" SHITS_FUCKED_MAN: " + extra + " not found"
|
||||
} else if (code == "TOOLARGE") {
|
||||
var error = errorMsg+" Your request is too large (Maximum is 10000)"
|
||||
} else {
|
||||
var error = errorMsg+" Unknown error"
|
||||
}
|
||||
parentPort.postMessage(error);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
async function sendUpstream(content) {
|
||||
parentPort.postMessage(content);
|
||||
process.exit()
|
||||
}
|
||||
|
||||
const generateRandomString = (amt) => {
|
||||
const chars =
|
||||
"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890`!@#$%^&*()_+{}|\"\',./ᘈᷞኬᲡ᩶ᐨᅚ⸗⡳ᾟⓅᤲ⧛ሥ⸰⯠ᬨ⧻Შ⼷ᢕ᭄◁ⱉጻ᪅⎑ᘂᏤ⛰⃡";
|
||||
const randomArray = Array.from(
|
||||
{ length: amt },
|
||||
(v, k) => chars[Math.floor(Math.random() * chars.length)]
|
||||
);
|
||||
const randomString = randomArray.join("");
|
||||
return randomString;
|
||||
}
|
||||
|
||||
var arr = []
|
||||
if (amt > 10000) {
|
||||
consoleLog('[uspam] Request too large was made, killing worker')
|
||||
errorMessage("error", "TOOLARGE")
|
||||
} else {
|
||||
if (amt === undefined) {
|
||||
consoleLog('[uspam] Amount was not defined, defaulting to 100')
|
||||
var amt = 100
|
||||
}
|
||||
for(var i=0; i < amt; i++){
|
||||
var string = "" + randomext.integer(9,0) + "," + randomext.integer(9,0) + randomext.uString(120,60);
|
||||
timer(2);
|
||||
arr.push(string)
|
||||
}
|
||||
var output = arr.join("\n")
|
||||
sendUpstream(output)
|
||||
}
|
@ -16,5 +16,18 @@
|
||||
"flood_protection": "false",
|
||||
"flood_protection_delay": "0",
|
||||
"command_listen_timeout": "2500"
|
||||
},
|
||||
"errorhandling": {
|
||||
"error_logging": "true",
|
||||
"error_channel": "#CHANNELTOSENDERRORSTO",
|
||||
"error_channel_pass": ""
|
||||
},
|
||||
"colours": {
|
||||
"warning": "08",
|
||||
"error": "04",
|
||||
"brackets": "15"
|
||||
},
|
||||
"misc": {
|
||||
"logging": "true"
|
||||
}
|
||||
}
|
@ -14,34 +14,14 @@ import glob, os
|
||||
import requests
|
||||
|
||||
def main(imgPath, delay, ASCIIWIDTH, COLORCHAR, FILLER, fileType):
|
||||
if os.path.exists("image.png"):
|
||||
os.remove("image.png")
|
||||
if os.path.exists("image.jpg"):
|
||||
os.remove("image.jpg")
|
||||
if os.path.exists("image.webp"):
|
||||
os.remove("image.webp")
|
||||
if os.path.exists("image.jpeg"):
|
||||
os.remove("image.jpeg")
|
||||
if os.path.exists("output.txt"):
|
||||
os.remove("output.txt")
|
||||
if os.path.exists("image."+fileType):
|
||||
os.remove("image."+fileType)
|
||||
if validators.url(imgPath) == True:
|
||||
print('URL')
|
||||
print('Downloading image to ' + "/home/node/app/image." + fileType)
|
||||
#wget.download(imgPath, "/home/node/app/image." + fileType)
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0'}
|
||||
imagefile = requests.get(imgPath, headers=headers)
|
||||
open("/home/node/app/image." + fileType, "wb").write(imagefile.content)
|
||||
if fileType == "png":
|
||||
print('PNG')
|
||||
imgPath = "/home/node/app/image.png"
|
||||
if fileType == "jpg":
|
||||
print('JPG')
|
||||
imgPath = "/home/node/app/image.jpg"
|
||||
if fileType == "webp":
|
||||
print('WEBP')
|
||||
imgPath = "/home/node/app/image.webp"
|
||||
|
||||
im = Image.open(imgPath, 'r')
|
||||
im = Image.open("/home/node/app/image."+fileType, 'r')
|
||||
im = ImageOps.scale(im, ASCIIWIDTH / im.width)
|
||||
width, height = im.size
|
||||
pixel_values = list(im.getdata())
|
||||
@ -63,8 +43,6 @@ def main(imgPath, delay, ASCIIWIDTH, COLORCHAR, FILLER, fileType):
|
||||
currentPixel+=1
|
||||
|
||||
print("".join(line))
|
||||
with open("output.txt", "a") as f:
|
||||
print("".join(line), file=f)
|
||||
if delay:
|
||||
time.sleep(delay)
|
||||
sys.stdout.flush()
|
||||
|
77
package-lock.json
generated
77
package-lock.json
generated
@ -1,78 +1,8 @@
|
||||
{
|
||||
"name": "fascinus",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "fascinus",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"fs": "^0.0.1-security",
|
||||
"irc": "^0.5.2"
|
||||
}
|
||||
},
|
||||
"node_modules/fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
|
||||
},
|
||||
"node_modules/iconv": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv/-/iconv-2.2.3.tgz",
|
||||
"integrity": "sha1-4ITWDut9c9p/CpwJbkyKvgkL+u0=",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"nan": "^2.3.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/irc": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/irc/-/irc-0.5.2.tgz",
|
||||
"integrity": "sha1-NxT0doNlqW0LL3dryRFmvrJGS7w=",
|
||||
"dependencies": {
|
||||
"irc-colors": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"iconv": "~2.2.1",
|
||||
"node-icu-charset-detector": "~0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/irc-colors": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/irc-colors/-/irc-colors-1.5.0.tgz",
|
||||
"integrity": "sha512-HtszKchBQTcqw1DC09uD7i7vvMayHGM1OCo6AHt5pkgZEyo99ClhHTMJdf+Ezc9ovuNNxcH89QfyclGthjZJOw==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/nan": {
|
||||
"version": "2.17.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
|
||||
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/node-icu-charset-detector": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/node-icu-charset-detector/-/node-icu-charset-detector-0.2.0.tgz",
|
||||
"integrity": "sha1-wjINo3Tdy2cfxUy0oOBB4Vb/1jk=",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"nan": "^2.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"fs": {
|
||||
"version": "0.0.1-security",
|
||||
@ -117,6 +47,11 @@
|
||||
"requires": {
|
||||
"nan": "^2.3.3"
|
||||
}
|
||||
},
|
||||
"phishies": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/phishies/-/phishies-1.0.2.tgz",
|
||||
"integrity": "sha512-uZArCHgYfx7GfpPGUJiQL+eh+6ksj5KGz5n9gJMjbfdk5KJEh+UZGNe4qTgmZGqeFR9NVAaL18+cebsfE7D02g=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,8 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"fs": "^0.0.1-security",
|
||||
"irc": "^0.5.2"
|
||||
"irc": "^0.5.2",
|
||||
"phishies": "^1.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
Loading…
Reference in New Issue
Block a user