1

I have python script: Using telnet it connects to remote host via telnet and simply executing command. It works fine with one host, but If i want using function to connect to 4+ hosts it maybe from 4-5 try sends only one random.

def main():
     usr = "adm"
     ip = "192.168.5.15"
     pwd = "123456"
     command = "tftp ......" (works fine)

     com(ip,usr,pwd,command)

def com(host,usr,pwd,comm):
    HOST=host
    user=usr
    password=pwd
    command = comm

    try:
     telnet = telnetlib.Telnet(HOST)
     telnet.read_until(b"Username:")
     telnet.write(user.encode('ascii') + b"\n")

     same for password

     telnet.write(command.encode('ascii') + b"\n")
     telnet.close()
     except:
       pass
main()   

Are there any limits for telnet connections in python or something that can limit number of sending files or anything?

Jane
  • 17
  • 4
  • I'd start by not masking all exceptions to see what is going on as if something did not get sent, I would presume it failed and included some indication as to why. Could you, please, do that or at least print the exception(s) and backtrace(s) and add that to your question? – Ondrej K. Aug 13 '19 at 09:27
  • If you are about telnet debugging it returns that it sends coommand on remote host – Jane Aug 13 '19 at 09:32

0 Answers0