Reputation: 11
I need to login into remote server with IP address and Port.
import telnetlib
try:
conn = telnetlib.Telnet("IPaddress", "Port")
response = 'Success'
except:
response = 'Failed'
finally:
print(response)
Connection is getting success. But while trying to see the configuration of the server using the below command, getting error message.
print(conn.read_all())
Welcome to xxx version: 3.2.28.38
Built: 20/10-2016 at 14:56
Unauthorized access prohibited
uclibc login:
Login timed out after 60 seconds.
Upvotes: 0
Views: 6237
Reputation: 669
this also works for me:
import socket
def isOpen(ip , port):
s = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
try:
s.connect((ip , int(port)))
s.shutdown(2)
return True
except:
return False
Upvotes: 1