0

I am new to Python and trying to connect to a router using serial connection, which means there exists a step of typing in "username/password". Can anyone provide a example of serial connection with username/password being involved in?

Thanks so much!!

asked Aug 11, 2015 at 22:00
5
  • Have you looked at pyserial and its miniterm example? Commented Aug 12, 2015 at 1:39
  • @PatrickMaupin Yup! I did some research about Pyserial can not find an example with username/password case .. Commented Aug 12, 2015 at 12:22
  • You can give a username and password to miniterm, right? Commented Aug 12, 2015 at 12:31
  • In other words, how is username/password different from any other programmed interaction? Commented Aug 12, 2015 at 12:32
  • @PatrickMaupin Do you mind giving couple lines of code showing where to add username/password? It does not have to be exactly right but I am just trying to understand the basic idea and concepts. Thanks so much! Commented Aug 12, 2015 at 14:32

1 Answer 1

1

You are asking about the ability to handle requests from the serial port (such as a username or password prompt), and then to respond to those requests appropriately, such as by sending the username or password.

This is a fairly common use-case, but is not handled directly by pyserial, which only handles dumb pipes for bytes in both directions.

One package which might be of use is pexpect. Here is a paper that describes using pexpect in conjunction with pyserial to control and test routers:

http://wiki.ninux.org/ClauzClauz?action=AttachFile&do=get&target=clauz_router_testing_framework_4_python.pdf

answered Aug 12, 2015 at 16:28
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much for your help!

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.