使用Python在局域网桌面上打开应用程序

2024-09-30 02:33:50 发布

您现在位置:Python中文网/ 问答频道 /正文

昨天,我可以使用以下脚本从Windows PC成功连接到Unix服务器:

**import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('punltc02.force.com',username = 'amkar',password = 'new')
stdin,stdout,stderr = ssh.exec_command("pwd") (it works !!)

>>> stdout.readlines()

[u'/home/amkar\n'

今天,我也在尝试做同样的事情,但是我尝试从笔记本电脑连接到Windows桌面,而不是Unix服务器。我需要连接到桌面并开始使用Python运行应用程序。我得到以下错误:

^{pr2}$

我怀疑是否也需要在局域网桌面上安装OpenSSH。或者,还有其他方法。请帮忙。在

谢谢和问候, 阿米特拉


Tags: import服务器脚本hostparamikowindowsstdoutunix
2条回答

你必须在局域网桌面上安装OpenSSH。在

另外,如果已经安装了OpenSSH,请尝试禁用防火墙。Ping远程计算机以检查您的计算机和远程计算机之间是否有连接。在

您可以使用Paramiko来执行远程应用程序。您可以使用ssh.exec_command()来表示:

import paramiko    
sh = paramiko.SSHClient()
ssh.connect(server, username=username, password=password)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute_on_remote_machine)

另一种可能性是PsExec。在

也许像这样?
http://resources.infosecinstitute.com/creating-undetectable-custom-ssh-backdoor-python-z/

import paramiko
import threading
 
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('10.0.2.15', username='root', password='toor')
chan = ssh.get_transport().open_session()
chan.send('Hey i am connected :) ')
print chan.recv(1024)
client.close

相关问题 更多 >

    热门问题