this is a security test in Python. Using telnet to connect to a public IP/Port but my program runs so slow it won't complete. I even set timeout to 1 second. How can I speed it up?
This is my code:
import telnetlib
# long list of IPs
ips = ["xx.81.56.xxx", "xx.81.56.xxx"]
# long list of ports
ports = ["22", "10800" , "4422"]
connections = {}
for ip in ips:
for port in ports:
try:
connections[ip, port] = isinstance(telnetlib.Telnet(ip, port, 1), telnetlib.Telnet)
except:
connections[ip, port] = False
Thank you!