Python Forum
Open a dos shell for ssh command - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Open a dos shell for ssh command (/thread-37407.html)



Open a dos shell for ssh command - martinmistere - Jun-06-2022

Ciao, which is the istruction that allows to open a dos shell in which I can eventually send ssh commands?


EDIT:

with the command os.system("cmd /k ssh root@indirizzo") I've been able to open the shell and to insert the address at which I want to connect to.
How can I, now, insert the password which is requested?

Thanks for support.


RE: Open a dos shell for ssh command - Larz60+ - Jun-06-2022

you need to use a terminal program.
DOS last release was for 8.0 (Windows Me) on September 14, 2000
you can use putty, or another SSH and telnet client.
see putty: https://www.putty.org/


RE: Open a dos shell for ssh command - martinmistere - Jun-06-2022

(Jun-06-2022, 02:41 PM)Larz60+ Wrote: you need to use a terminal program.
DOS last release was for 8.0 (Windows Me) on September 14, 2000
you can use putty, or another SSH and telnet client.
see putty: https://www.putty.org/

ok but which are the commands that allow me to call the shell?
as i've written I've tried os command but then I don't understand how can I insert the password.
thanks for support


RE: Open a dos shell for ssh command - Gribouillis - Jun-06-2022

You can communicate over ssh by using specialized modules such as fabric. These modules don't open a shell window, but they send commands over ssh and let your program use the results of these commands.

Another module that allows this is plumbum, which is not as well known as fabric, but I like its philosophy.


RE: Open a dos shell for ssh command - martinmistere - Jun-07-2022

(Jun-06-2022, 04:15 PM)Gribouillis Wrote: You can communicate over ssh by using specialized modules such as fabric. These modules don't open a shell window, but they send commands over ssh and let your program use the results of these commands.

Another module that allows this is plumbum, which is not as well known as fabric, but I like its philosophy.

ciao!thanks for the reply. uhm well I was interested in viewing the shell mostly to have an idea of what my code is actually doing... :) I'm not yet familiar with python unfortunatelly.
Anyway again thanks for your reply


RE: Open a dos shell for ssh command - Gribouillis - Jun-07-2022

(Jun-07-2022, 06:28 AM)martinmistere Wrote: I was interested in viewing the shell mostly to have an idea of what my code is actually doing
You could still print the commands that the program sends and the responses that it receives.


RE: Open a dos shell for ssh command - martinmistere - Jun-07-2022

Ciao,
I've exstablish an SSH connection using the following code:

> session = myconn.connect(SIM_IP, username =USER_SIM, password=PSW_SIM)
> stdin, stdout, stderr = myconn.exec_command(prova_comando)
> lines=stdout.readlines() print(lines)

now I want from this SSH, connect to another SSH which need the password as the previous one.
How can I do this?
Thanks