diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-27 22:22:52 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-27 22:22:52 -0300 |
commit | 636cb4deb4b82ed88ce608cb9f45c59e77614a9d (patch) | |
tree | 84bc89bd90e3722c53c5dbdf341907e7ce822704 /server.py | |
parent | ddbf494719658dbb421401f2bdc2429db0df5a2d (diff) | |
download | server-636cb4deb4b82ed88ce608cb9f45c59e77614a9d.tar.gz server-636cb4deb4b82ed88ce608cb9f45c59e77614a9d.tar.bz2 server-636cb4deb4b82ed88ce608cb9f45c59e77614a9d.tar.xz server-636cb4deb4b82ed88ce608cb9f45c59e77614a9d.zip |
Manually casting ban or kline will now disconnect sessions as well
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -143,6 +143,16 @@ def sendmsg(m, t="raw"): c.send_message(msg) return +# Disconnect function +def disconnect(ip): + global clients + totaldc=0 + for c in clients: + if c.address[0] == ip: + c.close(status=1000, reason="Remote host closed connection.") + totaldc+=1 + return totaldc + ############################################################### # Begin stuff stdout("Starting at: T-%d" % (now())) @@ -164,6 +174,9 @@ try: sendmsg("NOTICE:" + com) elif cmd in ["ban", "nuke"]: security.ban_ip(com) + totaldc=disconnect(com) + stdout("BAN: Disconnected %d clients." % totaldc) + del totaldc elif cmd in ["unban"]: security.unban_ip(com) elif cmd in ["permaban", "block", "kline"]: @@ -172,6 +185,9 @@ try: f.write(com+"\n") f.close() stdout("%s has been K-Lined." % com) + totaldc=disconnect(com) + stdout("Disconnected %d clients." % totaldc) + del totaldc elif cmd in ["exit", "quit", "close", "term", "end"]: stdout("Preparing to close server...") sendmsg("NOTICE:Server is going down for scheduled maintenance. Please close, wait five minutes, and then re-open the app.") |