python—pexpect的ssh使用
使用的pexpect模拟kali linux客户端ssh登陆另外一台kali linux服务器
1、前提两台kali linux 机器,
kali linux 客户端 192.168.100.139
kali linux 服务器 192.168.100.140
2、使用客户端192.168.100.139 ssh能够登陆进去192.168.100.140
root@kali:~#
root@kali:~# ifconfig#本机客户端
eth0 Link encap:Ethernet HWaddr 00:0c:29:ad:34:08
inet addr:192.168.100.139 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fead:3408/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2025172 errors:0 dropped:1370 overruns:0 frame:0
TX packets:220482 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:292858397 (279.2 MiB) TX bytes:21145429 (20.1 MiB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:3287 errors:0 dropped:0 overruns:0 frame:0
TX packets:3287 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:216736 (211.6 KiB) TX bytes:216736 (211.6 KiB)
root@kali:~#
root@kali:~# ssh root@192.168.100.140
The authenticity of host '192.168.100.140 (192.168.100.140)' can't be established.
ECDSA key fingerprint is 2c:10:cc:7b:9d:37:ef:25:1b:90:aa:36:18:fb:96:29.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.140' (ECDSA) to the list of known hosts.
root@192.168.100.140's password:
The programs included with the Kali