serverstf / python-valve

A Python Interface to various Valve products and services
Other
235 stars 71 forks source link

Issue with rust server(s)? #38

Closed Mambix closed 7 years ago

Mambix commented 8 years ago

Hi!

I'm testing this on my local rust server and I can't make it work.

Runing

rcon = RCON(address=SERVER_ADDRESS, password=PASSWORD, timeout=1.0)
response = rcon.execute('echo Problems')
rcon.disconnect()

Gives me error:

Traceback (most recent call last):
  File "D:/GIT/bitbucket.com/rustBOTina/src/test.py", line 9, in <module>
    response = rcon.execute('echo Problems')
  File "C:\Python27\lib\site-packages\valve\source\rcon.py", line 272, in execute
    raise AuthenticationError
valve.source.rcon.AuthenticationError

But when I run this:

rcon = RCON(address=SERVER_ADDRESS, password=PASSWORD, timeout=1.0)
rcon.connect()
rcon.authenticate(PASSWORD)
response = rcon.execute('echo Problems')
rcon.disconnect()

I get:

Traceback (most recent call last):
  File "D:/GIT/bitbucket.com/rustBOTina/src/test.py", line 9, in <module>
    response = rcon.execute('echo Problems')
  File "C:\Python27\lib\site-packages\valve\source\rcon.py", line 275, in execute
    with self.response_to(request):
  File "C:\Python27\lib\site-packages\valve\source\rcon.py", line 231, in __enter__
    raise NoResponseError
valve.source.rcon.NoResponseError

But I can see in RUSTY that the command was executed:

Connecting to server
Success
id name time kills deaths suicides player building entity 

id name time kills deaths suicides player building entity 

Problems
Saved 11,340 ents, serialization(0.00), write(0.00), disk(0.00) totalstall(0.01).
Saving complete
Problems
Problems

As you can see I also sent 'stats' command and it printed only header line since no players are connected.

Is this a bug or am I doing something wrong here?

dlednik commented 7 years ago

Just an update on this: with version 0.2.1 still not working

rcon = RCON(address=SERVER_ADDRESS, password=PASSWORD)
rcon.connect()
rcon.authenticate()
response = rcon.execute('players')
print(response.text)
Traceback (most recent call last):
  File "D:/GIT/bitbucket.com/rustBOTina/src/test.py", line 31, in <module>
    rcon.authenticate()
  File "C:\Python27\lib\site-packages\valve\rcon.py", line 464, in wrapper
    return function(instance, *args, **kwargs)
  File "C:\Python27\lib\site-packages\valve\rcon.py", line 464, in wrapper
    return function(instance, *args, **kwargs)
  File "C:\Python27\lib\site-packages\valve\rcon.py", line 524, in authenticate
    raise RCONAuthenticationError(True)
valve.rcon.RCONAuthenticationError: Banned

So now it does not connect to a server at all. And it reports the wrong error as I can issue commands on the server from my PC with other tools. So IP is not banned.

dlednik commented 7 years ago

p.s. I did some analysis and it almost looks like the data that is sent is not correct. I see the data transmitted with wireshark. But the server just ignores it. Maybe Rust is using RCON protocol that is not to RCON standard???

Mambix commented 7 years ago

Ok so I figure it out. classic RCON is depricated in Rust. They use WebRCON, which is RCON over webSockets. So this will not work with new Rust servers. For reference: https://github.com/Facepunch/webrcon