Python Forum
Open a dos shell for ssh command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open a dos shell for ssh command
#1
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.
Reply
#2
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/
Reply
#3
(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
Reply
#4
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.
Reply
#5
(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
Reply
#6
(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.
Reply
#7
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I need some clarity on the use of the open command JonWayn 11 2,736 Nov-08-2022, 11:46 PM
Last Post: JonWayn
  Dynamic File Name to a shared folder with open command in python sjcsvatt 9 6,520 Jan-07-2022, 04:55 PM
Last Post: bowlofred
  Sound Approach for Running a Shell Command? matt_the_hall 8 3,606 Dec-14-2020, 02:52 PM
Last Post: matt_the_hall
  Saving shell command into a List steackfrite 4 4,103 Aug-31-2017, 11:28 AM
Last Post: steackfrite

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020