summaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-23 10:51:20 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-23 10:51:20 -0300
commit8fc945237164ae05090617852ea2a35268f243ac (patch)
tree6636782eb211b77829569adda7c648b2e7bba054 /server.py
parentb971fee7c8024e67cb85ff422d4c3394e4cdd933 (diff)
downloadserver-8fc945237164ae05090617852ea2a35268f243ac.tar.gz
server-8fc945237164ae05090617852ea2a35268f243ac.tar.bz2
server-8fc945237164ae05090617852ea2a35268f243ac.tar.xz
server-8fc945237164ae05090617852ea2a35268f243ac.zip
Commands to DC or DC-and-Ban all unauthed clients.
These may be used in DDoS scenarios.
Diffstat (limited to 'server.py')
-rwxr-xr-xserver.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/server.py b/server.py
index ae1301d..87b0634 100755
--- a/server.py
+++ b/server.py
@@ -160,7 +160,7 @@ try:
cmd=command.split(' ')[0].lower()
com=" ".join(command.split(' ')[1:])
# Parse the command
- if cmd in ["broadcast", "global", "msg", "say"]:
+ if cmd in ["broadcast", "global", "msg", "say", "kami"]:
sendmsg("NOTICE:" + com)
elif cmd in ["ban", "block", "nuke"]:
security.ban_ip(com)
@@ -187,6 +187,24 @@ try:
# disconnect & ban all unauthed clients - all these are measures
# to manually fight a DoS
# Also, "permaban" an IP - open("K-Line.txt", "a")
+ # And grant gems to an user
+ elif cmd in ["ddos", "dcall"]:
+ totaldc=0
+ for c in clients:
+ if c.token == "0" or c.userid < 1:
+ c.close(status=1000, reason="Remote host closed connection.")
+ totaldc+=1
+ stdout("Disconnected %d clients." % totaldc)
+ del totaldc
+ elif cmd in ["ddosban", "dcbanall"]:
+ totaldc=0
+ for c in clients:
+ if c.token == "0" or c.userid < 1:
+ security.ban_ip(c.address[0], now()+1800)
+ c.close(status=1000, reason="Remote host closed connection.")
+ totaldc+=1
+ stdout("Disconnected and banned %d clients." % totaldc)
+ del totaldc
else:
stdout("ERROR: Unknown command.")
except: