linux到windows的ssh,ssh如何使用pxsh从linux到windows

我想

宋承宪

从Linux到Windows机器,不带密钥。

代码:

from pexpect import pxssh

import pexpect

import re

s=pxssh.pxssh()

s.login('12.0.0.2', 'user','password', original_prompt='.*', auto_prompt_reset=False)

s.expect("{}@{}'s password:".format('user','12.0.0.2'))

s.sendline('password')

s.expect(['administrator@pc_name C:\Users\Administrator>', pexpect.EOF, pexpect.TIMEOUT])

s.sendline('mkdir alex')

s.logout()

s.close()

我是否有两台机器之间的钥匙,这有关系吗?

错误:

pexpect.exceptions.TIMEOUT: Timeout exceeded.

command: /usr/bin/ssh

args: ['/usr/bin/ssh', '-q', '-l', 'user', '12.0.0.2']

buffer (last 100 chars): 'pc_name C:\\Users\\user> \x08\x1b]0;user: c:\\windows\\system32\\cmd.exe\x07mkdir alexexit'

before (last 100 chars): 'pc_name C:\\Users\\user> \x08\x1b]0;user: c:\\windows\\system32\\cmd.exe\x07mkdir alexexit'

after:

match: None

match_index: None

exitstatus: None

flag_eof: False

pid: 7602

child_fd: 5

closed: False

timeout: 30

delimiter:

logfile: None

logfile_read: None

logfile_send: None

maxread: 2000

ignorecase: False

searchwindowsize: None

delaybeforesend: 0.05

delayafterclose: 0.1

delayafterterminate: 0.1

searcher: searcher_re:

0: EOF

1: re.compile("(?i)there are stopped jobs")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值