summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-16 19:28:54 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-16 19:28:54 -0300
commite0f0ae108bd9f41cd19a3f2ef0c82f0d872c022f (patch)
tree3b6bbfbb4c2611d31b02b54598b89ddb37afb8fc
parent239358745f0827906f77e52341551cb58fd59329 (diff)
downloadserver-e0f0ae108bd9f41cd19a3f2ef0c82f0d872c022f.tar.gz
server-e0f0ae108bd9f41cd19a3f2ef0c82f0d872c022f.tar.bz2
server-e0f0ae108bd9f41cd19a3f2ef0c82f0d872c022f.tar.xz
server-e0f0ae108bd9f41cd19a3f2ef0c82f0d872c022f.zip
Add command `list` (aka. `all`) which lists everyone connected.
Also lists their tokens and IPs so the other commands (ban, ddos, etc.) can be used
-rw-r--r--README.md1
-rwxr-xr-xserver.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3bb6cf2..a486446 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,7 @@ After the server start, it will listen for a few commands. They are listed below
| raw | eval | Evaluates an arbitrary Python statement if server is in debug mode. |
| run | exec | Executes an arbitrary Python statement if server is in debug mode. |
| status | st | Reports status regarding server health |
+| list | all | Reports data on all connected clients |
| ddos | dcall | Disconnects all unauthed clients. |
| ddosban | dcbanall | Disconnects all unauthed clients, and ban their IP for half hour. |
diff --git a/server.py b/server.py
index 6e4bcc2..e66b63a 100755
--- a/server.py
+++ b/server.py
@@ -240,6 +240,10 @@ try:
elif cmd in ["status", "st"]:
stdout("Total clients connected: %d" % len(clients))
stdout("Total blacklist size: %d" % len(security.blacklist))
+ elif cmd in ["list", "all"]:
+ stdout("Total clients connected: %d" % len(clients))
+ for cli in clients:
+ print("[%d] %s - %s" % (cli.userid, cli.token, cli.address[0]))
elif cmd in ["kick", "dc"]:
totaldc=disconnect(com)
stdout("Disconnected %d clients." % totaldc)