cold hard uspam

This commit is contained in:
hgw 2023-10-02 02:14:35 +00:00
commit ecc15291d7
8 changed files with 4701 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
docker-compose.yml

132
.gitignore vendored Normal file
View File

@ -0,0 +1,132 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.env

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM node:14
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package*.json ./
USER node
RUN npm i
COPY --chown=node:node . .
CMD [ "node", "index.js" ]

5
docker-compose.yml Normal file
View File

@ -0,0 +1,5 @@
version: '3.3'
services:
fascinus:
build: .
restart: always

116
index.js Normal file
View File

@ -0,0 +1,116 @@
var irc = require("irc");
var fs = require("fs");
var request = require('request');
var art = require('ascii-art');
var crypto = require('crypto').webcrypto;
var randomext = require('./random-ext')
var config = { //edit your shit here
server: "irc.supernets.org",
//server: "irc.goat.chat",
port: 6697,
SSL: true,
channels: ['#superbowl', '#dev'],
//channels: ['#dev2'],
botName: "fascinus",
userName: "fascinus",
realName: "Sneed"
};
var bot = new irc.Client(config.server, config.botName, {
channels: config.channels,
secure: config.SSL,
port: config.port,
autoRejoin: true,
userName: config.userName,
realName: config.realName,
floodProtection: false,
floodProtectionDelay: 0
});
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;
}
const randomUnicode = (amt) => {
var array = new Uint16Array(amt);
crypto.getRandomValues(array);
var randStr = '';
for (var i = 0; i < array.amt; i++) {
randStr += String.fromCharCode(array[i]);
};
return randStr;
}
async function help(chan) {
bot.say(chan, 'Fascinus')
bot.say(chan, "$flood [TEXT] [AMOUNT] - 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.")
}
async function flood(text, chan, times) {
for(var i=0; i < times; i++){
bot.say(chan, text);
}
}
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".')
}
async function ctcp(target, text, amt) {
for(var i=0; i < amt; i++){
bot.ctcp(target, "privmsg", text);
await timer(1000);
}
}
async function rspam(chan, amt) {
for(var i=0; i < amt; i++){
bot.say(chan, generateRandomString(60));
}
}
async function uspam(chan, amt){
for(var i=0; i < amt; i++){
bot.say(chan, "0" + randomext.integer(9,0) + randomext.uString(60,40));
}
}
const timer = ms => new Promise(res => setTimeout(res, ms))
bot.addListener('message', function(nick, to, text, from) {
var args = text.split(' ');
if (args[0] === '$help') {
help(to);
} else if (args[0] === '$flood') {
flood(args[1], to, args[2]);
} 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]);
}
});
bot.addListener('error', function(message) {
console.log('error: ', message);
});
console.log('Starting Fascinus');

4027
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "fascinus",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"ascii-art": "^2.8.5",
"crypto": "^1.0.1",
"dotenv": "^16.3.1",
"fs": "^0.0.1-security",
"irc": "^0.5.2",
"request": "^2.88.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "hogwart7",
"license": ""
}

389
random-ext.js Normal file
View File

