Initial commit.
This commit is contained in:
commit
a7f30097ab
|
@ -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)))
|
Loading…
Reference in New Issue