Forum

> > CS2D > Scripts > Send RCON remotely
Forums overviewCS2D overview Scripts overviewLog in to reply

English Send RCON remotely

8 replies
To the start Previous 1 Next To the start

old Send RCON remotely

Quattro
GAME BANNED Off Offline

Quote
Is it possible to send rcon command to server without opening CS2D? For example send rcon command using python?

It would make life so much easier while updating lua scripts on dedicated server...

old Re: Send RCON remotely

DC
Admin Off Offline

Quote
It is possible and even documented in the CS2D in-game help under "RCon". All you have to do is sending a correctly encoded message via an UDP socket. This is possible with many programming languages, including Python.

Also note that external RCon can be a security risk and that it only works when the server is configured correctly. Features like cs2d cmd sv_rconusers disable external RCon.

old Re: Send RCON remotely

Quattro
GAME BANNED Off Offline

Quote
Could you guys give an example sending bytes? I am new to this and trying different things but cant figure out the correct way:

1
data = bytearray([1,0,242,4,'test',12,'sv_name test'])

This format one doesn't work

Edit:

1
2
MESSAGE = "1.0.242.4.test.12.sv_name test"
data = MESSAGE.encode('utf-8')

This one sends the line but server doesn't execute the command
edited 1×, last 04.07.18 09:15:17 am

old Re: Send RCON remotely

Quattro
GAME BANNED Off Offline

Quote
IMG:https://i.imgur.com/a8qsL5x.jpg


I am on correct path already but I am stuck with converting password string to bytes + ascii

1
2
3
4
5
6
7
8
9
10
11
12
13
14
password = 'test'
command = 'sv_name test'

first = (1).to_bytes(1, byteorder='big')
second = (0).to_bytes(1, byteorder='big')
third = (242).to_bytes(1, byteorder='big')
fourth = (4).to_bytes(1, byteorder='big')
fifth = ????

msg = first + second + third + fourth
print('message: ', msg)

///Output:
message: b'\x01\x00\xf2\x04'

old Re: Send RCON remotely

Yates
Reviewer Off Offline

Quote
If you're doing this on the same server you are hosting it on (Windows), you can send commands via the dedicated executable when it's running. I wouldn't remember how though, this was waayy back. But it is/was possible, so maybe something to look in to

old Re: Send RCON remotely

Quattro
GAME BANNED Off Offline

Quote
I'm doing this from my pc, server is windows.

Btw if there was a working example line it would be much easier for a noob like me to send that line

I made this but have no idea if server can accept it:

b'\x01\x00\xf2\x04test\x0c\x00sv_name test'


Ok I tried this line just for the sake of it and it works

Success in something you have no idea at feels good
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview