From 4f5f00860c2d9db0bbb0300e5badb725084bea67 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Tue, 8 Sep 2020 11:51:22 -0600 Subject: [PATCH] more sendline on telnet --- cisco_wifi_ctl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cisco_wifi_ctl.py b/cisco_wifi_ctl.py index e2435d9a..01241069 100755 --- a/cisco_wifi_ctl.py +++ b/cisco_wifi_ctl.py @@ -181,6 +181,7 @@ def main(): egg.sendline(' ') i = egg.expect(["ssword:", "continue connecting (yes/no)?","Escape",">","#","username\:",pexpect.TIMEOUT], timeout=3) time.sleep(0.1) + egg.sendline() if i == 0: egg.sendline(passwd) print("password") @@ -276,7 +277,8 @@ def main(): print("use command line args --prompt to set the correct prompt") print("use substring of prompt for controllers that have prompt levels like 9800 series") print("will now check for any prompt that ends with > or # ") - egg.sendline(' ') + egg.sendline() + egg.sendline() break if prompt_found == False: @@ -289,15 +291,19 @@ def main(): if args.series == "9800": print("sending enable 9800 series putting in Privileded EXEC mode") egg.sendline("enable") + egg.sendline() time.sleep(0.1) j = egg.expect(["ssword",pexpect.TIMEOUT],timeout=3) if j == 0: egg.sendline(passwd) + egg.sendline() if j == 1: print("timed out") + egg.sendline() if i == 1: print("# found in prompt") print("prompt found {}{}".format(egg.before, egg.after)) + egg.sendline() if i == 2: print("time out second time check prompt")