Skip to content

Instantly share code, notes, and snippets.

@imjiten
Last active December 20, 2024 21:40
Show Gist options
  • Select an option

  • Save imjiten/b8c4456aaa12c883770bd300aa0fb3c0 to your computer and use it in GitHub Desktop.

Select an option

Save imjiten/b8c4456aaa12c883770bd300aa0fb3c0 to your computer and use it in GitHub Desktop.
GoldSrc Counter Strike Rcon Command Python
# 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'))
@NecroBoy
Copy link

Thank you very much, this is the only working code for Gold Source RCON
I really appreciate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment