python - Storing Login Credentials for Command Line App -


i writing command line app in python using click module ssh cisco network device , send configuration commands on connection using netmiko module. problem i'm running ssh-ing network device requires hostname/ip, username, , password. trying implement way user of script login device once , keep ssh connection open, allowing subcommands run without logging in each time. example,

$ myapp ssh hostname/ip: 10.10.110.10  username: user password: ********  connected device 10.10.101.10  $ myapp command1 log output  $ myapp --option command2 log output  $ myapp disconnect closing connection 10.10.101.10 

how go storing/handling credentials allow functionality in cli? have seen recommendations of caching or oauth in researching issue, i'm still not sure how implement or recommended , safe way is.

perhaps attempting this.

$ myapp ssh -u user -p password (myapp) command1 (myapp) command2 (myapp) disconnect $ 

python has standard library module cmd may help:

https://docs.python.org/3.5/library/cmd.html


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -