Sending a command to another computer and get the results back on the computer where i started on.
I have a web server running with python on 192.168.10.100:5000.
So when i type in a command in the textbox of the first pc (i.e. ipconfig) and i click on the button, i want that the command is send to the first computer, and that the first computer executes the (ipconfig) command and sends the result back to the webserver (192.168.10.100) and presents the results on the screen.
I already have the webserver running in python and the website is also build and i can also send a command to the webserver itself and get that result back. The only problem is that i don't know how to send the command to another computer.
If you want to execute commands on a remote computer, the simplest solution is a ssh server on the remote computer. See this thread http://www.daniweb.com/software-development/python/threads/375262/1615004#post1615004 .
So i have to build an ssh server on the remote pc where i want to send the command to right? But after that how do i connect them? And how do i send the command from my webserver to the remote ssh client?
Could you build a working example for my situation please so i fully understand what the script is doing?
And i'm sorry but i do not completely understand what your script is doing.
Your web server would run similar code to send a command to the computer with a ssh server. The first 4 lines connect to the ssh server, line 5 sends a command to the ssh server, i, o, e are input, output and error streams for this command. Lines 6+ read the command's output in the streams o and e.
Edit: click the 'Toggle plain text' item before you copy code from this forum.
So i also run this same script on my server in line 4 i would type this?
IP?ADDRESS = ip address of remote server?
USER = username on remote server?
PASSWORD = password of the login name of the remote server?
All I had to do was to install copssh on the computer named 'hirondelle'. User name and password have been changed for the forum (I also have another trick to avoid hard coding my user name and password).
Well i tried installing paramiko but i just couldn't get it to work. All the installations finished without any error message's or warnings but still python tells me i don't have this pakage. Could you pleaes tell me where you got it and how you installed it? Cause without it i cannot continue.
My version of Python is 3.2.2.
One server is physical and the other server is virtual.
Also if you know a way how to do this with telnet instead of ssh i also would appreciate it very much!
Cause i just cannot continue now that i wasn't able to install paramiko.
where Command is a snippet similar to this one http://www.daniweb.com/software-development/python/code/257449 .
How to run a python script at windows startup?