Last active
October 2, 2018 14:14
-
-
Save echicken/b10e7a4614dba07acf33564bebc6f77b to your computer and use it in GitHub Desktop.
Synchronet: keep them SSH bots from tying up your nodes as 'new users signing up'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
console.clear(LIGHTGRAY); | |
console.putmsg('\1h\1wStarting the new user registration process ...\r\n'); // Original contents of text.dat record 764 | |
if (bbs.connection == 'SSH') { | |
console.mnemonics('Are you a bot? (~Y/~N)'); // Print a string with colorized hotkeys | |
var s = console.inkey(K_NONE, timeout).toLowerCase(); // Wait 'timeout' ms for user input | |
console.crlf(); | |
if (s != 'n') { | |
if (s == '') { | |
console.putmsg('No answer after ' + timeout + ' seconds.\r\n'); | |
} else if (s == 'y') { | |
console.putmsg('Sorry, no bots allowed.\r\n'); | |
} else { | |
console.putmsg('Invalid response.\r\n'); | |
} | |
console.putmsg('Disconnecting you now ...\r\n'); | |
bbs.hangup(); | |
} | |
} | |
bbs.sys_status = bss; // Restore BBS session flags to what they were at start of script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment