Python Forum

Full Version: Open a dos shell for ssh command
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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/
(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
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.
(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
(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.
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