I am trying to create a telnet to Teamspeak 3 Server Query through python, this is my code:
__author__ = 'Khailz'
import telnetlib, socket
HOST = "unlightedgaming.com"
port = 10011
timeout = 5
for i in range(len(HOST)):
print "scanning " + HOST[i] + " ...\n"
try:
tn = telnetlib.Telnet(HOST[i],23,3)
except socket.timeout:
pass
#tn = telnetlib.Telnet(host, port, timeout)
#telnetlib.Telnet(host, port, timeout)
tn.read_until("Welcome to the TeamSpeak 3 ServerQuery interface")
print tn.read_all()
But i seem to get the error from socket saying that it cannot get the address.
C:\Python27\python.exe C:/Users/Khailz/PycharmProjects/Teamspeak-IRC/test.py
scanning 1 ...
Traceback (most recent call last):
File "C:/Users/KhailzXsniper/PycharmProjects/Teamspeak-IRC/test.py", line 14, in <module>
tn = telnetlib.Telnet(HOST[i],23,3)
File "C:\Python27\lib\telnetlib.py", line 211, in __init__
self.open(host, port, timeout)
File "C:\Python27\lib\telnetlib.py", line 227, in open
self.sock = socket.create_connection((host, port), timeout)
File "C:\Python27\lib\socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11004] getaddrinfo failed
What am I doing wrong