Python Forum
How to read router prompt and use it?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read router prompt and use it?
#1
When i login to a router, i get a following prompt.

R3-NYC
login: tac
Password:
[Router]R3-NYC#
[Router]R3-NYC#show clock
Wed May 22 04:46:18 2019 CST
[Router]R3-NYC#

1. How to capture CLI prompt to a string variable and use it for read_until() ?
i want to capture the prompt "[Router]R3-NYC#" . If i use read_until(), i have to mention the match. But i want to capture it after i login and use it later for the read_until() function the entire string instead of partial matches. I cannot hard core the hostname because i use this function for several other devices which will have different prompts.

2. How to capture command output to a string ?
I saw many refering to the function read_eager(). For some reason, when i test it, it has no capture. Only read_all() is working as expected. For this i have to wait till the telnet is closed. Could you please share some examples, if read_eager() is working for you.

Thanks
Simbha
Reply


Messages In This Thread
How to read router prompt and use it? - by simbha - May-06-2019, 03:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with my router. Pocket_Sand 2 2,223 Nov-19-2020, 04:06 PM
Last Post: Pocket_Sand
  Acces Wifi router and scan all the available networks through router jenkins43 3 2,772 Mar-21-2020, 09:35 PM
Last Post: jenkins43
  GNS3 telnet from bash terminal to virtual cisco router marienbad 2 3,726 Feb-24-2019, 07:55 AM
Last Post: marienbad
  Python module for Router configuration parsing anna 0 3,633 Mar-08-2018, 06:02 PM
Last Post: anna
  scapy ssh connection my network sniffing from my router Boss 1 6,183 Feb-13-2017, 07:04 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020