Libraryless. Click here for Pure Java version (6379L/45K/142K).
!752 // Safe-for-everyone bots only!! static L<S> okToForwardTo = litlist("OK Collector Bot", "Leo Bot", "Identity Manager", "Who Is Online Bot", "I'm Jack's Identity Manager"); // May include the privileged bots. static Map<S, S> autoStartable = litmap( "Who Is Online Bot", "#1001768", "Reboot Bot", "#1001218", "OK Collector Bot", "#1001245", "Leo Bot", "#1001294", "Identity Manager", "#1001348", "I'm Jack's Identity Manager", "#1003170" ); static S masterKey; p { masterKey = loadSnippet("#1006007"); //readLocally("okToForwardTo"); Android3 a = new Android3("Public Comm Bot at " + getComputerID() + "."); a.publicOverride = true; a.useMultiPort = false; a.startPort = 4999; makeAndroid(a); } static synchronized S answer(S s) { new Matches m; if (match3("test", s)) return "test!"; // TODO: include a timestamp :) if (match3("signed *", s, m)) { S signed = m.unq(0); isSignedWithKey_verbose = true; if (!isSignedWithKey(signed, masterKey)) { print("masterKey: " + masterKey); ret "Sorry, bad signature."; } S line = unsign(signed); S answer = answerPrivileged(line); if (answer != null) ret answer; } if (match3("please forward to bot *: *", s, m)) { S bot = unquote(m.m[0]); S line = unquote(m.m[1]); if (!okToForwardTo.contains(bot)) return "Can't forward to this bot, sorry."; if (!lineOK(bot, line)) return "Can't forward that line, sorry."; ret forwardTo(bot, line); } return null; } static S answerPrivileged(S s) { // privileged path after auth with master key - anything goes!! new Matches m; if (match3("please forward to bot *: *", s, m)) { S bot = unquote(m.m[0]); S line = unquote(m.m[1]); ret forwardTo(bot, line); } if (match3("please start program *", s, m)) { S progID = m.unq(0); nohupJavax(progID); ret "OK."; } if (match3("please restart program *", s, m)) { S progID = m.unq(0); restartProgramID(progID); ret "OK."; } if (match3("please start bot *", s, m)) { S botID = m.unq(0); startBot(botID); ret "OK."; } if (match3("please reboot", s)) { ret forwardTo("Reboot Bot", "Please reboot the machine."); } if (match3("list bots", s)) ret structure(fullBotScan()); ret null; } static boolean lineOK(S bot, S line) { return true; // OK Collector bot is not very dangerous... } static S forwardTo(S bot, S line) { S id = autoStartable.get(bot); if (id != null) startBot(bot, id); ret sendToLocalBotOpt(bot, line); }
Began life as a copy of #1001222
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment