!7 p { doEvery(10*60*1000, f subBot_cleanBlockedIPs); } svoid subBot_cleanBlockedIPs { Collection c = (Collection) get(mainBot(), "blockedIPs"); int n = l(c); if (n != 0) { clear(c); print("Cleared " + n2(n, "blocked IP")); } } html { if (!webAuthed(params)) ret "Not authed"; ret subBot_serveText(answer_privileged(params.get('q))); } sS answer(S s) { if (!webAuthed()) null; ret answer_privileged(s); } sS answer_privileged(S s) { new Matches m; if "block ip *" { call(mainBot(), "addBlockedIP", assertIPv4($1)); ret "OK"; } if "unblock all ips" { clear((Collection) get(mainBot(), "blockedIPs")); ret "OK"; } if "unblock ip *" { call(mainBot(), "removeBlockedIP", assertIPv4($1)); ret "OK, blocked IPs now: " + askSelf("blocked ips"); } if "blocked ips" ret structForUser(cloneList((Collection) get(mainBot(), "blockedIPs"))); if "bad clients" ret str(subBot_numStalledConnections()); if "whitelist ip *" { Cl whiteList = cast get(mainBot(), "whiteListedIPs"); add(whiteList, assertIPv4($1)); ret "OK, white listed IPs now: " + whiteList; } null; }