Closed Juanzin420 closed 2 years ago
You are trying to connect to port 9987. Port 9987 is usually the port for client connections. The ports for serverquery are different. Usually, the serverquery port for telnet is 10011, 10022 for SSH. https://support.teamspeak.com/hc/en-us/articles/360002712257-Which-ports-does-the-TeamSpeak-3-server-use-
thank you @whookie , i changed the port and i get the following errors when i do so
SSH: TimeoutError: [Errno 110] Connection timed out
TELNET: raise TS3TransportError() from err ts3.query.TS3TransportError
any idea what the problem might be? both ports are unlocked on the modem and i used the actual ip for ssh, since localhost didnt work
Which URL did you use?
Try telnet://serveradmin:rIwlNQNohQ8p@localhost:10011
or ssh://serveradmin:rIwlNQNohQ8p@localhost:10022
i tried that, for SSH gives me
paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to connect to port 10022 on 127.0.0.1 or ::1
and for telnet ts3.query.TS3TransportError
:/
Try connecting to your telnet console manually:
telnet localhost 10011
(linux) or use putty (windows)
root@ubuntu:/home/juanzinteamspea# telnet localhost 10011 Trying ::1... Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused
Well, my obvious guesses would be that either a) your server isn't running b) you changed the port manually (be it accidentally or not) c) your port is somehow blocked or not listening or whatever (try netstat)
yeah both ports are not listed on netstat
im checking the config files, maybe i did change the port, i will change it back
ok so i had changed the query port on the config, i changed it back to 10011 and attempt to connect to the server again, but now is doing the same thing as it was with port 9987, just keeps trying to connect but it does nothing... any thoughts? @whookie
Maybe expecting some other message? Maybe the port is open and listening, you're just sending unknown messages (like SSH on a telnet port). But at least it is open now. If you tried telnet on 10011 and it didn't work, try SSH on the same port.
trying ssh on same port gives me
raise SSHException(
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
my config.yml looks like this
voice:
#Notes:
# Multibinding supported here! Host delimiter is \",\"
#The value must be a string
default_host: "0.0.0.0,::"
#Notes:
# Enforce the default host for every virtual server. Ignoring the server specific host
#The value must be a positive numeric value between 0 and 1
enforce: 0
web:
#Notes:
# Multibinding supported here! Host delimiter is \",\"
#The value must be a string
default_host: 0.0.0.0,[::]
query:
#The value must be a positive numeric value between 1 and 65535
port: 10101
#Notes:
# Multibinding supported here! Host delimiter is \",\"
#The value must be a string
host: 0.0.0.0,[::]
file:
#The value must be a positive numeric value between 1 and 65535
port: 30303
#Notes:
# Multibinding supported here! Host delimiter is \",\"
#The value must be a string
host: 0.0.0.0,[::]
query:
#Description:
# Change the query newline character
#Notes:
# NOTE: TS3 - Compatible bots may require \"\n\r\"
#The value must be a string
nl_char: "\n"
#Description:
# Max number of characters one query command could contain.
#The value must be a unsigned long between 8192 and 536870912
max_line_buffer: 1048576
#Description:
# The query welcome message
#Notes:
# If not like TeamSpeak then some applications may not recognize the Query
# Default TeamSpeak 3 MOTD:
# TS3\n\rWelcome to the TeamSpeak 3 ServerQuery interface, type \"help\" for a list of commands and \"help <command>\" for information on a specific command.\n\r
# NOTE: Sometimes you have to append one \r\n more!
#The value must be a string
motd: "TeaSpeak\nWelcome on the TeaSpeak ServerQuery interface.\n"
#Description:
# Enable/disable SSL for query
# Available modes:
# 0: Disabled
# 1: Enabled (Enforced encryption)
# 2: Hybrid (Prefer encryption but fallback when it isn't available)
#The value must be a positive numeric value between 0 and 2
enableSSL: 2
ssl:
#Description:
# The SSL certificate for the query client
#The value must be a string
certificate: certs/query_certificate.pem
#Description:
# The SSL private key for the query client (You have to export the key without a password!)
#The value must be a string
privatekey: certs/query_privatekey.pem```
Could you format that as code please?
i did but it came out like that lol i used code
< like this
now i got it!
So it works now? Config looks fine, just that your query seems to be on port 10101
no it doesnt work, i got it to look like code here on github hahah, and yeah i changed it to 10101 to test it like that, still same result tho
Only thing I can think of right now is reinstalling the server and starting from a fresh one. No idea why it doesn't work.
i'll do a little more digging before i do that, is it possible that a musicbot is getting on the way of it?
anything is possible, but if it is not using the query ports it is unlikely. You could also try watching the connection using Wireshark or check the server logs. I don't mean the server logs you get in the client, but the actual server console.
i will try that! many thanks!
so apparently it connects halfway? i get this on the log
[2021-10-27 16:53:00] [INFO ] QUERY | Got new client from ::1:57500
[2021-10-27 16:53:01] [DEBUG] QUERY | Got new query client from ::1. Whitelisted: false
[2021-10-27 16:53:04] [DEBUG] 1 | Cleaning up conversation cache.
and when i close the script on the terminal i get this msg on the log
[2021-10-27 16:54:36] [INFO ] QUERY | [::1:57500/ServerQuery#::1/57500 | 0] Connection closed. Client disconnected
.```
You could check if you have whitelist enabled. Normally ::1 / 127.0.0.1 are whitelisted by default, but you could still check. If they are not whitelisted, just add them, one per line:
::1
127.0.0.1
they are, idk why its saying whitelisted: false, if i use the public ip it says whitelisted: True but i still get the same result, i can connect with YaTQA to manage ts without a problem, idk why this would happen with the py-ts3 :|
Telnet for TS server query is nothing but a raw TCP socket. You could try connecting with a raw TCP socket and check if that works. Something along those lines:
import socket
sock = socket.socket()
sock.connect(("localhost", 10011))
print(sock.recv(1024).decode())
sock.send(b"quit\n\r")
print(sock.recv(1024).decode())
sock.close()
EDIT: If that doesn't work, just try debugging your code and step inside the library. If there is an issue with the library, maybe you can find it?
it worked with that code lol i guess
TeaSpeak
Welcome on the TeaSpeak ServerQuery interface.
error id=0 msg=ok
im not sure how to work the script using the socket tho , any suggestions on what should i do? ahhaha
Ooooh I think I see whats happening.
May be related to this line: https://github.com/benediktschmitt/py-ts3/blob/f87252a3708829453d0abe003fdd25819389489c/ts3/query.py#L443 My guess would be that because you are using TeaSpeak there may be some incompatibilities that the library may not be prepared for. I have never worked with TeaSpeak before, so unfortunately I can't really help there.
EDIT: The library splits the lines using the \n\r
line ending. From the raw socket code from before, you could remove the .decode()
from the sock.recv()
calls. That should show the line ending, if it is not \n\r
, the library can not properly parse it.
EDIT 2:
I see it now.
In your configuration your lines in the greeting message end in \r\n
, but the library expects \n\r
.
If you can't change the line ending in your TeaSpeak config, you probably need to change them locally in the library, which would make the code not very portable.
You could probably also do some hacky python stuff to go around that, but that's probably not a good idea.
Best to just change the line endings in the TeaSpeak config.
https://github.com/benediktschmitt/py-ts3/issues/102#issuecomment-953229533
# NOTE: TS3 - Compatible bots may require \"\n\r\"
#The value must be a string
nl_char: "\n"
This is the relevant answer for you.
Change nl_char
to "\n\r"
and try again.
it worked! thank you! i love you! lol
`#!/usr/bin/python3
import ts3
with ts3.query.TS3ServerConnection("telnet://serveradmin:rIwlNQNohQ8p@localhost:9987") as ts3conn: ts3conn.exec_("use", sid=1)
im trying to connect to the teamspeak server but it does nothing, seems to get stuck when trying to connect, does anybody know what i have to do?