Skip to content

Instantly share code, notes, and snippets.

View echicken's full-sized avatar
🤡
I am not very good at computer.

Derek Mullin echicken

🤡
I am not very good at computer.
View GitHub Profile
@echicken
echicken / msgdump.js
Created October 27, 2017 15:51
some bullshit
var mb = new MsgBase(argv[0]);
mb.open();
for (var n = 1; n < mb.last_msg; n++) {
var hdr = mb.get_msg_header(n);
if (hdr !== null) print(JSON.stringify(hdr.field_list));
}
mb.close();
@echicken
echicken / bot-trap.js
Last active October 2, 2018 14:14
Synchronet: keep them SSH bots from tying up your nodes as 'new users signing up'
// In ctrl/text.dat replace the 764 StartingNewUserRegistration line with:
// "@EXEC:bot-trap@" 764 StartingNewUserRegistration
// (Or if you have no such line, just add the above to the file.)
load('sbbsdefs.js');
const bss = bbs.sys_status; // Store flags for later restoration
bbs.sys_status|=SS_PAUSEOFF; // Prevent any block pause prompt from tying up the node
const timeout = 10000; // milliseconds
@echicken
echicken / 404.ssjs
Last active October 18, 2018 15:45
// /sbbs/ctrl/410.txt would be a line-by-line list of paths to pages that no longer exist:
// /some/deleted/page.html
load('sbbsdefs.js');
var line;
const f = new File(system.ctrl_dir + '410.txt');
if (f.open('r')) {
var bork = false;
while (!bork && !f.eof) {
line = f.readln();
if (line !== null && line.replace(/\/$/, '').toLowerCase() == http_request.virtual_path.replace(/\/$/, '').toLowerCase()) {
function strvar(fn, scope) {
if (scope === undefined) scope = js.scope;
const f = new File(fn);
if (!f.open('r')) throw 'nuh uh';
var txt = f.read();
f.close();
txt = txt.replace(/@strvar:(.*?)@/ig, function (m, p) {
return scope[p];
});
console.putmsg(txt);

Keybase proof

I hereby claim:

  • I am echicken on github.
  • I am echicken (https://keybase.io/echicken) on keybase.
  • I have a public key ASCcw_KvPTACtG-GSEQ89uOAeA81dqWrgl90M6EOxG8FKQo

To claim this, I am signing this object:

@echicken
echicken / nukem.js
Created March 16, 2021 20:09
Bulk remove messages
var sub = 'insert-sub-internal-code-here';
var mb = new MsgBase(sub);
if (!mb.open()) throw new Error(mb.errror);
var headers = mb.get_all_msg_headers();
Object.keys(headers).forEach(function (e) {
var n = parseInt(e, 10);
if (system.trashcan('subject', headers[e].subject)) {
writeln('Removing message ' + n + ', "' + headers[e].subject + '" matched subject filter.');
mb.remove_msg(n);
@echicken
echicken / rlogin-proxy.js
Last active November 13, 2023 21:09
Synchronet rlogin proxy for automatic newuser creation
/**
* An rlogin proxy script for automatic new user account creation.
* Clients that connect to this service instead of directly to the
* actual rlogin server will have an account created for them if none
* exists.
*
* Put this script in mods/
*
* Add the following block to ctrl/services.ini:
*