Creating your own access terminal

In Python, and programming in general, you are the vendor! You can create any code combination and procedures you like in order to serve your needs. In the second use case, we will create our own terminal that accesses the router through telnetlib. By writing a few words in the terminal, it will be translated too many commands executed in the network device and return output, which could be just printed in the standard output or saved in file:

#!/usr/bin/python__author__ = "Bassim Aly"__EMAIL__ = "basim.alyy@gmail.com"import telnetlibconnection = telnetlib.Telnet(host="10.10.88.110")connection.read_until("Username:")connection.write("admin" + "\n")connection.read_until("Password:")connection.write("access123" ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.