gpt4 book ai didi

perl - 使用SAFEGUARD的HP不间断Guardian的SSH脚本

转载 作者:行者123 更新时间:2023-12-02 14:29:37 25 4
gpt4 key购买 nike

我们有一些perl脚本可以在带有telnet的hp不间断计算机上的Guardian OS上执行操作。
现在,我们必须关闭telnet,并必须使用与guarduser的ssh(comforte)连接。

我们尝试使用以下perl代码进行连接,似乎一切正常,但 shell 无法保持打开状态。

use Net::SSH::Perl;
use Term::ReadKey;
my $host = "XX.XXX.XXX.XXX";
my $user = "safeguarduser";
my $pass = "";
my $ssh = Net::SSH::Perl->new($host, options => [
"Cipher +aes256-ctr", "MACs +hmac-sha2-256", "HostKeyAlgorithms +ssh-dss"], debug => 1);
$ssh->login($user, $pass);

调试日志显示:
p-066280682253: Reading configuration data C:\Users\User\.ssh\config
p-066280682253: Reading configuration data C:\WINDOWS\ssh_config
p-066280682253: Connecting to XX.XXX.XXX.XXX, port 22.
p-066280682253: Remote version string: SSH-2.0-1.37g sshlib: TXXXXH0X_14MAY2018_comForte_SSH2_0105a:\TXXXX.$SSH01
p-066280682253: Remote protocol version 2.0, remote software version 1.37g sshlib: TXXXXH0X_14MAY2018_comForte_SSH2_0105a:\TXXXX.$SSH01
p-066280682253: Net::SSH::Perl Version 2.14, protocol version 2.0.
p-066280682253: No compat match: 1.37g sshlib: TXXXXH0X_14MAY2018_comForte_SSH2_0105a:\TXXXX.$SSH01.
p-066280682253: Connection established.
p-066280682253: Sent key-exchange init (KEXINIT), waiting for response.
p-066280682253: Using diffie-hellman-group-exchange-sha256 for key exchange
p-066280682253: Host key algorithm: ssh-dss
p-066280682253: Algorithms, c->s: aes256-ctr hmac-sha2-512 none
p-066280682253: Algorithms, s->c: aes256-ctr hmac-sha2-512 none
p-066280682253: Entering Diffie-Hellman Group Exchange.
p-066280682253: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<4096<8192) sent
p-066280682253: Sent DH Group Exchange request, waiting for reply.
p-066280682253: Received 2048 bit DH Group Exchange reply.
p-066280682253: Generating new Diffie-Hellman keys.
p-066280682253: Entering Diffie-Hellman key exchange.
p-066280682253: Sent DH public key, waiting for reply.
p-066280682253: Received host key, type 'ssh-dss'.
p-066280682253: Host 'XX.XXX.XXX.XXX' is known and matches the host key.
p-066280682253: Verifying server signature.
p-066280682253: Send NEWKEYS.
p-066280682253: Waiting for NEWKEYS message.
p-066280682253: Enabling encryption/MAC/compression.
p-066280682253: Sending request for user-authentication service.
p-066280682253: Service accepted: ssh-userauth.
p-066280682253: Trying empty user-authentication request.
p-066280682253: Login completed, opening dummy shell channel.
p-066280682253: channel 0: new [client-session]
p-066280682253: Requesting channel_open for channel 0.
p-066280682253: channel 0: open confirm rwindow 1048576 rmax 57344
p-066280682253: Got channel open confirmation, requesting shell.
p-066280682253: Requesting service shell on channel 0.

我们可以与Putty建立联系并合作。腻子设置中的exec命令为“tacl”。使用plink时,仅当我们使用腻子 session 名称时才有效。使用param和-c tacl,我们将得到与perl脚本相同的错误,没有 shell 。

(信息:客户端是Windows PC)

希望有人可以帮助我们,我们已经尝试了很多。

感谢你并致以真诚的问候

最佳答案

您能否确切说明在必须切换到SSH之前使用telnet session 所做的事情?
临时而言,我认为您可能最终会进入OSS(NonStop的UNIX特性),因为puTTY(可能还有plink)模仿了XTerm。如果在SSH协商期间指定的终端类型不是“TN6530-8”(NonStop Guardian终端仿真器),则NonStop SSH会自动将您带入OSS。

我只是尝试了plink(Windows 10 CMD提示符),并得到了这个,这是预期的:

C:\ Users \ andy \ Downloads> plink -ssh -pw xxxxxxx andyw@nnn.nn.nnn.nn gtacl -c'状态*,用户'

使用键盘交互式身份验证。

上次登录:2018年12月3日,05:37

上一次失败的尝试:2018年12月03日,05:31总失败次数:20

进程Pri PFR%WT Userid程序文件Hometerm

$ Z4YN B 0,119 146 001 8,1 $ SYSTEM.SYS07.TACL $ ZTN0。#PTB2NV5

$ SSLS 0,504 148 001 8,1 $ SYSTEM.SSLPRXY.SSLPRXY $ ZPTY。#ZWN0517

$ SSFS 0,749 148 001 8,1 $ SYSTEM.SSLPRXY.SSLFTPS $ ZPTY。#ZWN0517

$ Z2TJ 2,74 149 005 8,1 $ SYSTEM.SYS07.TACL $ ZPTY。#ZWN0882

$ Z5MZ 2,75 149 001 8,1 $ SYSTEM.SYS07.TACL $ ZPTY。#ZWN0886

$ Z5NR 2,254 149004 8,1 $ SYSTEM.SYS07.TACL $ ZHOME

        2,1019  148     001   8,1   $SYSTEM.SYS07.OSH          $ZPTY.#ZWN0886

X 2,1098 148 004 8,1 /bin/ksh $ZPTY.#ZWN0886

$ Z5NQ X 2,1139 149001 8,1 / bin / gtacl $ ZHOME

$ Z4YN 3,9 146 001 8,1 $ SYSTEM.SYS07.TACL $ ZTN0。#PTB2NV5

$ Z5MZ B 3,42 149 001 8,1 $ SYSTEM.SYS07.TACL $ ZPTY。#ZWN0886

$ Z2TJ B 3,201 149 001 8,1 $ SYSTEM.SYS07.TACL $ ZPTY。#ZWN0882

$ SSLS B 3,1014 148 001 8,1 $ SYSTEM.SSLPRXY.SSLPRXY $ ZPTY。#ZWN0517

$ SSFS B 3,1018 148 001 8,1 $ SYSTEM.SSLPRXY.SSLFTPS $ ZPTY。#ZWN0517

$ CAIL 3,1045 145011 8,1 $ SYSTEM.SYS07.TELSERV $ ZTN0。#PTB2P0J

C:\ Users \ andy \ Downloads>

关于perl - 使用SAFEGUARD的HP不间断Guardian的SSH脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53561031/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com