Initial commit.

This commit is contained in:
Moridius 2021-01-15 22:59:06 +01:00
commit a7f30097ab
1 changed files with 23 additions and 0 deletions

23
mumblecount.py Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
import argparse
import socket
def user_count(address, port=64738):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
msg = b"\x00\x00\x00\x00\x4C\x65\x69\x6E\x65\x4C\x61\x62"
sock.sendto(msg, (address, port))
data, _ = sock.recvfrom(1024)
return int.from_bytes(data[12:16], byteorder="big")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Gets the current user count of a mumble server")
parser.add_argument("address", help="server address")
parser.add_argument("port", nargs="?", default="64738", help="server port")
args = parser.parse_args()
print(user_count(args.address, int(args.port)))