Last active
December 20, 2024 21:40
-
-
Save imjiten/b8c4456aaa12c883770bd300aa0fb3c0 to your computer and use it in GitHub Desktop.
GoldSrc Counter Strike Rcon Command Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # usgae pyhton rcon.py <ip> <password> <command> | |
| import socket | |
| import sys | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| sock.settimeout(3.0) | |
| sock.sendto(b'\xff\xff\xff\xffchallenge rcon', (sys.argv[1], 27015)) | |
| response = sock.recvfrom(8196)[0] | |
| response = response.split() | |
| challenge = response[2] | |
| command = "rcon " + challenge.decode("utf-8") + ' ' + sys.argv[2] + ' ' + sys.argv[3] | |
| commandBytes = b'\xff\xff\xff\xff' + bytes(command, 'utf-8') | |
| sock.sendto(commandBytes, (sys.argv[1], 27015)) | |
| response = sock.recvfrom(8196)[0] | |
| print(response[4:].decode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much, this is the only working code for Gold Source RCON
I really appreciate it