Motivation: After deploying a large network of Cisco router and switches it can be difficult to test if SSH or Telnet works on the device or not when connecting from the management server for a given username password and enable password.
Objective:
After network deployment checking for:
- Is the device reachable from management station.
- Are we able to connect to the device via telnet.
- Are we able to connect to the device via SSH.
- Does a particluar set of credentials work for logging into the device
Logic of script:
- The script first does a ping to all the IP to check which all IPs are reachable.
- The script then connects to all the reachable IP via telnet to check we are able to connect.( using telnetlib)
- The script then connects to all the reachable IP via SSH to check if we are able to connect. -default username is :"" -default password is :"" if we get an authentication exception it means that we were able to connect.
- The script then tries username and password used to connect the device via SSH if SSH was found enabled for the device in step 3.
- If SSH was not enabled for the device but telnet was, it tries to connect via telnet using the cerdentials shared.
- The script then tries to use the username and password to connect to get into the privilege mode using the enable password.
Input to the script : management subnet. excluded IP from the subnet. any addiontional IPs you want to include.
username - username.yaml password - password.yaml enablepassword - enablepassword.yaml
Output of script: output.csv
PS:
The Script can also be used in cases where you want to check out of a combination of cerdentials something can be used to login into the device.