@ -0,0 +1,389 @@
/*!
* random-ext
* https://github.com/bkumar2/random-ext.git
*
* Copyright 2014 Bipul Kumar
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _array(length, elementFunction, args) {
var array = [];
if (length != null) {
for (var i = 0; i < length; ++i) {
array[i] = elementFunction.apply(this, args);
}
} else {
throw "length is required.";
}
return array;
}
function boolean() {
return Math.random() < 0.5;
}
function booleanArray(length) {
return _array(length, boolean);
}
function float(limit, min) {
if (limit != null) {
if (min != null) {
return Math.random() * (limit - min) + min;
} else {
return Math.random() * limit;
}
} else {
throw "max is required.";
}
}
function floatArray(length, limit, min) {
return _array(length, float, [limit, min]);
}
function integer(max, min) {
if (max != null) {
if (min != null) {
if (max < min) {
throw "max [" + max + "] is less than min [" + min + "]";
}
return Math.floor(Math.random() * (max - min + 1)) + min;
} else {
return Math.floor(Math.random() * (max + 1));
}
} else {
throw "max is required.";
}
}
function integerArray(length, max, min) {
return _array(length, integer, [max, min]);
}
function _normalizeRanges(ranges) {
if (randomExt.DEBUG) {
console.log("Normalizing ranges:", ranges);
}
ranges.sort(function (a, b) {
return a[0] - b[0];
});
if (randomExt.DEBUG) {
console.log("sorted ranges:", ranges);
}
for (var i = 0; i < ranges.length - 1; ++i) {
for (var j = i + 1; j < ranges.length; ++j) {
// remove right contained
if (ranges[i][1] >= ranges[j][1]) {
ranges.splice(j, 1);
j--;
}
// fix overlap
else if (ranges[i][1] >= ranges[j][0]) {
ranges[j][0] = ranges[i][1] + 1;
}
if (randomExt.DEBUG) {
console.log("iteration (" + i + "," + j + "):", ranges);
}
}
}
if (randomExt.DEBUG) {
console.log("Normalized ranges:", ranges);
}
}
function _integerFromRanges(ranges) {
_normalizeRanges(ranges);
if (ranges != null) {
var span = 0;
for (var i = 0; i < ranges.length; ++i) {
span += ranges[i][1] - ranges[i][0] + 1;
}
var randomNumber = Math.floor(Math.random() * span);
for (var i = 0; i < ranges.length; ++i) {
randomNumber += ranges[i][0];
if (randomNumber <= ranges[i][1]) {
break;
} else {
randomNumber -= ranges[i][1] + 1;
}
}
return randomNumber;
} else {
throw "ranges is required.";
}
}
function _integerArrayFromRanges(length, ranges) {
var numberArray = [];
if (length != null && ranges != null) {
for (var i = 0; i < length; ++i) {
numberArray[i] = _integerFromRanges(ranges);
}
} else {
throw "length and ranges is required.";
}
return numberArray;
}
function _stringFromRanges(maxLength, minLength, ranges) {
var dString = "";
var length = integer(maxLength, minLength);
var unicodeNumbers = _integerArrayFromRanges(length, ranges);
dString = String.fromCharCode.apply(this, unicodeNumbers);
return dString;
}
function date(endDate, startDate) {
if (endDate == null) {
throw "end date is required.";
}
var endDateTime = endDate.getTime();
var startDateTime = startDate != null ? startDate.getTime() : 0;
return new Date(integer(endDateTime, startDateTime));
}
function dateArray(length, endDate, startDate) {
return _array(length, date, [endDate, startDate]);
}
function string(maxLength, minLength) {
if (randomExt.DEBUG) {
console.log("string maxLength:", maxLength, " minLength:", minLength);
}
return _stringFromRanges(maxLength, minLength, [[32, 126]]);
}
function uString(maxLength, minLength) {
if (randomExt.DEBUG) {
console.log("string maxLength:", maxLength, " minLength:", minLength);
}
return _stringFromRanges(maxLength, minLength, [[1, 9999]]);
}
function stringArray(arrayLength, stringMaxLength, stringMinLength) {
return _array(arrayLength, string, [stringMaxLength, stringMinLength]);
}
function restrictedString(content, maxLength, minLength) {
var ranges = [];
for (var i = 0; i < content.length; ++i) {
var contentType = content[i];
switch (contentType) {
case randomExt.CHAR_TYPE.SPECIAL:
ranges = ranges.concat([
[33, 47],
[58, 64],
[91, 96],
[123, 126],
]);
break;
case randomExt.CHAR_TYPE.SPACE:
ranges = ranges.concat([[32, 32]]);
break;
case randomExt.CHAR_TYPE.NUMERIC:
ranges = ranges.concat([[48, 57]]);
break;
case randomExt.CHAR_TYPE.UPPERCASE:
ranges = ranges.concat([[65, 90]]);
break;
case randomExt.CHAR_TYPE.LOWERCASE:
ranges = ranges.concat([[97, 122]]);
break;
case randomExt.CHAR_TYPE.HEX:
ranges = ranges.concat([
[48, 57],
[97, 102],
]);
break;
default:
if (typeof contentType === "string") {
for (var j = 0; j < contentType.length; ++j) {
ranges = ranges.concat([
[contentType.charCodeAt(j), contentType.charCodeAt(j)],
]);
}
}
}
}
return _stringFromRanges(maxLength, minLength, ranges);
}
function restrictedStringArray(arrayLength, content, stringMaxLength, stringMinLength) {
return _array(arrayLength, restrictedString, [content, stringMaxLength, stringMinLength]);
}
function _fromDescriptor(randomDescriptor) {
var randomValue = null;
if (
randomDescriptor == null ||
!randomDescriptor.shift ||
randomDescriptor.length <= 0 ||
typeof randomDescriptor[0] !== "function"
) {
randomValue = randomDescriptor;
} else {
var randomFunction = randomDescriptor[0];
if (randomDescriptor.length > 1) {
var propertyValueArgs = randomDescriptor.slice(1, randomDescriptor.length);
randomValue = randomFunction.apply(this, propertyValueArgs);
} else {
randomValue = randomFunction();
}
}
return randomValue;
}
function object(template) {
if (randomExt.DEBUG) {
console.log("object template:", template);
}
var newObject = {};
var properties = Object.getOwnPropertyNames(template);
for (var i = 0; i < properties.length; ++i) {
var property = properties[i];
var randomDescriptor = template[property];
newObject[property] = _fromDescriptor(randomDescriptor);
}
return newObject;
}
function objectArray(length, template) {
return _array(length, object, [template]);
}
function stringPattern(pattern, variableDefinition) {
var stringPattern = pattern;
var properties = Object.getOwnPropertyNames(variableDefinition);
var replacedStringArray = new Array();
for (var i = 0; i < stringPattern.length; ++i) {
if (variableDefinition.hasOwnProperty(stringPattern[i])) {
replacedStringArray[i] = _fromDescriptor(variableDefinition[stringPattern[i]]);
} else {
replacedStringArray[i] = stringPattern[i];
}
}
return replacedStringArray.join("");
}
function stringPatternArray(length, pattern, variableDefinition) {
return _array(length, stringPattern, [pattern, variableDefinition]);
}
function pick(array) {
if (array == null) {
throw "input array is null or undefined.";
}
return array[integer(array.length - 1)];
}
function shuffle(array) {
if (array == null) {
throw "input array is null or undefined.";
}
for (var i = 0; i < array.length; ++i) {
var randomIndex = integer(array.length - 1);
var temp = array[randomIndex];
array[randomIndex] = array[i];
array[i] = temp;
}
}
function subArray(array, length) {
// validation
if (array == null) {
throw "input array is null or undefined.";
} else if (length == null) {
throw "input length is null or undefined.";
} else if (array.length < length) {
throw "input length [" + length + "] must not exceed array length [" + array.length + "]";
}
// logic
var copiedArray = array.slice();
shuffle(copiedArray);
return copiedArray.slice(0, length);
}
function splitArray(array, count, ensureEqualSize) {
if (array == null || count == null) {
throw "array and count is required.";
}
if (array.length < count) {
throw "input array length is not sufficient for the split.";
}
var arrayCopy = [...array];
shuffle(arrayCopy);
var outputArrays = [];
for (var i = count, start = 0, remaining = arrayCopy.length; i > 0; --i) {
var nextLength = ensureEqualSize
? Math.ceil(remaining / i)
: i === 1
? remaining
: integer(remaining - i, 1);
var slicedArray = arrayCopy.slice(start, start + nextLength);
remaining -= slicedArray.length;
start += slicedArray.length;
outputArrays.push(slicedArray);
}
return outputArrays;
}
function color() {
return "#".concat(((Math.random() * 0xffffff) << 0).toString(16));
}
function guid() {
return randomExt.stringPattern("xxxxxxxx-xxxx-yxxx-zxxx-xxxxxxxxxxxx", {
x: [randomExt.restrictedString, [randomExt.CHAR_TYPE.HEX], 1, 1],
y: [randomExt.restrictedString, ["12345"], 1, 1],
z: [randomExt.restrictedString, ["89ab"], 1, 1],
});
}
var randomExt = {
boolean: boolean,
booleanArray: booleanArray,
integer: integer,
integerArray: integerArray,
float: float,
floatArray: floatArray,
date: date,
dateArray: dateArray,
string: string,
uString: uString,
stringArray: stringArray,
restrictedString: restrictedString,
restrictedStringArray: restrictedStringArray,
object: object,
objectArray: objectArray,
stringPattern: stringPattern,
stringPatternArray: stringPatternArray,
pick: pick,
shuffle: shuffle,
subArray: subArray,
splitArray: splitArray,
color: color,
guid: guid,
CHAR_TYPE: {
LOWERCASE: 0,
UPPERCASE: 1,
NUMERIC: 2,
SPECIAL: 3,
SPACE: 4,
HEX: 5,
},
DEBUG: false,
};
module.exports = randomExt;